mercredi 16 juillet 2014

Google Play Services not running on Froyo 2.2 and below

Google Mobile Ads is now offered through Google Play Services 4.0 and this error occurs because the Google Play Services is not available. Most likely you will run into this on Froyo, where there is a special version that can be used.
Note: Google Play services 4.0.30 (released November 2013) and newer versions require Android 2.3 or higher. If your app supports Android 2.2, you can continue development with the Google Play services SDK, but must instead install Google Play services for Froyo from the SDK Manager.
http:// android-developers.blogspot.no/2013/10/google-play-services-40.html
With over 97% of devices now running Android 2.3 (Gingerbread) or newer platform versions, we’re dropping support for Froyo from this release of the Google Play services SDK in order to make it possible to offer more powerful APIs in the future. That means you will not be able to utilize these new APIs on devices running Android 2.2 (Froyo).
Important: Because it is hard to anticipate the state of each device, you must always check for a compatible Google Play services APK before you access Google Play services features. For many apps, the best time to check is during the onResume() method of the main activity.
Alernative 1 is to check if Google Play Services is available before using AdView.
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext();
if(status == ConnectionResult.SUCCESS) {
    //Success! Do what you want
}
Alernative 2 is to use GoogleAdMobAdsSdk-6.4.1.jar
There are at least two solutions to solve the problem:
  • Change the minSdkVersion in your app's manifest to 9.
  • Don't use the latest Google Play Services library, but use the Froyo version in stead.
or

There is a third solution: guard the code that requires new functionality in Google Play Services (such as Admob ads) with a if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.FROYO)

Aucun commentaire:

Enregistrer un commentaire