So i have coded a few script that uses URI. However there are a lot of complaints that the function not working in Xiaomi / Redmi / huawei. This coded are tested and work well within emulator. Get filename and path from URI from mediastore No response on full screen activity (different android version?)
So any one have any suggestion / work around for this problem? Work around 1: To use assets folder(havent tried with picture, but mostly work-able, but not working with the video file.)
So far I narrow down my code to
videoUri = Uri.parse("android.resource://" + getPackageName() + "/raw/" + filename);
the above work only in emulator, not working in xiaomi / huawei
What can we do with this?
videoUri = Uri.parse("android.resource://" + getPackageName() + R.raw.filename);
the above works well in both emulator and real phone.
Anyone had any thought on this?
Trying 1
How to read file from res/raw by name
int videoID = getResources().getIdentifier("filename","raw", getPackageName());
videoUri = Uri.parse("android.resource://" + getPackageName() + "/" +
videoID);
Result: Working with emulators, still not working with my Redmi Note 2