Java Code Examples for android.app.PendingIntent#getTargetPackage()
The following examples show how to use
android.app.PendingIntent#getTargetPackage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiCompatibilityUtils.java From cronet with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see android.app.PendingIntent#getCreatorPackage() */ @SuppressWarnings("deprecation") public static String getCreatorPackage(PendingIntent intent) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return intent.getCreatorPackage(); } else { return intent.getTargetPackage(); } }
Example 2
Source File: BrowserActionsIntent.java From custom-tabs-client with Apache License 2.0 | 5 votes |
/** * Get the package name of the creator application. * <p> * <strong> Note:</strong> This is self-reported and could be untrusted. Intent sender can * modify it to return the package name from a different application. * * @param intent The {@link BrowserActionsIntent}. * @return The creator package name. */ @SuppressWarnings("deprecation") public static String getUntrustedCreatorPackageName(Intent intent) { PendingIntent pendingIntent = intent.getParcelableExtra(BrowserActionsIntent.EXTRA_APP_ID); if (pendingIntent != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return pendingIntent.getCreatorPackage(); } else { return pendingIntent.getTargetPackage(); } } return null; }
Example 3
Source File: ApiCompatibilityUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * @see android.app.PendingIntent#getCreatorPackage() */ @SuppressWarnings("deprecation") public static String getCreatorPackage(PendingIntent intent) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return intent.getCreatorPackage(); } else { return intent.getTargetPackage(); } }
Example 4
Source File: BrowserActionsIntent.java From 365browser with Apache License 2.0 | 5 votes |
/** * Get the package name of the creator application. * @param intent The {@link BrowserActionsIntent}. * @return The creator package name. */ @SuppressWarnings("deprecation") public static String getCreatorPackageName(Intent intent) { PendingIntent pendingIntent = intent.getParcelableExtra(BrowserActionsIntent.EXTRA_APP_ID); if (pendingIntent != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return pendingIntent.getCreatorPackage(); } else { return pendingIntent.getTargetPackage(); } } return null; }
Example 5
Source File: PackageUtils.java From android_packages_apps_GmsCore with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") public static String packageFromPendingIntent(PendingIntent pi) { if (pi == null) return null; if (SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { return pi.getTargetPackage(); } else { return pi.getCreatorPackage(); } }