1

My app is a system app. I share picture with ExifInterface.TAG_GPS_LATITUDE , ExifInterface.TAG_GPS_LONGITUDE by bluetooth. However, there's no ExifInterface.TAG_GPS_LATITUDE & ExifInterface.TAG_GPS_LONGITUDE on the picture which other devices received .

There is my code .
android:sharedUserId="android.uid.system"

Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_SUBJECT, context.getResources().getString(R.string.button_share_default));
// [test uri]  content://media/external/images/media/564
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
Intent chooser = Intent.createChooser(intent, context.getResources().getString(R.string.button_share_default));
chooser.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
context.startActivity(chooser);

I try to use <content://com.android.providers.media.documents/document/image%3A564>, but logcat warn :

1415-7828/? W/ContentProviderHelper: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{660c88f 1668:com.android.bluetooth/1002} (pid=1668, uid=1002) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs  

1668-12407/? W/System.err: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{660c88f 1668:com.android.bluetooth/1002} (pid=1668, uid=1002) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

How can I do ?
tks. enter image description here

curry
  • 11
  • 3
  • Can your app read that exif location information before sharing the file? Normally using ExifInterface this info is stripped out on modern Android ##. – blackapps Oct 08 '22 at 11:53
  • Yes , my app can read the exif location information . I share pic by system file mananger , it's normal. – curry Oct 09 '22 at 01:02
  • By system file manager? What has that to do with your app? Or with programming? You posted code??? And what is normal? – blackapps Oct 09 '22 at 04:17
  • https://stackoverflow.com/questions/73571692/new-android-13-photo-picker-exif-location-not-working – blackapps Oct 09 '22 at 04:32
  • `on the picture which other devices received .` How does one share to other devices? Please tell your scenario. – blackapps Oct 09 '22 at 04:57
  • bluetooth. `I share picture ... by bluetooth` – curry Oct 09 '22 at 06:15
  • `` That is not an uri you obtained using ACTION_OPEN_DOCUMENT i think. And did you take persistable uri permission? – blackapps Oct 09 '22 at 08:44
  • Yes, I take persistable uri permission, but it is no use. 'android:sharedUserId="android.uid.system"' is key , If I delete that , it worked. – curry Oct 10 '22 at 03:53
  • ?????? sharedUserId? Where? – blackapps Oct 10 '22 at 06:02
  • My app is a system-signed app. Need to add `android:sharedUserId="android.uid.system"` in AndroidManifest.xml – curry Oct 10 '22 at 09:03

0 Answers0