I use this code below, but it works partly - set wallpapers only on my real device api23 nexus5, in another devices in no way not setting. Also cant set wallpapers to icon of contact.
My actions:
- tap button set wallpaper
- in the opened window select service:
if choosed 'Contact photo' - open the service and if choose any contact
- Actual result: just return to my wallpapers app without set
- Expected result: must open 'crop picture' the image and then tap to set this image to contact icon.
if choosed 'Wallpaper'
- Actual reuslt: just return to my wallpapers app without set and show message 'Can not load the image'(work only api 23 on my Nexus5)
Expected result: open the service and tap to set
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); // attach services intent.addCategory(Intent.CATEGORY_DEFAULT); file = new File(getFolderStorageDirectory(), getFileName()); // create temp file if (isExternalStorageWritable()) { // check whether available external storage try { FileOutputStream out = new FileOutputStream(file); mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); // write image out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); Log.e(TAG, "File not saved"); } } else { showToast(getString(R.string.sd_card)); } intent.setDataAndType(Uri.parse(file.getAbsolutePath()), "image/*"); intent.putExtra("mimeType", "image/*"); intent.putExtra("jpg", "image/*"); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(file.getAbsolutePath())); startActivity(Intent.createChooser(intent, "Select service:"));
Why not work?