App package name A, send intent with action ACTION_VIEW and url data to system, app B get it and open, but I just want B open intent and don't want app B get app A's package name, How to do it?
Asked
Active
Viewed 202 times
1 Answers
1
The only way to find out the package that sent the Intent seems to be via Acitvity#getReferrer()
(taken from this SO post). In its docs, the following is clearly stated
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, anIntent#URI_ANDROID_APP_SCHEME
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.
Hence you can add Intent.EXTRA_REFERRER
to the intents you're sending to override the default value.
Ref

ashu
- 1,756
- 4
- 22
- 41