Houcine
Houcine

Reputation: 24181

redirect user to play store from my app

I want to redirect the user to the Google Play Store application from my app, and i want to open the collection of Editor's choice as a default activity of the play store app.

in Documentation(OpeningCollection), it says that if you want to open the Editor's choice collection you should use :

market://apps/collection/<collection_name>

I've tried this :

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://apps/collection/editors_choice"));
startActivity(intent);

But it doesn't work , it always give ActivityNotFoundException :

06-21 17:23:26.564: W/System.err(1820): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market }
06-21 17:23:26.564: W/System.err(1820):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java)
06-21 17:23:26.564: W/System.err(1820):     at android.app.Instrumentation.execStartActivity(Instrumentation.java)
06-21 17:23:26.564: W/System.err(1820):     at android.app.Activity.startActivityForResult(Activity.java)
06-21 17:23:26.564: W/System.err(1820):     at android.app.Activity.startActivityForResult(Activity.java)
06-21 17:23:26.564: W/System.err(1820):     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
06-21 17:23:26.564: W/System.err(1820):     at android.app.Activity.startActivity(Activity.java)
06-21 17:23:26.564: W/System.err(1820):     at android.app.Activity.startActivity(Activity.java)
06-21 17:23:26.564: W/System.err(1820):     at com.icompagnon.activities.ApplicationsSpaceActivity.onClick(ApplicationsSpaceActivity.java:92)
06-21 17:23:26.564: W/System.err(1820):     at android.view.View.performClick(View.java)
06-21 17:23:26.564: W/System.err(1820):     at android.view.View$PerformClick.run(View.java)
06-21 17:23:26.564: W/System.err(1820):     at android.os.Handler.handleCallback(Handler.java)
06-21 17:23:26.564: W/System.err(1820):     at android.os.Handler.dispatchMessage(Handler.java)
06-21 17:23:26.564: W/System.err(1820):     at android.os.Looper.loop(Looper.java)
06-21 17:23:26.564: W/System.err(1820):     at android.app.ActivityThread.main(ActivityThread.java)
06-21 17:23:26.564: W/System.err(1820):     at java.lang.reflect.Method.invokeNative(Native Method)
06-21 17:23:26.564: W/System.err(1820):     at java.lang.reflect.Method.invoke(Method.java)
06-21 17:23:26.564: W/System.err(1820):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
06-21 17:23:26.564: W/System.err(1820):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
06-21 17:23:26.564: W/System.err(1820):     at dalvik.system.NativeStart.main(Native Method)

When i try to open the details of some application it works ( example : google-maps app):

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.google.android.apps.maps"));
startActivity(intent);

But when i try to open the editor's choice activity , it returns exception. Is this an issue in Android ??

Upvotes: 0

Views: 3053

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007534

Your copy of the Play Store does not support market://apps/collection/editors_choice.

You might try the alternative (http://play.google.com/store/apps/collection/editors_choice) to see whether the Play Store comes up as an available option. If it does, then that would suggest a documentation bug, and there's some different syntax for the market:// version of that Uri. If the Play Store does not come up as an option, that would suggest that your edition of the Play Store perhaps pre-dates the addition of support for those Uri structures.

Upvotes: 1

Related Questions