Other apps can use my activity to open .zip
files.
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/zip"/>
</intent-filter>
But sometimes when I try to open file with my activity, intent.getData()
returns wrong uri!
For example the file actual path is storage/emulated/0/abc.zip
but intent.getData().getPath()
returns /external/file/749
.
The code I use:
Intent intent = getIntent();
Uri data = intent.getData();
if(data != null){
Log.d("TAG", "MAIN: " + data.toString());
Log.d("TAG", "MAIN: " + data.getEncodedPath());
Log.d("TAG", "MAIN: " + data.getPath());
//All returns something like /external/file/749
}