How do you prompt the user to update google play services?

前端 未结 5 1680
谎友^
谎友^ 2020-12-19 02:20

I can easily detect that my device\'s google play services app needs to be updated, and present the getErrorDialogFragment() to prompt the user to update it with:

         


        
5条回答
  •  醉话见心
    2020-12-19 02:42

    Google Play Services are available on Play Store to download and update. You can simply open Play Store.

    Here is link to the services.

    What you can do is start activity with ACTION_VIEW intent like below

    String LINK_TO_GOOGLE_PLAY_SERVICES = "play.google.com/store/apps/details?id=com.google.android.gms&hl=en";
    try {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://" + LINK_TO_GOOGLE_PLAY_SERVICES)));
    } catch (android.content.ActivityNotFoundException anfe) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://" + LINK_TO_GOOGLE_PLAY_SERVICES)));
    }
    

提交回复
热议问题