Search code examples
androidmobiletitaniumgoogle-cloud-messaging

Getting GCM SenderId failed (android)


Everything is okey My GCM API key and GCM Sender ID but i get failed

E/com.appcelerator.aps.CCPushService: Getting GCM SenderId failed. Max retry time reaches. [WARN] : W/com.appcelerator.aps.CCPushService: Device Token is null.

Why?

Please Help me! Are there any other way you suggest? Do you have another way?


Solution

  • give it a try....and let me know In your GCM class check weather this is present or not if not place it there

    private void handleRegistration(Context context, String regId) 
    {
        // TODO Auto-generated method stub
        Utils.registrationId = regId;
        SavePreferences("PUSHNOT",regId);
         Log.e("", "registration id : "+regId);
    
    
         //sendDeviceIdFuction(context,UtilsGcm.registrationId);
    
    
    }
    private void SavePreferences(String key, String value) 
    {
        // TODO Auto-generated method stub
        SharedPreferences sharedPreferences = getSharedPreferences("myPrefs", MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putString(key, value);
        editor.commit();  
    }
    

    Here you save the regid after registration in an app preference try to retrieve that preference value instead of taking the String regId.

    OR

    Check this out https://developers.google.com/cloud-messaging/android/client

    OR

    show your code here for more specific answer.