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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:49:47+00:00 2026-05-28T02:49:47+00:00

i want that when the phone receives a push notification from AC2M, a notification

  • 0

i want that when the phone receives a push notification from AC2M, a notification must be shown in the notification bar, and if the user press on the notification, my app must be started and show a specific activity describing that notification, and not the normal fist activity of my app.

It is possible to achieve this? can someone explain me how?

My app must be started to listen the receiver? or can my app be not started?

thanks

  • 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-05-28T02:49:47+00:00Added an answer on May 28, 2026 at 2:49 am

    From C2DM , yes this is possible.

    In C2DMReceiver.java class use this code :

    @Override
    protected void onMessage(Context context, Intent intent) {
    
        Bundle extras = intent.getExtras();
        if (extras != null) {
            NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            int icon = R.drawable.icon;        // icon from resources
            CharSequence tickerText = "MyApp Notification";              // ticker-text
            long when = System.currentTimeMillis();         // notification time
            Context context21 = getApplicationContext();      // application Context
            CharSequence contentTitle = "MyApp Notification Title";  // expanded message title
            CharSequence contentText = (CharSequence) extras.get("message");     // expanded message text
        Intent notificationIntent = new Intent(this, YourActivityName.class);
            PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    
            Notification notification = new Notification(icon, tickerText, when);
            notification.defaults |= Notification.DEFAULT_VIBRATE;
            notification.defaults |= Notification.DEFAULT_LIGHTS;
            notification.defaults |= Notification.DEFAULT_SOUND;
            notification.flags |= Notification.FLAG_AUTO_CANCEL;
            notification.setLatestEventInfo(context21, contentTitle, contentText, contentIntent);
            mNotificationManager.notify(Constants.NOTIFICATION_ID, notification);
    
        }
    }
    

    To make your app started to listen, make sure you have declared following in AndroidManifest.xml file of your project(along with other necessary required permissions):

    <service android:name=".C2DMReceiver" />
    
     <!-- Only C2DM servers can send messages for the app. If permission is not set - any other app can generate it 
    
    
           <receiver android:name=".C2DMReceiver" android:permission="com.google.android.c2dm.permission.SEND"> -->
                 <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
                    android:permission="com.google.android.c2dm.permission.SEND">
                  <!-- Receive the actual message -->
                  <intent-filter>
                      <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                      <category android:name="com.your.packagename" />
                  </intent-filter>
                  <!-- Receive the registration id -->
                  <intent-filter>
                      <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                      <category android:name="com.your.packagename" />
                  </intent-filter>
              </receiver>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making an Android app that communicates with a server. When the Android-phone receives
I want to show the image that mobile phone's camera its taking on a
I want that everytime someone wants to checkout the project from SVN he/she will
I want that the user shouldn't be able to resize the window form. I
I want that user/attacker to encrypt the data and send to server. Now I
I want to find out that the screen is OFF when user locked a
I'm seeing some very strange behaviour from the Apple Push Notification Servers when the
I am trying to build an app on my wife's phone that pranks her
I'm making an iPhone application that needs to show a notification to the user
I want to show a notification after receiving a WAP push message in my

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.