Activity.LaunchedFromUid Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the uid of the app that initially launched this activity.
public virtual int LaunchedFromUid { [Android.Runtime.Register("getLaunchedFromUid", "()I", "GetGetLaunchedFromUidHandler", ApiSince=34)] get; }
[<get: Android.Runtime.Register("getLaunchedFromUid", "()I", "GetGetLaunchedFromUidHandler", ApiSince=34)>]
member this.LaunchedFromUid : int
Property Value
the uid of the launching app or Process#INVALID_UID
if the current
activity cannot access the identity of the launching app
- Attributes
Remarks
Returns the uid of the app that initially launched this activity.
In order to receive the launching app's uid, at least one of the following has to be met: <ul> <li>The app must call ActivityOptions#setShareIdentityEnabled(boolean)
with a value of true
and launch this activity with the resulting ActivityOptions
. <li>The launched activity has the same uid as the launching app. <li>The launched activity is running in a package that is signed with the same key used to sign the platform (typically only system packages such as Settings will meet this requirement). </ul>. These are the same requirements for #getLaunchedFromPackage()
; if any of these are met, then these methods can be used to obtain the uid and package name of the launching app. If none are met, then Process#INVALID_UID
is returned.
Note, even if the above conditions are not met, the launching app's identity may still be available from #getCallingPackage()
if this activity was started with Activity#startActivityForResult
to allow validation of the result's recipient.
Java documentation for android.app.Activity.getLaunchedFromUid()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.