Reputation:
I want to share images from MIUI gallery app to my app but received intent has data=null
and
uri=content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FAndroid%2Fdata%2Fcom.miui.gallery%2Fcache%2FSecurityShare%2F1657350098978.jpg
Then i use Cursor
to get file path and path is:
/storage/emulated/0/Android/data/com.miui.gallery/cache/SecurityShare/1657350098978.jpg
As you see, it shares from its data folder, So my app can not reach the file. This is happening only for images and only in Xiomi MIUI gallery app.
This is my manifest:
<activity
android:name=".activity.ReceiveShareActivity"
android:configChanges="uiMode"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
And this is my code:
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
final String[] columns = {MediaStore.Files.FileColumns.DATA,
MediaStore.Files.FileColumns.DISPLAY_NAME,
MediaStore.Files.FileColumns.SIZE,
MediaStore.Files.FileColumns._ID};
final String orderBy = MediaStore.Files.FileColumns._ID;
Cursor cursor = getContentResolver().query(uri, columns, MediaStore.Files.FileColumns.SIZE + ">0", null, orderBy);
Upvotes: 1
Views: 2002
Reputation: 1
File name: /storage/emulated/0/Android/data/ com.miui.gallery/files/gallery_disk_cache/small_size/
4cf9376dcba15cc89781aad25ee115e9529961b156a0c
66c05be148043aa9942.0
File size: 11141 bytes
Dimensions: 180-320
Upvotes: -1
Reputation:
Thanks to @blackapps, I tried with Inputstream
with URI and it works well.
Upvotes: 0