I am trying to get the registration ID for C2DM in android for mobile app. I have tried some code but its not working properly not providing any registration id can someone help me in this case so i can get the registration id successfully for c2dm.
My main activity is
public class IdTest1Activity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
intent.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
intent.putExtra("sender", "youruser#gmail.com");
startService(intent);
}
}
my receiver class is
public class C2dmReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.w("C2DM", "Registration Receiver called");
if ("com.google.android.c2dm.intent.REGISTRATION".equals(action)) {
Log.w("C2DM", "Received registration ID");
final String registrationId = intent
.getStringExtra("registration_id");
String error = intent.getStringExtra("error");
Log.d("C2DM", "dmControl: registrationId = " + registrationId
+ ", error = " + error);
// TODO Send this to my application server
}
}
}
My Manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.IdTest1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="com.IdTest1.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.IdTest1.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".IdTest1Activity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".C2dmReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" >
</action>
<category android:name="com.IdTest1" />
</intent-filter>
</receiver>
</application>
</manifest>
Change com.google.android.c2dm.intent.REGISTRATION in your receiver - .C2dmReceiver to com.google.android.c2dm.intent.RECEIVE, and it should be ok then.
Related
I am getting following error when trying to configure Push Notification:
Failed to resolve target intent service, skipping classname enforcement
Error while delivering the message: ServiceIntent not found.
Manifest:
<manifest package="com.packageName"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- support previous 4.4 KitKat devices-->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.packageName.permission.C2D_MESSAGE" />
<application
android:name="AppName"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.Black.NoTitleBar">
<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="com.packageName" />
</intent-filter>
<intent-filter> <!-- support previous 4.4 KitKat devices-->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.packageName" />
</intent-filter>
</receiver>
<service
android:name="com.packageName.activities.RegistrationIntentService"
android:exported="false" >
</service>
<service
android:name="com.packageName.activities.GcmIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:name="com.packageName.activities.MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>
MyGcmListenerService:
public class MyGcmListenerService extends GcmListenerService {
#Override
public void onMessageReceived(String from, Bundle data) {
String message = data.getString("message");
Log.d("From", "From: " + from);
Log.d("Msg", "Message: " + message);
}
}
RegistrationIntentService
public class RegistrationIntentService extends IntentService {
private static String SENDER_ID = "MySenderID";
public RegistrationIntentService(){
super(SENDER_ID);
}
#Override
public void onHandleIntent(Intent intent){
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
try {
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
Log.i("TOKEN", "GCM Registration Token: " + token);
} catch (Exception e) {
Log.d("Fail token", "Failed to complete token refresh", e);
}
}
}
GcmIDListenerService
public class GcmIDListenerService extends InstanceIDListenerService {
#Override
public void onTokenRefresh() {
Intent intent = new Intent(this, RegistrationIntentService.class);
startService(intent);
}
}
I have placed google-services.json in projectName/app
I send push notification from web http://techzog.com/development/gcm-notification-test-tool-android/ and the response is success:1 but it not received in Android device.
I am use push bots API for push notification i got exception null pointer when i try to implement Custom handler for notifications.
Here is documentation where i learn
https://pushbots.com/developer/docs/android-sdk-integration
My Android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.assorttech.assorttech" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="com.assorttech.assorttech.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.assorttech.assorttech.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive dataf message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="com.assorttech.assorttech.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.thefinestartist.finestwebview.FinestWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="sensor"
android:theme="#style/FinestWebViewTheme.Light"
>
</activity>
<receiver
android:name="com.pushbots.google.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.assorttech.assorttech" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.push.DefaultPushHandler" />
<!--<receiver android:name="com.assorttech.assorttech.customHandler" />-->
<service android:name="com.pushbots.push.GCMIntentService" />
</application>
</manifest>
public class customHandler extends BroadcastReceiver
{
private static final String TAG = "customHandler";
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
Log.d(TAG, "action=" + action);
// Handle Push Message when opened
if (action.equals(PBConstants.EVENT_MSG_OPEN)) {
//Check for Pushbots Instance
Pushbots pushInstance = Pushbots.sharedInstance();
if(!pushInstance.isInitialized()){
// Log.d("Initializing Pushbots.");
Pushbots.sharedInstance().init(context.getApplicationContext());
}
//Clear Notification array
if(PBNotificationIntent.notificationsArray != null){
PBNotificationIntent.notificationsArray = null;
}
HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_OPEN);
Log.w(TAG, "User clicked notification with Message: " + PushdataOpen.get("message"));
//Report Opened Push Notification to Pushbots
if(Pushbots.sharedInstance().isAnalyticsEnabled()){
Pushbots.sharedInstance().reportPushOpened( (String) PushdataOpen.get("PUSHANALYTICS"));
}
//Start lanuch Activity
String packageName = context.getPackageName();
Intent resultIntent = new Intent(context.getPackageManager().getLaunchIntentForPackage(packageName));
resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_CLEAR_TASK);
resultIntent.putExtras(intent.getBundleExtra("pushData"));
Pushbots.sharedInstance().startActivity(resultIntent);
// Handle Push Message when received
}else if(action.equals(PBConstants.EVENT_MSG_RECEIVE)){
HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_RECEIVE);
Log.w(TAG, "User Received notification with Message: " + PushdataOpen.get("message"));
}
}
}
Main Activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Pushbots.sharedInstance().setCustomHandler(customHandler.class);
}
You need to add
Pushbots.sharedInstance().init(this);
in your activity's onCreate() method.
I am trying to send user to user notification on click of a button to specific users but getting this issue while sending notification from last 4 days in android, and with this, whenever i uninstall the app from my phone which i am using as emulator, and reinstall it for debugging, it doesnt create new installation id and take the old one: i Guess this is the problem, please it will be great help if anybody help me in a elaborated way
Here is my code of custom reciever:
public class CustomPushReceiver extends ParsePushBroadcastReceiver {
private final String TAG = CustomPushReceiver.class.getSimpleName();
private NotificationUtils notificationUtils;
private Intent parseIntent;
public CustomPushReceiver() {
super();
}
#Override
protected void onPushReceive(Context context, Intent intent) {
super.onPushReceive(context, intent);
if (intent == null)
return;
try {
JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
Log.e(TAG, "Push received: " + json);
parseIntent = intent;
parsePushJson(context, json);
} catch (JSONException e) {
Log.e(TAG, "Push message json exception: " + e.getMessage());
}
}
#Override
protected void onPushDismiss(Context context, Intent intent) {
super.onPushDismiss(context, intent);
}
#Override
protected void onPushOpen(Context context, Intent intent) {
super.onPushOpen(context, intent);
}
/**
* Parses the push notification json
*
* #param context
* #param json
*/
private void parsePushJson(Context context, JSONObject json) {
try {
boolean isBackground = json.getBoolean("is_background");
JSONObject data = json.getJSONObject("data");
String title = data.getString("title");
String message = data.getString("message");
if (!isBackground) {
Intent resultIntent = new Intent(context, MainActivity.class);
showNotificationMessage(context, title, message, resultIntent);
}
} catch (JSONException e) {
Log.e(TAG, "Push message json exception: " + e.getMessage());
}
}
/**
* Shows the notification message in the notification bar
* If the app is in background, launches the app
*
* #param context
* #param title
* #param message
* #param intent
*/
private void showNotificationMessage(Context context, String title, String message, Intent intent) {
notificationUtils = new NotificationUtils(context);
intent.putExtras(parseIntent.getExtras());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
notificationUtils.showNotificationMessage(title, message, intent);
}
}
and my ParseQuery:
try {
ParseQuery userQuery = new ParseQuery(ParseUser.class);
userQuery.whereNear("Location",
currentUser.getParseGeoPoint("Location"));
userQuery.setLimit(10);
userQuery.whereEqualTo("Type", "Doctor");
userQuery.whereEqualTo("deviceType", "android");
userQuery.findInBackground();
// Find devices associated with these users
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereMatchesQuery("user", userQuery);
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pushQuery);
push.setMessage("Only users near"
+ currentUser.getParseGeoPoint("Location")
+ " will recieve this push notification");
push.sendInBackground(new SendCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
Toast.makeText(getApplicationContext(),
"Notification Sent", Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(getApplicationContext(),
"Notification not Sent",
Toast.LENGTH_LONG).show();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aspire.wecare"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.aspire.wecare.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.aspire.wecare.permission.C2D_MESSAGE" />
<permission
android:name="com.aspire.wecare.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.aspire.wecare.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<application
android:name="com.aspire.wecare.ParseApp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.aspire.wecare.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.aspire.wecare.Welcome"
android:label="#string/title_activity_welcome" >
</activity>
<activity
android:name="com.aspire.wecare.LoginActivity"
android:label="#string/title_login" >
</activity>
<activity
android:name="com.aspire.wecare.LoginSignupActivity"
android:label="#string/title_activity_login_signup" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBA3_YfEl2cnZ8uDmrI23g8W7l1y2Xiku8" />
<!-- Added for Parse push notifications -->
<service android:name="com.parse.PushService" />
<receiver
android:name=".receiver.CustomPushReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<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.aspire.wecare" />
</intent-filter>
</receiver>
<!-- /Added for Parse push notifications -->
</application>
</manifest>
In general terms,
(1) you would be doing this in cloud code. Fortunately it's very easy once you get started. In fact here is a total explanation from a similar question.
https://stackoverflow.com/a/32540054/294884
Muhc more importantly though,
(2) be aware you're using the wrong tool for the job. You do not use 'Push' for what you are trying to achieve. You should be using PubNub, Firebase, Pusher or a similar service. It is commonplace to use one of these in combination with Parse.
I have a important delivery, i hope you can help me.
I have to use GCM.
I am using the file in the official guide in http://developer.android.com/guide/google/gcm/demo.html
I did "Setting Up the Server Using App Engine for Java" and it work.
My problem is the android application .Exactly I don't recive the id from GCM and so anytime my application try the registration.
Thanks a lot....
public class DemoActivity extends Activity {
TextView mDisplay;
AsyncTask<Void, Void, Void> mRegisterTask;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkNotNull(SERVER_URL, "SERVER_URL");
checkNotNull(SENDER_ID, "SENDER_ID");
// Make sure the device has the proper dependencies.
GCMRegistrar.checkDevice(this);
// Make sure the manifest was properly set - comment out this line
// while developing the app, then uncomment it when it's ready.
GCMRegistrar.checkManifest(this);
setContentView(R.layout.main);
mDisplay = (TextView) findViewById(R.id.display);
registerReceiver(mHandleMessageReceiver,
new IntentFilter(DISPLAY_MESSAGE_ACTION));
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
// Automatically registers application on startup.
GCMRegistrar.register(this, SENDER_ID);
} else {
....
}
CommonUtilities
public final class CommonUtilities
{
static final String SERVER_URL = "http://127.0.0.1:8888/gcmdemo4/home";
static final String SENDER_ID = "843761346XXX";
...
}
GCMIntentService
public class GCMIntentService extends GCMBaseIntentService {
#SuppressWarnings("hiding")
private static final String TAG = "GCMIntentService";
public GCMIntentService() {
super(SENDER_ID);
}
#Override
public void onRegistered(Context context, String registrationId) {
Log.i(TAG, "Device registered: regId = " + registrationId);
displayMessage(context, getString(R.string.gcm_registered));
ServerUtilities.register(context, registrationId);
}
.....
MY manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.registrazionegcm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.example.registrazionegcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.registrazionegcm.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" >
<activity
android:name="DemoActivity"
android:label="#string/app_name" >
<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="com.example.registrazionegcm" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
could you supply your code of "registerReceiver".
I had the same problem, when my SENDER_ID was wrong.
Try to check it again, and check your package too: com.example.registrazionegcm.GCMIntentService
Put some breakpoint in onError and onRegistered
For me, this code works:
#Override
public void run() {
GCMRegistrar.checkDevice(mContext);
GCMRegistrar.checkManifest(mContext);
String deviceToken = GCMRegistrar.getRegistrationId(mContext);
if (deviceToken.equals("")) {
GCMRegistrar.register(mContext, "XXXXXXXXXXXXXXX");
deviceToken = GCMRegistrar.getRegistrationId(mContext);
if(!deviceToken.equals("")){
GCMRegistrar.setRegisteredOnServer(mContext, true);
// register deviceToken on CommNotes srv
RequestMaker req = new RequestMaker(Constant.REQ_REGISTER_GCM, mContext);
//if unsuccessful, try again 5 times
for(int i = 0; i<5; i++){
Log.d("ComNotes", "registration id"+deviceToken);
if(req.doRequest(deviceToken) == ReturnCode.CODE_OK){
break;
}
}
}
//TODO manage unsuccess: display error : "No PUSH available"
} else {
Log.v("CommunityNotes", "Already registered "+deviceToken);
}
}
I have Written the application for getting registration id for c2dm. but i am getting Exception as unable to start activity component info at line startService(intent);
My main class is
public class IdTestActivity extends Activity {
static TextView mytext = null;
Context context = null;
Intent intent = null;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
intent.putExtra("app",PendingIntent.getBroadcast(this, 0, new Intent(), 0));
intent.putExtra("sender", "dvimayandroid#gmail.com");
startService(intent);
}
}
My Receiver class is
public class c2dmReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.w("C2DM", "Registration Receiver called");
if ("com.google.android.c2dm.intent.REGISTRATION".equals(action)) {
Log.w("C2DM", "Received registration ID");
final String registrationId = intent
.getStringExtra("sender");
String error = intent.getStringExtra("error");
Log.d("C2DM", "dmControl: registrationId = " + registrationId
+ ", error = " + error);
// TODO Send this to my application server
}
}
}
and my manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.IdTest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application>
<permission
android:name="com.IdTest.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.IdTest.permission.C2D_MESSAGE" />
<activity
android:name=".IdTestActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".c2dmReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" >
</action>
<category android:name="com.IdTest" />
</intent-filter>
</receiver>
</application>
</manifest>
It looks like you need to add a permission to your manifest. Check what's needed here, and make sure your app includes everything:
http://code.google.com/android/c2dm/#manifest
you should add the permission to reveive messages from C2DM Servers like this in your manifest :
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
i think you should add the registration intent filter to your service by this you could get the registration id
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="your pacakge" />
</intent-filter>
also you to get the coming registration id you use
intent.getStringExtra("registration_id");
hope that could help you