How to automatically install Google Play services using my Android app

I have an Android app that needs Google Play services. Is it possible to place the code inside the application to download and install Google Play services automatically, if they are not available. I don’t want users to download and install Google Play services separately, and then install my application, instead they would like to install both at a time. Please let me know.

Thank you Rajiv

+4
source share
2 answers

I think the right way to do this is to check if services from your application are enabled using isGooglePlayServicesAvailable(android.content.Context).

if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(ctx) == ConnectionResult.SUCCESS) {
    // do your stuff (play service is available)
}

, Google Play

:

onResultActivity

,

+2

, "", Play, .

ur , google play:

:

1, , Asynctask Service.

2, .

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "app.apk")), "application/vnd.android.package-archive");

startActivity(intent);

mime. . . ,

"Jul" :

.apk Android?

-1

Source: https://habr.com/ru/post/1540536/


All Articles