I have some problems with my Android application when my test smartphone cleans cache: my app does not receive any messages any more (more details here).
At the beginning I thought that my gcm listener service is also cleared with memory but in fact the problem can be deeper: the GcmReceiver (which should receive a message and give it further to MyListenerService) could be cleaned from RAM (see one of the comments here)
How can I check if my GcmReceiver still works. What can I do to support it?
Can I set it to run in foreground or to be always activated?
Traditionally: my manifest about GCM (MyGcmLister.class extends GcmListenerService.class)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.app.path" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- ... other permissions -->
<permission
android:name="my.app.path.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my.app.path.permission.C2D_MESSAGE" />
<application
...>
<!-- ... activites... -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="my.app.path" />
</intent-filter>
</receiver>
<service
android:name=".MyGcmListener"
android:exported="false"
android:enabled="true" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>
</manifest>
Related
I build one Android Call app and using Pushy API to receive Notification for the Call...
It works good, but sometimes the delay is over 5 minutes if the App running in Background!
If the app is not running in Background, the delay for Call-Notification is always high...
What I'm doing wrong?
Also, do you know another API like Pushy which would do a better JOB?
What piece of Code do you need from me to research for this purpose
Here is my Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.my.androidapp">
<!-- Pushy Permissions -->
<meta-data android:name="com.my.androidapp.ui.login.PushReceiver.default_notification_icon"
android:resource="#mipmap/ic_notify" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_SERVICE"/>
<!-- End Pushy Permissions -->
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_logo"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_logo"
android:supportsRtl="true"
android:theme="#style/Theme.ExpressSample">
<activity
android:name=".ui.login.AudioActivity"
android:exported="false" />
<activity
android:name=".ui.login.LoginActivity"
android:exported="true"
android:label="#string/title_activity_login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.login.VideoActivity"
android:exported="false"
android:screenOrientation="portrait"></activity>
<activity
android:name="com.my.androidapp.ui.login.Main"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Pushy Declarations -->
<!-- Pushy Notification Receiver -->
<!-- Incoming push notifications will invoke the following BroadcastReceiver -->
<receiver android:enabled="true" android:name="com.my.androidapp.ui.login.PushReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED" android:exported="true">
<intent-filter>
<!-- Do not modify this -->
<action android:name="pushy.me" />
</intent-filter>
</receiver>
<!-- Pushy Update Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<!-- Pushy Boot Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<!-- Pushy Socket Service -->
<!-- Do not modify - internal service -->
<service android:name="me.pushy.sdk.services.PushySocketService" android:stopWithTask="false" />
<!-- Pushy Job Service (added in Pushy SDK 1.0.35) -->
<!-- Do not modify - internal service -->
<service android:name="me.pushy.sdk.services.PushyJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:stopWithTask="false" />
<!-- Pushy Firebase Service -->
<service
android:name="me.pushy.sdk.services.PushyFirebaseService"
android:exported="false"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
I have registered the necessary permissions, services, and broadcast receivers in my AndroidManifest.xml and I have Parse push notifications working on pre Android M devices. I am getting an error (posted below) in the Android 6.0 Marshmallow Developer Preview 3 running on my Nexus 5. The user is successfully registering and I can view it in the Parse dashboard on Parse.com, but the pushType and deviceLastTokenModified are undefined. I can't help but think this is an issue with the Parse SDK considering this is working fine on Pre Android M devices. It could be an issue with Android M's permission changes, except none of the permissions I am requesting fall under the category that ask the user to grant it.
Here is the error::
08-30 19:29:19.671 11848-11848/com.example.app V/com.parse.ManifestInfo﹕ Cannot use GCM for push because the app manifest is missing some required declarations. Please make sure that these permissions are declared as children of the root <manifest> element:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.richardlucasapps.eaglescribe.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.richardlucasapps.eaglescribe.permission.C2D_MESSAGE" />
Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.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="com.richardlucasapps.eaglescribe" />
</intent-filter>
</receiver>
08-30 19:29:19.671 11848-11848/com.example.app V/com.parse.ManifestInfo﹕ Using none for push.
Here is how I am initializing Parse and setting it up for push notifications:
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE);
Parse.initialize(this, applicationId, clientId);
ParseUser.enableAutomaticUser();
ParseUser.getCurrentUser().increment("RunCount");
ParseUser.getCurrentUser().saveInBackground();
ParseInstallation parseInstallation = ParseInstallation.getCurrentInstallation();
parseInstallation.put("user", ParseUser.getCurrentUser());
parseInstallation.saveInBackground()
}
}
Here is a condensed version of my AndroidManifest.xml file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app” >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission
android:name="com.example.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.app.permission.C2D_MESSAGE" />
<application
android:name=".global.MyApplication">
<!-- For Parse Notification Push Service -->
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.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="com.example.app” />
</intent-filter>
</receiver>
</application>
Update the Parse library you are using in your project. I was using 1.9.4 and updated to Parse 1.10.1 and now my Android Marshmallow device is successfully registering for and receiving push notifications.
Grab the most up to date Parse library here.
I am doing a push notification using GCM that is written in an SDK,developer needs to add my SDK as library project ,my SDK uses the context from the developer and creates Registeration Id ,but when i push from an server using the ID i could not receive any notification in fact my receiver class is not invoked
Manifest file in SDK has
<receiver
android:name=".GcmBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.mysdk" />
</intent-filter>
</receiver>
<service android:name=".GcmIntentService" />
permission has
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.mysdk.permission.C2D_MESSAGE"
/>
<uses-permission android:name="com.mysdk.permission.C2D_MESSAGE" />
Manifest in app that has my SDK as library file
<receiver
android:name="com.mysdk.GcmBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.mysdk" />
</intent-filter>
</receiver>
<service android:name="com.mysdk.GcmIntentService" />
permission has
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.mysdk.permission.C2D_MESSAGE"
/>
<uses-permission android:name="com.mysdk.permission.C2D_MESSAGE" />
can any one suggest what went wrong ,May be is this possible ,i.e. sending notification from
SDK
The app that uses your SDK shouldn't use com.mysdk for the GCM permissions and for the category of the broadcast receiver intent-filter. Instead it should use its own package name.
Below I marked the changes you should make in your app's manifest:
<receiver
android:name="com.mysdk.GcmBroadcastReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="CHANGE_TO_YOUR_APPS_PACKAGE_NAME" />
</intent-filter>
</receiver>
<service android:name="com.mysdk.GcmIntentService" />
<permission android:name="CHANGE_TO_YOUR_APPS_PACKAGE_NAME.permission.C2D_MESSAGE"/>
<uses-permission android:name="CHANGE_TO_YOUR_APPS_PACKAGE_NAME.permission.C2D_MESSAGE" />
I have started working on GCM Notification
after a lot of goggling i checked out code through which i can get registration id from GCM Server so i used
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
final String regId= GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "338056690461");
}
else{
Log.v(TAG, "Already registered");
}
But When i run My Application i get error on `CheckMAnifest()`
this means i have error in my manifest but accordint to me my manifest is correct please have alook to my Exception as well as manifest
Exception it gives
java.lang.IllegalStateException: Application does not define permission PushNotification.Pop.permission.C2D_MESSAGE
and manifest i have used is
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PushNotification.Pop"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission
android:name="PushNotification.Pop.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="PushNotification.Pop.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:debuggable="true" android:label="#string/app_name" >
<activity
android:name=".MainActivity">
<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="PushNotification.Pop" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
Please suggest me where i am going wrong your help would be greatfull
Thanks in advance :)
try to copy and paste this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PushNotification.Pop"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="17"/>
<!-- GCM connects to Internet Services. -->
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="PushNotification.Pop.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="indieswebs.magento.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<application android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity android:name="PushNotification.Pop.MainActivity"
android:label="#string/app_name_title"
android:clearTaskOnLaunch="true"
android:configChanges="keyboardHidden|orientation">
<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>
<!-- 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="PushNotification.Pop" />
</intent-filter>
</receiver>
<service android:name="PushNotification.Pop.GCMIntentService" />
</application>
</manifest>
or
I got answer for this issue. Just delete "gen"folder . It build automatically. Application will work fine.
I have a problem I`m just not getting any GCM Messages. I dont want Pop Ups or sounds playing, it doesnt even fire the onReceive() Method in the Broadcast Reciever, which is, to my understanding, the first point the Application handles a message.
My biggest problem is I dont get any error messages or Hints. When I send a message, I get the message ID, a multicast ID and a "success=1" message. I also get a "Device registrated on any device and a Reg ID, a "already registered" running the app a second time. The Devices are also logged into Google Play, same account as on the Google API Console. But nothing happens on the Device when I send a GCM Message.
I post my complete android manifest, please let me know if you need more code. This is driving my crazy.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lottoapplicationandroid"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto"
>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<permission android:name="com.lottoapplicationandroid.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.lottoapplicationandroid.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"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ZXing activities -->
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="#string/share_name">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
<category android:name="android.intent.category.DEFAULT"/>
</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="com.lottoapplicationandroid" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
EDIT
I dont need a solution for this if not possible. I´d be very thankful for hints how to find out what`s going wrong. E.g. I found out I have to have an open Port 5228. Does anybody know how to check if the devices is listening on that port?
The Issue is solved.
I had to turn Wi-Fi off.
WiFi / Telephone-Network
off / off : not working
on / off : not working
on / on : not working
off / on : working
Aren't you missing some intent filters for the receiver ?
<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" />
<category android:name="com.lottoapplicationandroid" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.lottoapplicationandroid" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="packagename.permission.C2D_MESSAGE" />
<receiver
android:name=".MyBroadcastReceiver"
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="packagename" />
</intent-filter>
</receiver>
<service android:name="Packagename.MyIntentService" >
</service>
Try it hope so it works.