Saturday, July 14, 2012

[android-developers] Waking my app with Google Cloud Messaging

Hi All,
I have my app receiving messages from GCM nicely.  Now I want my app to be started when a message intended for it is received.

This is what the pertinent parts of the manifest look like.

I was wondering if someone could point me in the right direction?


<permission 
        android:name="com.smartphonedev.blah.permission.C2D_MESSAGE" 
        android:protectionLevel="signature" />
<uses-permission android:name="com.smartphonedev.blah.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
    <uses-permission android:name="android.permission.WAKE_LOCK" />


<receiver 
            android:name="com.smartphonedev.blah.GCMBroadcastReceiver" 
            android:permission="com.google.android.c2dm.permission.SEND" >
  <intent-filter android:priority="100">
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    <category android:name="com.smartphonedev.blah" />
  </intent-filter>
</receiver>
<service android:name="com.smartphonedev.blah.GCMIntentService"/>

No comments:

Post a Comment