groovy allprojects { repositories { google() } } groovy dependencies { implementation 'com.google.android.gms:play-services-basement:17.6.0' } proguard -keep class com.google.android.gms.common.** { *; } -keep class com.google.android.gms.basement.** { *; } import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.GoogleApiAvailability; public class MyLibraryClass { public void openPlayStorePage(Context context) { int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context); if (resultCode == ConnectionResult.SUCCESS) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=com.example.myapp")); context.startActivity(intent); } else { Toast.makeText(context, "Google Play Services is not available.", Toast.LENGTH_SHORT).show(); } } }


上一篇:
下一篇:
切换中文