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 8508685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:13:41+00:00 2026-06-11T03:13:41+00:00

I am using GCM service on my new Android app , I did my

  • 0

I am using GCM service on my new Android app , I did my code well but when I am running the project on my mobile I had exception that the project stopped unexpectedly , but when I commented this lines of code

 GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this); 

The error stopped but when I was running the project error occurred and when I checked my Google API to check if the error sent to my Google API but I didn’t find any reports why???

GCMIntenetService class

package com.example.elarabygroup;

import com.google.android.gcm.GCMBaseIntentService;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class GCMIntenetService extends GCMBaseIntentService {
    public static String TAG = "GCMIntentService";

    public GCMIntenetService(String senderId) {
        super(senderId);
        Log.d("GCMIntentService", senderId);
    }

    @Override
    protected void onError(Context arg0, String arg1) {
        Log.d("onError", arg1);
    }

    @Override
    protected boolean onRecoverableError(Context context, String errorId) {
        Log.d("onRecoverableError", errorId);
        return false;
    }

    @Override
    /*
    protected void onMessage(Context arg0, Intent arg1) {
        Log.d("onMessage", String.valueOf(arg1));
    }
    */
    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("**notificaion**"));
    }

    private void generateNotification(Context arg0, String stringExtra) {
        // TODO Auto-generated method stub

    }

    @Override
    protected void onRegistered(Context arg0, String arg1) {
        Log.d("onRegistered", arg1);
    }

    @Override
    protected void onUnregistered(Context arg0, String arg1) {
        Log.d("onUnregistered", arg1);
    }
}

manifest

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <permission
        android:name="com.example.elarabygroup.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.elarabygroup.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <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" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".ElarabyGroup"
            android:label="@string/title_activity_elaraby_group" >
            <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.elarabygroup" />
            </intent-filter>
        </receiver>

        <service android:name=".GCMIntentService" />
    </application>

</manifest>

Activity

package com.example.elarabygroup;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import com.google.android.gcm.GCMRegistrar;

public class ElarabyGroup extends Activity {
    private String TAG;
    private String SENDER_ID = "xxxxxxxx";
    private WebView webView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_elaraby_group);

        GCMRegistrar.checkDevice(this);
        GCMRegistrar.checkManifest(this);

        final String regId = GCMRegistrar.getRegistrationId(this);
        if (regId.equals("")) {
            GCMRegistrar.register(this, "xxxxxxxx");
        } else {
            Log.v(TAG, "Already registered");
        }

        try {

            ConnectivityManager con = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

            if (con.getNetworkInfo(0).getState() == NetworkInfo.State.DISCONNECTED
                    && con.getNetworkInfo(1).getState() == NetworkInfo.State.DISCONNECTED) {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);

                builder.setMessage("No Internet connection");
                AlertDialog alert = builder.create();
                alert.show();

            } else

            {

                webView = (WebView) findViewById(R.id.webView1);
                webView.getSettings().setJavaScriptEnabled(true);
                webView.loadUrl("http://m.elarabygroup.com");
            }

        } catch (Exception e) {

            AlertDialog.Builder builder = new AlertDialog.Builder(this);

            builder.setMessage(e.getMessage().toString());

            AlertDialog alert = builder.create();

            String url = "http://m.elarabygroup.com/";

            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);

        }

    }

}
/*
 * @Override public boolean onCreateOptionsMenu(Menu menu) {
 * getMenuInflater().inflate(R.menu.activity_elaraby_group, menu); return true;
 * } }
 */
  • 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-11T03:13:42+00:00Added an answer on June 11, 2026 at 3:13 am

    If log is available We can find the problem, so try to get log by installing some application like aLogCat in your mobile.

    if you can’t get that, Refer this tutorial

    http://androidv5.wordpress.com/2012/08/15/how-to-implement-google-cloud-messaging/

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

Sidebar

Related Questions

I've follow this code: How to get RegistrationID using GCM in android but i
I have created a Push Notifications for Android using GCM. The Service is facing
Using android 2.3.3, I have a background Service which has a socket connection. There's
I'm trying to implement GCM to my app in Android. The server and client
I am using GCM API and gcm.jar given in android documentation. Its working good.
Searching for some info about how to send notifications using GCM but with PHP
I'm trying to get the new GCM service to work for me, so I've
I am trying to register a device onto GCM using the following code: public
I have implemented GCM in my app and I am using GSMRegistrar as suggested
I am trying to migrate my application from C2DM service to new GCM push

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.