Opening my application from Google Play App crashes on exit

梦想与她 提交于 2019-12-12 03:04:45

问题


I have option to open my app Google Play page inside my app. When clicking open button in Google Play My app launches again. (From Splash screen)

When I am exiting my app it crashed. I tried put singleTask flag to my Home activity. It actually worked fine. But arised another crash. So I need to know is:

Is there any option to put flag in my Market calling Intent to notify that the app is already launched and just bring it front on clicking Open button?

Here how am I calling GooglePlay app.

Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(marketUrl));
            try {
                startActivity(intent);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(this, "Cannot find Android Market",
                        Toast.LENGTH_LONG).show();
            } 

EDIT

My market url: market://details?id=com.foo.bar

This will directly redirect to my apps Installation page.


回答1:


use this code..

Uri uri = Uri.parse(https://play.google.com/store);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);


来源:https://stackoverflow.com/questions/10185326/opening-my-application-from-google-play-app-crashes-on-exit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!