Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8412635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:43:22+00:00 2026-06-10T00:43:22+00:00

i want to implement google cloud messaging service CCM. but i am getting forced

  • 0

i want to implement google cloud messaging service CCM. but i am getting forced closed error. i am debugging the code on real device.
My Main.java code is as below:

package com.imran.fgcm;

import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.app.Activity;
import android.widget.Toast;

public class Main extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        GCMRegistrar.checkDevice(this);
        GCMRegistrar.checkManifest(this);
        final String regId = GCMRegistrar.getRegistrationId(this);
        if (regId.equals("")) {
          GCMRegistrar.register(this, "123450000");
          Toast.makeText(this, regId , Toast.LENGTH_LONG).show();
        } else {
        // Log.v(TAG, "Already registered");
            Toast.makeText(this, "Already registered" , Toast.LENGTH_LONG).show();
        }

and my android manifest file is code is as below:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.imran.fgcm"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="15" />
    <permission android:name="com.imran.fgcm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="com.imran.fgcm.permission.C2D_MESSAGE" /> 
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <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=".Main"
            android:label="@string/title_activity_main" >
            <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.imran.fgcm" />
  </intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
    </application>

</manifest>

now it had stopped giving forced closed error after i added the GCMIntetservice.java class. but it is still not genrerating the device id. My logcat output is

01-03 11:34:01.023: V/GCMRegistrar(6469): Registering receiver
01-03 11:34:01.023: D/GCMRegistrar(6469): resetting backoff for com.imran.fgcm
01-03 11:34:01.058: V/GCMRegistrar(6469): Registering app com.imran.fgcm of senders 732773857047
01-03 11:34:01.288: D/TextLayoutCache(6469): Using debug level: 0 - Debug Enabled: 0
01-03 11:34:01.843: D/CLIPBOARD(6469): Hide Clipboard dialog at Starting input: finished by someone else... !
01-03 11:34:03.138: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:34:03.138: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:03.138: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:03.143: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-1
01-03 11:34:03.148: D/GCMBaseIntentService(6469): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:34:03.148: D/GCMBaseIntentService(6469): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:34:03.148: D/GCMBaseIntentService(6469): Scheduling registration retry, backoff = 4143 (3000)
01-03 11:34:03.213: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:07.318: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.gcm.intent.RETRY
01-03 11:34:07.318: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:07.318: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:07.353: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-2
01-03 11:34:07.368: V/GCMRegistrar(6469): Registering app com.imran.fgcm of senders 732773857047
01-03 11:34:07.398: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:07.443: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:34:07.443: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:07.443: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:07.453: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-3
01-03 11:34:07.458: D/GCMBaseIntentService(6469): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:34:07.458: D/GCMBaseIntentService(6469): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:34:07.458: D/GCMBaseIntentService(6469): Scheduling registration retry, backoff = 7873 (6000)
01-03 11:34:07.503: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:07.508: D/dalvikvm(6469): GC_CONCURRENT freed 213K, 4% free 12852K/13319K, paused 3ms+3ms
01-03 11:34:15.343: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.gcm.intent.RETRY
01-03 11:34:15.343: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:15.343: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:15.378: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-4
01-03 11:34:15.393: V/GCMRegistrar(6469): Registering app com.imran.fgcm of senders 732773857047
01-03 11:34:15.428: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:15.498: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:34:15.498: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:15.498: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:15.503: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-5
01-03 11:34:15.508: D/GCMBaseIntentService(6469): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:34:15.508: D/GCMBaseIntentService(6469): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:34:15.508: D/GCMBaseIntentService(6469): Scheduling registration retry, backoff = 7347 (12000)
01-03 11:34:15.538: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:22.863: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.gcm.intent.RETRY
01-03 11:34:22.863: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:22.863: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:22.908: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-6
01-03 11:34:22.923: V/GCMRegistrar(6469): Registering app com.imran.fgcm of senders 732773857047
01-03 11:34:22.958: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:22.968: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:34:22.968: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:22.968: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:22.978: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-7
01-03 11:34:22.978: D/GCMBaseIntentService(6469): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:34:22.983: D/GCMBaseIntentService(6469): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:34:22.983: D/GCMBaseIntentService(6469): Scheduling registration retry, backoff = 35123 (24000)
01-03 11:34:23.013: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:58.113: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.gcm.intent.RETRY
01-03 11:34:58.118: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:58.118: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:58.153: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-8
01-03 11:34:58.168: V/GCMRegistrar(6469): Registering app com.imran.fgcm of senders 732773857047
01-03 11:34:58.203: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:34:58.228: V/GCMBroadcastReceiver(6469): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:34:58.228: V/GCMBroadcastReceiver(6469): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:34:58.228: V/GCMBaseIntentService(6469): Acquiring wakelock
01-03 11:34:58.233: V/GCMBaseIntentService(6469): Intent service name: GCMIntentService-732773857047-9
01-03 11:34:58.238: D/GCMBaseIntentService(6469): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:34:58.238: D/GCMBaseIntentService(6469): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:34:58.238: D/GCMBaseIntentService(6469): Scheduling registration retry, backoff = 67761 (48000)
01-03 11:34:58.268: V/GCMBaseIntentService(6469): Releasing wakelock
01-03 11:35:50.863: D/CLIPBOARD(6469): Hide Clipboard dialog at Starting input: finished by someone else... !
01-03 11:35:52.688: E/ActivityThread(6469): Activity com.imran.fgcm.Main has leaked IntentReceiver com.google.android.gcm.GCMBroadcastReceiver@41903ec8 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-03 11:35:52.688: E/ActivityThread(6469): android.app.IntentReceiverLeaked: Activity com.imran.fgcm.Main has leaked IntentReceiver com.google.android.gcm.GCMBroadcastReceiver@41903ec8 that was originally registered here. Are you missing a call to unregisterReceiver()?
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1118)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ContextImpl.registerReceiver(ContextImpl.java:1105)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:355)
01-03 11:35:52.688: E/ActivityThread(6469):     at com.google.android.gcm.GCMRegistrar.setRetryBroadcastReceiver(GCMRegistrar.java:293)
01-03 11:35:52.688: E/ActivityThread(6469):     at com.google.android.gcm.GCMRegistrar.register(GCMRegistrar.java:215)
01-03 11:35:52.688: E/ActivityThread(6469):     at com.imran.fgcm.Main.onCreate(Main.java:19)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.Activity.performCreate(Activity.java:4470)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.os.Looper.loop(Looper.java:137)
01-03 11:35:52.688: E/ActivityThread(6469):     at android.app.ActivityThread.main(ActivityThread.java:4511)
01-03 11:35:52.688: E/ActivityThread(6469):     at java.lang.reflect.Method.invokeNative(Native Method)
01-03 11:35:52.688: E/ActivityThread(6469):     at java.lang.reflect.Method.invoke(Method.java:511)
01-03 11:35:52.688: E/ActivityThread(6469):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
01-03 11:35:52.688: E/ActivityThread(6469):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
01-03 11:35:52.688: E/ActivityThread(6469):     at dalvik.system.NativeStart.main(Native Method)
01-03 11:36:06.028: V/GCMRegistrar(6860): Registering receiver
01-03 11:36:06.033: D/GCMRegistrar(6860): resetting backoff for com.imran.fgcm
01-03 11:36:06.053: V/GCMRegistrar(6860): Registering app com.imran.fgcm of senders 732773857047
01-03 11:36:06.093: D/TextLayoutCache(6860): Using debug level: 0 - Debug Enabled: 0
01-03 11:36:06.178: D/CLIPBOARD(6860): Hide Clipboard dialog at Starting input: finished by someone else... !
01-03 11:36:06.203: V/GCMBroadcastReceiver(6860): onReceive: com.google.android.c2dm.intent.REGISTRATION
01-03 11:36:06.203: V/GCMBroadcastReceiver(6860): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:36:06.203: V/GCMBaseIntentService(6860): Acquiring wakelock
01-03 11:36:06.218: V/GCMBaseIntentService(6860): Intent service name: GCMIntentService-732773857047-1
01-03 11:36:06.238: D/GCMBaseIntentService(6860): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
01-03 11:36:06.238: D/GCMBaseIntentService(6860): Registration error: SERVICE_NOT_AVAILABLE
01-03 11:36:06.238: D/GCMBaseIntentService(6860): Scheduling registration retry, backoff = 2363 (3000)
01-03 11:36:06.263: V/GCMBaseIntentService(6860): Releasing wakelock
01-03 11:36:08.618: V/GCMBroadcastReceiver(6860): onReceive: com.google.android.gcm.intent.RETRY
01-03 11:36:08.618: V/GCMBroadcastReceiver(6860): GCM IntentService class: com.imran.fgcm.GCMIntentService
01-03 11:36:08.618: V/GCMBaseIntentService(6860): Acquiring wakelock
01-03 11:36:08.653: V/GCMBaseIntentService(6860): Intent service name: GCMIntentService-732773857047-2
01-03 11:36:08.668: E/GCMBaseIntentService(6860): Received invalid token: 1111101101100100100110110001110011001001010011110110001010010110
01-03 11:36:08.668: V/GCMBaseIntentService(6860): Releasing wakelock
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:43:23+00:00Added an answer on June 10, 2026 at 12:43 am

    TO receive the Notification you need to override the onMessage method from GCMIntentService class as follows

    @Override
        protected void onMessage(Context arg0, Intent arg1) {
    
            Log.d("GCM", "RECIEVED A MESSAGE");
            // Get the data from intent and send to notificaion bar
            generateNotification(arg0, arg1.getStringExtra("**mymsg**"));
        }
    

    here “mymsg” should me match with your php message attribute. Please Note that both name should be same in php and in android otherwise you will not receive the notification.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement the Candlestick Google Chart, but I want to be able
I want to implement a Google Map on my .NET page. I used the
I want to implement in my webpage something similar to google search page. The
I want implement in my software solution an VBA editor but in c# 3.0.
I want to implement the Google custom search API with Greasemonkey, and so far
I want to implement serial-number notification for google checkout as I do not have
I want to implement this new method of Google Analytics, I want to conditinally
i want to implement a google map based on its api. i want to
I'm trying to implement google analytics code into our system that is mainly ajax
I want to implement VSTO word integration in web application mvc3, like google docs.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.