Standalone GCM on Android 4.4.2 - Device does not have package com.google.android.gsf

308 views
Skip to first unread message

Michael Yates

unread,
Jul 28, 2015, 5:23:49 PM7/28/15
to android-gcm
I am trying to see if it is possible to use the old version of GCM, pre-2012, that does not use google play services.  The devices I am working on are not allowed to install google play services, but we want to use the deprecated GCM using gcm.jar.  When I run the app on the device, I get this error:

07-28 16:02:36.216  20714-20714/com.jcp.pushnotifications E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.jcp.pushnotifications, PID: 20714
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jcp.pushnotifications/com.jcp.pushnotifications.MainActivity}: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
            at android.app.ActivityThread.access$800(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5050)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
            at com.google.android.gcm.GCMRegistrar.checkDevice(GCMRegistrar.java:98)
            at com.jcp.pushnotifications.MainActivity.onCreate(MainActivity.java:61)
            at android.app.Activity.performCreate(Activity.java:5256)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248)
            at android.app.ActivityThread.access$800(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5050)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:780)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
            at dalvik.system.NativeStart.main(Native Method)

My question is, is it possible to load the com.google.android.gsf package onto the device?  I have tried adding a google-common.jar file that contains this package, but after adding that lib to project, it still gets the package not loaded on device error above.

Is the gcm.jar no longer usable on version 4.4.2 of Android?

Kenneth Corbin

unread,
Jul 31, 2015, 2:13:07 AM7/31/15
to android-gcm, j.micha...@gmail.com
We have an app that still uses the original GCM implementation, before there was a gcm.jar file, to support our Android 2.1 users.  It uses the latest Google Play Servers version  to support users on 2.2 and up.  It can be done.  But it takes a lot of work, and  relies on deprecated API's that might go away in some future version of Android.

Why, exactly, are your devices not permitted to install Goggle Play Services.  My understanding is that Google Play Services is Google's answer to the Android user base fragmentation problem.  Most Android devices are distributed by carriers who are not generally very quick to release the latest patches and updates Google makes to the base Android  system.  As a result, improvement and major security patches can take years to finally make it out to the majority of Android users.  Google's answer was to start moving critical bit of infrastructure from the Android core system to the Google Play Services.  As an app, it can be updated by simply publishing a new version any time Google want to.  There is no need to wait for the different carriers to come out with their own fixed version of Android.

All of which means that Google Play Services is more like a critical component of the Android kernel than like a game playing time waster.  Forbidding users from installing it opens up all kinds of serious security vulnerabilities.

Have fun,
-Ken
Reply all
Reply to author
Forward
0 new messages