Somnath Pal Somnath Pal - 10 months ago 158
Android Question

firebase integration error: Google Play Services out of date

I'm trying to integrate Firebase in my android app. I'm using this tutorial. I updated my sdk manager, added

and did everything as mentioned in the website. Still I'm getting this
Google Play services out of date
error. I want to get the device token ID so that I can send it to server in Login Activity. Is there something else I need to do to get the device token ID?


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""

<uses-permission android:name="android.permission.INTERNET"/>

<activity android:name=".SplashActivity">
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" android:theme="@style/AppTheme" android:label="@string/signin"/>
<activity android:name=".RegisterActivity" android:theme="@style/AppTheme" android:label="@string/cac"/>
<service android:name=".services.RegistrationIntentService" android:exported="false"/>
android:exported="false" >
<action android:name="" />
<action android:name=""/>


app's build.gradle

apply plugin: ''

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "MY_PACKAGE"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), ''

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile ''
compile ''
compile ''
compile ''
compile ''

apply plugin: ''


public class RegistrationIntentService extends IntentService {

// abbreviated tag name
private static final String TAG = "RegIntentService";
public static final String SENT_TOKEN_TO_SERVER = "sentTokenToServer";
public static final String FCM_TOKEN = "FCMToken";

public RegistrationIntentService() {

protected void onHandleIntent(Intent intent) {
// Make a call to Instance API
FirebaseInstanceId instanceID = FirebaseInstanceId.getInstance();
String senderId = getResources().getString(R.string.gcm_defaultSenderId);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

try {
// request token that will be used by the server to send push notifications
String token = instanceID.getToken();
Log.d(TAG, "FCM Registration Token: " + token);
System.out.println("Token:" + token);

sharedPreferences.edit().putString(FCM_TOKEN, token).apply();
// pass along this data
} catch (Exception e) {
Log.d(TAG, "Failed to complete token refresh", e);
// If an exception happens while fetching the new token or updating our registration data
// on a third-party server, this ensures that we'll attempt the update at a later time.
sharedPreferences.edit().putBoolean(SENT_TOKEN_TO_SERVER, false).apply();

private void sendRegistrationToServer(String token) {
// send network request

// if registration sent was successful, store a boolean that indicates whether the generated token has been sent to server
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
sharedPreferences.edit().putBoolean(SENT_TOKEN_TO_SERVER, true).apply();


07-15 15:02:59.004 24479-24707/com.sam.bidnextjob I/FA: Tag Manager is not found and thus will not be used
07-15 15:02:59.028 24479-24707/com.sam.bidnextjob W/GooglePlayServicesUtil: Google Play services out of date. Requires 9256000 but found 9083234
07-15 15:02:59.029 24479-24479/com.sam.bidnextjob W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
07-15 15:03:59.033 24479-26561/com.sam.bidnextjob W/FA: Tasks have been queued for a long time

Answer Source

I think this is a device side issue. Looking at your logcat:

Google Play services out of date. Requires 9256000 but found 9083234

Seems that your device is not running the required version of Google Play services. Try updating Google Play services on the the device and that should fix this issue.