Add support for play.google.com app links

As requested in #154
This commit is contained in:
Daniel Martí 2015-03-30 18:07:03 +02:00
parent d22c714dbd
commit 53aa7ec849
2 changed files with 21 additions and 1 deletions

View File

@ -294,6 +294,19 @@
<data android:host="www.f-droid.org" />
<data android:pathPrefix="/app/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="play.google.com" /> <!-- they don't do www. -->
<data android:path="/store/apps/details" />
</intent-filter>
</activity>
<activity
android:label="@string/menu_preferences"

View File

@ -348,6 +348,7 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
* Various different intents could cause us to show this activity, such as:
* <ul>
* <li>market://details?id=[app_id]</li>
* <li>https://play.google.com/store/apps/details?id=[app_id]</li>
* <li>https://f-droid.org/app/[app_id]</li>
* <li>fdroid.app:[app_id]</li>
* </ul>
@ -362,8 +363,14 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
String appId = null;
if (data != null) {
if (data.isHierarchical()) {
if (data.getHost() != null && data.getHost().equals("details")) {
final String host = data.getHost();
if (host == null) {
Log.e(TAG, "Null host found in app link!");
return null;
}
if (host.equals("details") || host.equals("play.google.com")) {
// market://details?id=app.id
// https://play.google.com/store/apps/details?id=app.id
appId = data.getQueryParameter("id");
} else {
// https://f-droid.org/app/app.id