Issue
I have a video player app and there are a few apps out there that share videos with my app. Technically any app that shares a video via a Intent
can share it with my app but there are a few more complex options my app accepts that some apps will also pass.
I would like to know if there is a way for my app to know which was the app that sent the Intent
?
Solution
Actually there is a referrer
in Activity (since API 22) which is not 100% guaranteed but I've used it in an app and it works great. Here is the docs for it.
Return information about who launched this activity. If the launching Intent contains an Intent.EXTRA_REFERRER, that will be returned as-is; otherwise, if known, an android-app: referrer URI containing the package name that started the Intent will be returned. This may return null if no referrer can be identified -- it is neither explicitly specified, nor is it known which application package was involved.
You can get it using Activity.getRefferer()
in Java or simply referrer
in Kotlin
Answered By - Amin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.