I download content through downloadManager in my app. When download completed and user click notification, my app open.
starting download:
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI or DownloadManager.Request.NETWORK_MOBILE)
.setMimeType(context.getString(R.string.application_mime_type))
.setTitle(context.getString(R.string.download_title))
.setDescription(videoName)
.setDestinationInExternalFilesDir(context,
MY_CONTENT_PATH,
getFileNameForContent(id, videoName, videoType))
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
manager.enqueue(request)
catch notification click:
<activity
android:name=".presentation.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="@string/application_mime_type" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
MainActivity onCreate():
val dataUri = intent.data
if (dataUri != null) {
...
}
For API 19
dataUri = file:///storage/emulated/0/Android/data/ru.mycompany.myapp/files/filename.mp3
For API 25 dataUri=content://com.android.providers.downloads.documents/document/276
My question: it difference depends on android version or device? Where can i find documentation for this?