*Cross-posted from http://stackoverflow.com/q/15319010/9636*

I have an app (com.example.myapp) installed that received C2DM Intents. I 
would like to piggyback onto this to perform my own processing in response 
to these Intents in a separate app (com.example.myapp2). According to the this 
answer <http://stackoverflow.com/a/5121330/9636>, the C2DM client system 
looks for:

broadcast receivers for Intent: com.google.android.c2dm.intent.REGISTRATION

That have the permission: .permission.C2D_MESSAGE

In the original app, the following permission is defined and used, as 
specified in the C2DM 
Documentation<https://developers.google.com/android/c2dm/#manifest>

  <!-- Only this application can receive the messages and registration result 
--> 
   <permission android:name="com.example.myapp.permission.C2D_MESSAGE" 
android:protectionLevel="signature" />
   <uses-permission android:name="com.example.myapp.permission.C2D_MESSAGE" />

This is com.example.myapp2's manifest, in which I use that permission also:

<manifest package="com.example.myapp2" ...>

   <!-- Only this application can receive the messages and registration result 
--> 
   <uses-permission android:name="com.example.myapp.permission.C2D_MESSAGE" />

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

   <!-- Send the registration id to the server -->
   <uses-permission android:name="android.permission.INTERNET" />

   <application...>
      <!-- Only C2DM servers can send messages for the app. If permission is 
not set - any other app can generate it --> 
      <receiver android:name=".C2DMReceiver" 
android:permission="com.google.android.c2dm.permission.SEND">
          <!-- Receive the actual message -->
          <intent-filter>
              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
              <category android:name="com.example.myapp" />
              <category android:name="com.example.myapp2" />
          </intent-filter>
      </receiver>
      ...
   </application>
   ...</manifest>

My C2DMReceiver is com.example.myapp2.C2DMReceiver. Notice that I'm not 
listening forcom.google.android.c2dm.intent.REGISTRATION Intents since I 
don't care about registering. I only care about receiving the Intents that 
com.example.myapp is already receiving. In myIntentFilter for 
com.google.android.c2dm.intent.RECEIVE Intents, I filter for both
com.example.myapp and com.example.myapp2 categorys since C2DM isn't 
specific about exactly what a C2DM Intent looks like. Any help there would 
be appreciated.

I've verified that com.example.myapp2 has the 
com.example.myapp.permission.C2D_MESSAGEpermission. If I run with a debug 
key, I don't have it, but if I run with the release key, I have it. 
Obviously, I'm running the version on my device with the release key.

When com.example.myapp receives a C2DM Intent com.example.myapp2 doesn't 
receive it. Any ideas for how to debug or how to get this to work? Is it 
even possible?


-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to