Question

Hi everyone I am experiencing with google GCM but for some reason my GCM intenet service refuses to wake on registration event - I know I am doing something wrong I just cant figure out what...

Here is my manifest file -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dmx"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <!-- GCM connects to Internet Services. -->
    <uses-permission android:name="android.permission.INTERNET" />

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

    <!-- GCM requires a Google account. -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <!-- Creates a custom permission so only this app can receive its messages. -->
    <permission
        android:name="com.dmx.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.dmx.permission.C2D_MESSAGE" />

    <!-- This app has permission to register and receive data message. -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <!-- Network State Permissions to detect Internet status -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <!-- Permission to vibrate -->
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

        <!-- Splash Screen -->
        <activity android:name="com.dmx.ui.ActivitySplashScreen" >

        </activity>

        <!-- ActivitySplashScreen Screen -->
        <activity android:name="com.dmx.ui.ActivityLoginRegister" >
        </activity>

        <!-- Login Screen -->
        <activity android:name="com.dmx.ui.ActivityLogin" >
        </activity>


        <!-- Broadcasr Reciever Declaration For Incoming Messages -->
        <receiver
            android:name="com.google.android.gcm.GCMBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>

                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <!-- Receives the registration id. -->
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.dmx" />
            </intent-filter>
        </receiver>

        <!-- GCM Service Declaration -->
        <service android:name="com.dmx.logic.services.GCMIntentService" ></service>
    </application>

</manifest>

and the logcat output -

04-18 06:53:39.561: D/PowerManagerService(2959): [api] handleWakeLockDeath : release WakeLock : PARTIAL_WAKE_LOCK              'GCM_LIB' (uid=10218, pid=31431, ws=null) (elapsedTime=110364)
04-18 06:53:42.316: W/ActivityManager(2959): Unable to start service Intent { act=com.tmc.logic.services.GCMIntentService } U=0: not found
04-18 06:53:43.821: I/PCWCLIENTTRACE_PushUtil(28180): getPushTypeList : [SPP, GCM]
04-18 06:53:44.826: V/GCMBroadcastReceiver(31887): GCM IntentService class: com.tmc.GCMIntentService
04-18 06:53:44.831: W/ActivityManager(2959): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION flg=0x10 pkg=com.tmc cmp=com.tmc/.GCMIntentService (has extras) } U=0: not found

I already double checked the service is nested inside the application and also tried to start it via intent...its just dont work....any help???

Was it helpful?

Solution

You are using the com.google.android.gcm.GCMBroadcastReceiver broadcast receiver. That class expects the intent service class to be in the main package of your app - com.dmx in your case. But since you put your intent service in com.dmx.logic.services, it's not found.

You can see in the logcat that it expects GCMIntentService to be in com.tmc :

04-18 06:53:44.826: V/GCMBroadcastReceiver(31887): GCM IntentService class: com.tmc.GCMIntentService 04-18 06:53:44.831: W/ActivityManager(2959): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTRATION flg=0x10 pkg=com.tmc cmp=com.tmc/.GCMIntentService (has extras) } U=0: not found

You should either move your intent service class to the main package, or change the broadcast receiver to look for it in its current location.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top