2017-07-06 372 views

回答

0

將此放在您的清單

<meta-data 
    android:name="com.google.android.gms.version" 
    android:value="@integer/google_play_services_version" /> 

這個代碼在你的活動

// Check status of Google Play Services 
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); 

// Check Google Play Service Available 
try { 
    if (status != ConnectionResult.SUCCESS) { 
     GooglePlayServicesUtil.getErrorDialog(status, this, RQS_GooglePlayServices).show(); 
    } 
} catch (Exception e) { 
    Log.e("Error: GooglePlayServiceUtil: ", "" + e); 
} 
0

試試這個代碼

final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object 
try { 
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); 
    } 
     catch (android.content.ActivityNotFoundException anfe) { 
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName))); 
    }