2

I'm studying GCM (Google Cloud Messaging, old deprecated name is C2DM). I use different devices . operations run well , even if app is closed . but on nexus tablet, an error occurs when app is closed. if app is in progress , my GCM codes works on all devices that I try . Now : I looked for these problem and I found there was an error manifests of others . If my manifest is wrong , why do ohter devices except nexus tablet, execute my codes properly ? Could I think that my manifest is wrong?

this is my manifests :

         <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="android.borda.C2DM"
       android:versionCode="1"
      android:versionName="1.0" >

   <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />
   <permission android:name="android.borda.C2DM.permission.C2D_MESSAGE" android:protectionLevel="signature" />

     <uses-permission android:name="android.borda.C2DM.permission.C2D_MESSAGE" /> 

      <!-- App receives GCM messages. -->
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <!-- GCM connects to Google Services. -->
  <uses-permission android:name="android.permission.INTERNET" /> 
  <!-- 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" />


    <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

  <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
       <intent-filter>
       <action android:name="com.google.android.c2dm.intent.RECEIVE" />
       <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
      <category android:name="android.borda.C2DM" />
     </intent-filter>
    </receiver>
     <service android:name=".GCMIntentService" />
     </application>

     </manifest>
HitOdessit
  • 7,198
  • 4
  • 36
  • 59
magirtopcu
  • 1,194
  • 10
  • 25
  • please attach source code where you registering in GCM service – HitOdessit Sep 11 '12 at 14:36
  • @hit - this line registering the service: ``. If service's name is `GCMIntentService` - broadcast receiver will call it automatically when gsm message will come. – ashakirov Sep 11 '12 at 17:23
  • I was asking to provide your SOURCE code, rather than manifest file you have already provided. GCMIntentService will NOT be called automatically, unless you call GCMRegistrar.register(context, GCM_SENDER_ID); – HitOdessit Sep 12 '12 at 07:17

1 Answers1

2

an error occurs when app is closed

What kind of error?

If you just can't receive gcm messages in your app (android 3.1+) when app is closed - take look on that question.

Community
  • 1
  • 1
ashakirov
  • 12,112
  • 6
  • 40
  • 40
  • error is below . W/GTalkService( 703): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=android.borda.C2DM (has extras) } W/GTalkService( 703): Receiver package not found, unregister application android.borda.C2DM sender 124545499293 – magirtopcu Sep 11 '12 at 13:01
  • [link](http://stackoverflow.com/questions/8814817/c2dm-broadcast-receiver) - almost the same question. And as I said it's look like app is in "stopped state" (android 3.1+) and that is why gsm intent cann't start it. – ashakirov Sep 11 '12 at 17:20