I am implementing gcm notifications in my application. Because I use my code to generate lot of application with different package names I cannot use standard mypackage.GCMIntentService name. When generating applications I do changes only in Manifest and change imports of my R class. So I impelented my own BroadcastReceiver
public class GCMReceiver extends GCMBroadcastReceiver {
#Override
protected String getGCMIntentServiceClassName(Context context) {
return GCMIntentService.class.getName();
}
}
to return name of GCMIntentService regardless of package name.
Here is my manifest:
<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="org.rferl.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="org.rferl.permission.C2D_MESSAGE" />
<service
android:name="org.rferl.service.GCMIntentService"
android:enabled="true" />
<receiver
android:name="org.rferl.GCMReceiver"
android:enabled="true"
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="org.rferl" />
</intent-filter>
</receiver>
Everything works fine, I can register, unregister, receive messages. But when application is not runnig no GCMIntentService.onMessage is not called. Am I missing something in my manifest? Why system did not start service?
To change package/class name for application/GCMIntentService/GCMBroadcastReceiver for Android GCM (using Eclipse ADT)
Note: You are advised to verify that you can receive messages through GCM before making the following changes. To implement GCM in Android app using the application's default package name, see GCM: Getting Started.
Package name
To change package name of your app (e.g., new package name = com.example.newpackage),
In Package Explorer, right click the project → Android Tools → Rename Application Package.
This updates the package name automatically and conveniently.
In AndroidManifest.xml, update the package name in permission and uses-permission for C2D_MESSAGE:
<permission android:name="com.example.newpackage.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.newpackage.permission.C2D_MESSAGE" />
In AndroidManifest.xml, update the package name in category of the receiver:
<receiver
android:name="com.example.oldpackage.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" > <!-- Not this one!! -->
<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.newpackage" /> <!-- This one!! -->
</intent-filter>
</receiver>
Name of GCMIntentService
If your app's package name is com.example.newpackage, your GCMIntentService must be called com.example.newpackage.GCMIntentService. If not,
Create a new class that extends GCMBroadcastReceiver and override getGCMIntentServiceClassName():
public class MyBroadcastReceiver extends GCMBroadcastReceiver
{
#Override
protected String getGCMIntentServiceClassName(Context context)
{
return MyIntentService.class.getName(); // Don't hard-code like "com.example.oldpackage.MyIntentService", see http://stackoverflow.com/a/936696/1402846
}
}
this is based on Google's documentation on GCMBroadcastReceiver:
By default, the GCMBaseIntentService class belongs to the application main package and is named DEFAULT_INTENT_SERVICE_CLASS_NAME. To use a new class, the getGCMIntentServiceClassName(Context) must be overridden.
In AndroidManifest.xml, update the name of the receiver:
<receiver
android:name="com.example.oldpackage.MyBroadcastReceiver"
... >
</receiver>
In AndroidManifest.xml, update the name of the service:
<service android:name="com.example.oldpackage.MyIntentService" />
Name of GCMBroadcastReceiver
If your changed the package/class name of GCMBroadcastReceiver:
In AndroidManifest.xml, update the name of the receiver:
<receiver
android:name="com.example.oldpackage.NewBroadcastReceiver"
... >
</receiver>
Troubleshooting
Verify that in AndroidManifest.xml, the package name should appear at least 4 times:
In manifest:
<manifest ...
package="com.example.newpackage" ...
In permission:
<permission android:name="com.example.newpackage.permission.C2D_MESSAGE" android:protectionLevel="signature" />
In uses-permission:
<uses-permission android:name="com.example.newpackage.permission.C2D_MESSAGE" />
In category within intent-filter within receiver for the GCM broadcast receiver:
<category android:name="com.example.newpackage" />
If you changed your package name, uninstall the old app on your device/emulator before testing.
If you changed your package name, notice that the registration ID (that you receive in onRegistered()) has changed.
If you received your registration ID in onRegistered(), you should see something like this in LogCat (tag GCMBroadcastReceiver):
GCMBroadcastReceiver onReceive: com.google.android.c2dm.intent.REGISTRATION
GCMBroadcastReceiver GCM IntentService class: com.example.oldpackage.MyIntentService
Verify that the package/class name of the intent service is correct.
If you override getGCMIntentServiceClassName(Context) in your own GCMBroadcastReceiver, you should see something like this in LogCat (tag GCMRegistrar):
GCMRegistrar Setting the name of retry receiver class to com.example.oldpackage.MyBroadcastReceiver
Verify that the package/class name of the broadcast receiver is correct.
When your server sends a message to GCM server, check the HTTP status code and HTTP response for errors.
And if you are desperate:
Check LogCat for errors.
Try restarting your device/emulator.
Try uninstalling your app on the device/emulator.
Try restarting Eclipse.
Try clean and re-build the project.
Try updating ADT (Pull down menu → Window → Android SDK Manager → Install packages).
Try updating Eclipse (Pull down menu → Help → Check for Updates).
Try restarting your computer.
Get a good sleep, or pray.
You should put GCMIntentService class into your root application package.
Here org.rferl
<service
android:name=".GCMIntentService"
android:enabled="true" />
and receiver
<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.EgoSecure.ma" />
</intent-filter>
</receiver>
Because I use my code to generate lot of application with different package names I cannot use standard mypackage.GCMIntentService name.
I'm not sure whether you ask for a runtime or a build time solution. The other answers are runtime solutions so I thought I add some information on possibilites during build time.
In AndroidManifest, you can use the variable $PACKAGE_NAME (available by default) which will refer to the package name you specified in the attribute package in the manifest root element.
The value of this package attribute needs not be a hard coded string but can also be set dynamically via resource reference like so:
<manifest package="#string/app_package" ...>
...
<service
android:name="$PACKAGE_NAME.service.GCMIntentService"
android:enabled="true" />
...
</manifest>
Note .service is just a subpackage that I included to show how you specify these. Of course, this solution would work only if your applications follow general rules like putting Service classes in a .service subpackage.
Also note, that you can actually leave the root package off completely. It will be expanded by Android:
<manifest package="#string/app_package" ...>
...
<service
android:name=".service.GCMIntentService"
android:enabled="true" />
...
</manifest>
In effect, same as above.
If you are looking for a more flexible way to replace values in an AndroidManifest (or different files), you might want to have a look at the Ant Replace task (http://ant.apache.org/manual/Tasks/replace.html) or Resource Filtering (http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html) with Maven.
The gcm broadcast receiver (GCMBroadcastReceiver.class) calls intent service class (GCMIntentService.class) from application root directory. You cannot use "org.rferl.service.GCMIntentService" right now. You should override getGCMIntentServiceClassName method from GCMBroadcastReceiver, that returns name of your GCMIntentService class. How to do that, here
Related
Following the Google developer instructions on implementing Firebase in my app, I notice that android lint complains.
The idea is that we have to implement two services which inherit from Firebase services:
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { ... }
public class MyFirebaseMessagingService extends FirebaseMessagingService { ... }
and then register those services in the manifest. But, it's not quite perfect. In particular, these two recommended AndroidManifest.xml service entries do not contain any special permissions:
<service android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
and so the linter says:
Exported services (services which either set exported=true or contain an intent-filter and do not specify exported=false) should define a permission that an entity must have in order to launch the service or bind to it. Without this, any application can use this service.
Should I just add this attribute to each service tag and be done with it
tools:ignore="ExportedService"
or is there a better approach in this situation? I mean, is it safe to expose these particular Firebase derived services like this?
You ask: ...is it safe to expose these particular Firebase derived services like this? It is if you trust the comments in the manifest files for these services.
In Android Studio, open your app's AndroidManifest.xml file. At the bottom of the window, select the tab for Merged Manifest. Scroll to find the entry for FirebaseMessagingService. Double-click on the line that contains the service name. The manifest file for the service should open and you will see this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.firebase.messaging">
<uses-sdk android:minSdkVersion="14"/>
<application>
<!-- FirebaseMessagingService performs security checks at runtime,
no need for explicit permissions despite exported="true" -->
<service android:name="com.google.firebase.messaging.FirebaseMessagingService" android:exported="true">
<intent-filter android:priority="-500">
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>
Note the comment: FirebaseMessagingService performs security checks at runtime, no need for explicit permissions despite exported="true"
You can do the same for FirebaseInstanceIdService and see the same comment.
If you trust the comments (I do), you can safely ignore the lint warnings or disable the checks.
<service android:name=".java.MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Based on the official code sample, it's safe to set exported=false
I am using Android Studio. I implemented an push service in my app. It is working with all kind of devices with newer Android versions, however it won't work with an Galaxy S2 Mini with Android 2.3.6.
The device receives pushs from other apps with Urban Airship libraries.
Relevant parts of the Manifest:
<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.my_app.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.my_app.app.permission.C2D_MESSAGE" />
<receiver
android:name=".IntentReceiver"
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" />
<action android:name="com.google.android.c2dm.intent.C2D_MESSAGE" />
<category android:name="com.my_app.app" />
</intent-filter>
</receiver>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<service android:name=".GCMIntentService"
android:enabled="true"/>
IntentReceiver.java:
import android.support.v4.content.WakefulBroadcastReceiver;
public class IntentReceiver extends WakefulBroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
//doing some stuff & starting my service here,
//never gets called with said device
}
}
The device gets registered with push. I have to call it twice before the id is returned, but the right Id is saved in my backend (I send the push manually anyways, so that shouldn't be the issue). I also register a second receiver from code when the app is in foreground, but none of them gets called.
If I add <uses-permission android:name="android.permission.C2D_MESSAGE" /> in my Manifest, I receive an com.google.android.c2dm.intent.REGISTRATION action when I send a push.
I had the same issue with an Galaxy Tab. Before updating it received a "com.google.android.c2dm.intent.REGISTRATION" with every push (with intent.getStringExtra("unregistered") set). So instead of getting RECEIVE it just was unregistered, just like the Galaxy Mini. I then updated it to 4.2.2. It now gets a RECEIVE every push like it should.
I rarely read about this very problem (not receiving pushs with < 4.1). But I didn't find a solution.
I wonder if anyone experienced something similar and found a solution or if somebody sees a problem with my manifest.
So, apparently not all package names in the manifest are replaced by build.gradle. In my case (with Android Studio 0.8) it was the custom permission that was wrong. I am using flavours, I guess I should have mentioned that. The package name in the custom permission has to be the package name including flavour, like this:
<permission
android:name="com.my_app.app.myflavour.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.my_app.app.myflavour.permission.C2D_MESSAGE" />
In my regular build gcm works fine, but when I use flavors to change the com name things stop working. My IntentService is never being initialized. How should I set up my manifest files so that this happens?
I have added them to the developer console.
I am using gradle com.android.tools.build:gradle:0.11.+'
I get the logs
V/GCMBroadcastReceiver﹕ onReceive: com.google.android.c2dm.intent.REGISTRATION
V/GCMBroadcastReceiver﹕ GCM IntentService class: com.sample.app.dev.GCMIntentService
V/GCMBaseIntentService﹕ Acquiring wakelock
and then nothing. My custom IntentService class never gets initialized and my registrationId stays empty. My current implementation is similar to the one here: https://stackoverflow.com/a/20334397/198034
How should I set up my manifest to get gradle 0.11.+ flavors to work with gcm?
Below is a manifest in one of my flavors, I have more code in the main manifest (all needed permissions, etc), but nothing else dealing with gcm.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sample.app"
android:versionCode="45"
android:versionName="0.6.5" >
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.sample.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.sample.app.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name" >
<service android:name=".GCMIntentService" />
<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="${packageName}" />
</intent-filter>
</receiver>
</application>
</manifest>
This was my solution:
<permission android:name="com.sample.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.sample.app.permission.C2D_MESSAGE" />
...
<service android:name=".GCMIntentService" />
<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="com.sample.app" />
</intent-filter>
</receiver>
in my manifest and mybroadcastReceiver
...
public class MyBroadcastReceiver extends GCMBroadcastReceiver
{
#Override
protected String getGCMIntentServiceClassName(Context context)
{
return GCMIntentService.class.getName();
}
}
From your manifest it looks like your app's package name is com.sample.app, which is consistent with your permission.C2D_MESSAGE definition. Your receiver's intent filter's category says ${packageName}. Hopefully that gets translated to com.sample.app too, as it should.
Other than that, your log posted above shows that your intent service is expected to be at com.sample.app.dev.GCMIntentService. That's a different package.
You seem to be using the old deprecated GCM client library, in which com.google.android.gcm.GCMBroadcastReceiver expects the intent service to be called GCMIntentService and be located in the main package of the app :
/**
* Gets the default class name of the intent service that will handle GCM
* messages.
*/
static final String getDefaultIntentServiceClassName(Context context) {
String className = context.getPackageName() +
DEFAULT_INTENT_SERVICE_CLASS_NAME;
return className;
}
Your manifest declares the intent service class to be in the main package of your app :
<service android:name=".GCMIntentService" />
All these things don't add up. Either your app's package name is com.sample.app.dev or com.sample.app. If it's the former, the manifest you posted is incorrect. If it's the latter, there is no reason for the broadcast receiver to expect the intent service class to be com.sample.app.dev.GCMIntentService.
I have some receivers declared in my AndroidManifest :
<!-- no warning -->
<receiver
android:name=".receivers.TriggerMonitoringBootReceiver"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<!-- no warning -->
<receiver
android:name=".receivers.ScanResultsReceiver"
android:enabled="false">
<intent-filter>
<action android:name="android.net.wifi.SCAN_RESULTS" />
</intent-filter>
</receiver>
<!-- warning : Exported receiver does not require permission-->
<receiver
android:name=".receivers.BatteryMonitoringReceiver"
android:enabled="false">
<intent-filter>
<action android:name="#string/intent_action_setup_alarm" />
<action android:name="#string/intent_action_cancel_alarm" />
<action android:name="#string/intent_action_monitor" />
</intent-filter>
</receiver>
The first one is meant to receive a BOOT_COMPLETED action. The second is meant to receive android.net.wifi.SCAN_RESULTS. The third one is meant to receive some actions I broadcast (intent_action_monitor) and some actions broadcasted by the AlarmManager (intent_action_setup_alarm etc).
Two questions:
Why don't I get the warning on all receivers?
What permissions do I need to set for receivers meant to receive from system services to correct the warning (I understand what it is about and I don't want anyone to use my receivers anyway) ? Will exported="false" do for boot receivers, wifi receivers, alarm receivers etc?
I thought of using a custom permission with android:protectionLevel="signatureOrSystem" but the docs advise against both this protection level and custom permissions. So how I should handle this warning ?
Links to the docs and/or some code will be much appreciated.
Why don't I get the warning on all receivers ?
Because the first two are clearly designed to be broadcast by Android. The last one is unknown, partly because you did not supply the string resource values, and possibly because they are your own unique action strings.
What permissions do I need to set for receivers meant to receive from system services to correct the warning
The correct solution is to delete the <intent-filter>. If you are broadcasting these Intents, or if you are wrapping an Intent in a getBroadcast() PendingIntent, you do not need action strings. Use the Intent constructor that takes the Java class object as the second parameter, and use that:
new Intent(this, BatteryMonitoringReceiver.class)
You are welcome to still attach an action string to that Intent, if you want, but you can dump the <intent-filter> (routing will be based on the supplied component, in this case the Java class).
Only use an <intent-filter> when you are expecting the OS or third-party apps to initiate the Intent themselves (executing a PendingIntent that you created does not count).
The warning "Exported receiver does not require permission" means, You have an intent-filter with some action (which means by default you have android:exported="true" set and it can now receive broadcasts from ANY broadcasters outside of your application) Since it can receive broadcasts from ANY broadcasters outside of your application, it warns you by saying "Hey, are you sure ANY broadcaster can invoke you? In my opinion, it is better if you allow only those broadcasters to invoke you that has the permission you have set for this receiver through android:permission"
You can remove this warning by adding android:exported="false" to the receiver tag
If you do want to export your receiver to other processes, you can add your own permission definition in your android-manifest file for avoiding this warning, like
<permission
android:name="com.yourpage.permission.YOUR_PERMISSION"
android:protectionLevel="normal" />
<uses-permission
android:name="com.yourpage.permission.YOUR_PERMISSION" />
<receiver <!-- warning : Exported receiver does not require permission-->
android:name=".receivers.BatteryMonitoringReceiver"
android:permission="com.yourpage.permission.YOUR_PERMISSION"
android:enabled="false" >
<intent-filter>
<action android:name="#string/intent_action_setup_alarm" />
<action android:name="#string/intent_action_cancel_alarm" />
<action android:name="#string/intent_action_monitor" />
</intent-filter>
</receiver>
for more information, you can refer to http://developer.android.com/training/articles/security-tips.html
If, like me, you are here because your app built with a previous SDK version stopped working with more recent versions and you would like to fix it with minimal change, just add
android:exported=false
to the receiver tag in the manifest file. The solution by CommonsWare is obviously the one to go with for the long term but this fixes the issue temporarily if you are using custom intents and don't mean to export them.
Going by Lubo's way, you would need to export this custom permission, which would prompt the user before installation. That means the descriptive text for the permission needs to be well written so you don't end up scaring the user into changing his mind about installing the app. Also, it would need to be translated into all your target languages.
To hide this warning, add tools:ignore="ExportedReceiver" to the receiver:
<receiver
android:name=".MyReceiverIndentedForOtherAppsWithoutPermissions"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="com.my.app.CUSTOM_ACTION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Although I try other answer about this problem, it can't be solved.
Sender ID is correct, permissions are added, API key is true.
I use this post for creating the project:
http://developer.android.com/guide/google/gcm/gs.html#server-app
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, SENDER_ID);
regId = GCMRegistrar.getRegistrationId(this);
} else {
Log.v(TAG, "Already registered");
}
String did = getDeviceID();
it returns empty string.
Do you have GCMIntentService defined correctly at the root package of your app?
<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="my_app_package" />
</intent-filter>
</receiver>
Make sure that "my_app_package" is identical to the main package of your app, or your id will return an empty string.
Also notice that
GCMRegistrar.register(this, "...");
is asynchronous. Therefore, calling GCMRegistrar.getRegistrationId(this) immediately after that is not reliable, so you should avoid it.
The id will arrive via broadcast callback to your GCMIntentService, as a part of the registration procedure. from there you can then store the gcm/fcm key anywhere you like, and use it in other parts of the application (usually on the server).
If your application launches first time, you have to wait for OnRegistered callback on your GCMIntentService.java file.
GCMRegistrar.register(this, SENDER_ID);
// Android does NOT wait for registration ends and executes immediately line below
// So your regId will be empty.
regId = GCMRegistrar.getRegistrationId(this);
GCMIntentService.java:
#Override
protected void onRegistered(Context c, String regId) {
// You can get it here!
}
Edit: Newer version of GCM library (which bundled with google play services library) waits for response and returns the Registration ID. So this answer is for older GCM libraries.
I have same problem after 1 day struggle I find solution. First i Put my GCM Related Code in To My Main Package and make change according to My Package in androidManifest.xml
i give you simple example. My project name is GCMExample and i have Three package 1. com.examle.GCMExample(Main Package) , 2. com.examle.GCMExample.activity(Second Package) , 3. com.example.GCMExample.adapter(Third Package)
I am not Getting Registration Id When My GCM Related Class File Into My Second Package
My GCM Related class like 1. GCMIntentService , 2. ServerUtilities , 3. CommonUtilities 4. WakeLocker put Into My Main Package com.example.GCMExample
also my androidManifest.xml
<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="android.permission.VIBRATE" />
<permission android:name="com.example.GCMExample.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.GCMExample.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<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.example.GCMExample" />
</intent-filter>
</receiver>
<service android:name="com.example.GCMExample.GCMIntentService" />
Registering app com.example.ilkgcm of senders "my_sender_id" -- This error suggests you haven't changed your 'my_sender_id' to a valid sender id which would be a 12-letter code.
If you are not getting response from the registration.one of the main reason is your manifest file is not configured correctly...especially give the "package_name"(your app package name like com.xxx.yyy) in the and correctly.
For example your receiver class name is : "MyCustomIntentService.java" , just change this name as "GCMIntentService.java" then try it again. This is simple solution. Just change your file name on the SRC area.