I got a requirement that we can open a .zip file(replaced with .activity) through my app. I set the manifest.xml like
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.activity" />
</intent-filter>
When I open a file named 'test.activity' which is 'test.zip' actually with the code below.
public void chooseFile(CallbackContext callbackContext) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
First I push 'test.activity' to /sdcard/Download and I got a uri like content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Ftest.activity
Then I click Downloads and copy the file to Downloads as well(/sdcard/Download), it will be named with test(1).activity automatically. I thought the correct uri should be
content://com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Ftest(1).activity
but I got a uri like
content://com.android.providers.downloads.documents/document/805
So the 'intent-filter' I mentioned at the beginning will become invalid. Could anyone tell me why the end of this uri becomes a number?