List of usage examples for android.net Uri getEncodedSchemeSpecificPart
public abstract String getEncodedSchemeSpecificPart();
From source file:id.ridon.keude.AppDetailsData.java
/** * Attempt to extract the appId from the intent which launched this activity. * Various different intents could cause us to show this activity, such as: * <ul>//from w w w . j a v a2 s . co m * <li>market://details?id=[app_id]</li> * <li>https://f-droid.org/app/[app_id]</li> * <li>fdroid.app:[app_id]</li> * </ul> * @return May return null, if we couldn't find the appId. In this case, you will * probably want to do something drastic like finish the activity and show some * feedback to the user (this method will <em>not</em> do that, it will just return * null). */ private String getAppIdFromIntent() { Intent i = getIntent(); Uri data = i.getData(); String appId = null; if (data != null) { if (data.isHierarchical()) { if (data.getHost() != null && data.getHost().equals("details")) { // market://details?id=app.id appId = data.getQueryParameter("id"); } else { // https://f-droid.org/app/app.id appId = data.getLastPathSegment(); if (appId != null && appId.equals("app")) { appId = null; } } } else { // fdroid.app:app.id appId = data.getEncodedSchemeSpecificPart(); } Log.d(TAG, "AppDetails launched from link, for '" + appId + "'"); } else if (!i.hasExtra(EXTRA_APPID)) { Log.e(TAG, "No application ID in AppDetails!?"); } else { appId = i.getStringExtra(EXTRA_APPID); } return appId; }