2

In my app there is a rating button. If the user activates this button, the user will be forwarded to the Google Play website to give a review.

market://details?id=<package name>

Now I uploaded my app to other app stores. And they want, that I must change the Link from the button to e.g.

https://www.otherAppStore.com/android?p=<package name>

How can I solve this problem? I'm now thinking to make different versions (AndroidManifest.xml). For e.g. for google:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
android:versionCode="1"
android:versionName="1.0.0.1" >

and for the other app store:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
android:versionCode="1"
android:versionName="1.0.0.2" >

Looks not professional?

4

1 回答 1

4

One approach is the following:

In your manifest in your tag add a meta-data that includes the url of the store.

    <meta-data
        android:name="store.url"
        android:value="market://details?id=<package name>" />

Then in your code use this value. Now every time you want to update your app you have to create builds with different android:value. You can do some scripting to automate this process.

To retrieve this url:

try {
    ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
    if (ai.metaData != null) {
        url = ai.metaData.getString("store.url");
    }
} catch (PackageManager.NameNotFoundException e) {
    // if we can't find it in the manifest, do something maybe fallback or runtime exception
}
于 2013-10-09T13:49:43.643 回答