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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:31:31+00:00 2026-06-02T02:31:31+00:00

I trying to make push notifications work for my android app. The server seems

  • 0

I trying to make push notifications work for my android app. The server seems OK since I receive notifications on my android 4 device. But I have other devices with android 2.2.1 and 2.3.4 that don’t receive the notifications.

Here’s my C2DMReceiver :

package vex.android;

import java.io.IOException;

import vex.android.settings.Local;
import vex.android.tool.Resources;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.google.android.c2dm.C2DMBaseReceiver;

public class C2DMReceiver extends C2DMBaseReceiver {

    public C2DMReceiver() {
        super(Local.PushNotificationEmail);
    }

    @Override
    public void onError(Context context, String errorId) {
        Log.e("VEX-PUSHNOTIFICATION", "Error " + errorId);
    }

    @Override
    protected void onMessage(Context context, Intent intent) {

        String saleTitle = Resources.getString("pushnotificationtitle", context); 
        String saleMessage = intent.getStringExtra("salemessage");
        String SaleId = intent.getStringExtra("saleid");
        String isMultiSale = intent.getStringExtra("ismultisale");

        Boolean multisale = (isMultiSale != null && isMultiSale.length()>0) ?  Boolean.parseBoolean(isMultiSale.trim()) : false;
        Integer saleid = (SaleId != null && SaleId.length()>0) ? Integer.parseInt(SaleId.trim()) : -1;
        if(saleMessage == null || saleMessage.length() <= 0 ) saleMessage = Resources.getString("pushnoticationmessage", context);
        createNotification(context, saleTitle, saleMessage, saleid, multisale);
    }

    public void createNotification(Context context,String SaleTitle, String SaleMessage, Integer saleid, Boolean multisale) {

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new Notification(R.drawable.applicationicon,
                "Message received", System.currentTimeMillis());
        // Hide the notification after its selected
        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        Intent intent = new Intent(context, MainApplication.class);
        intent.putExtra("saleid", saleid);
        intent.putExtra("ismultisale", multisale);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); // without flag a changed saleid wont be passed
        notification.setLatestEventInfo(context, SaleTitle, SaleMessage, pendingIntent);
        notificationManager.notify(saleid, notification);
    }

    @Override
    public void onRegistered(Context context, String registrationId) 
    throws IOException 
    {
        Local.setRegistrationId(registrationId);
    }

    @Override
    public void onUnregistered(Context context) 
    {
            Log.i("VEX-DEBUG", "successfully unregistered with C2DM server");
    }

}

I think the problem is there because event if I send the notification manually (with curl) it doesn’t work with android 2.2 and 2.3. Any idea? 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-06-02T02:31:33+00:00Added an answer on June 2, 2026 at 2:31 am

    C2DM uses Google Messaging Service. GTalk uses this service as well. Sometimes this service might be turned off. To check all related information just type in this code – *#*#8255#*#*

    C2DM is available on devices with android >= 2.2

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

Sidebar

Related Questions

I am trying to make a function like the Tunein App ( or other
trying to make a template, but I have an error in gcc4 but not
im trying to make an android application that whenever a user conncects to a
I am trying to make some enhancements to a production web app. After quite
I'm trying to make a simple TCP server using Twisted ,which can do some
Im trying to make github work on my mac snow leopard (10.6) I'm getting
Im trying to make a simple app (just for learning sake) that will be
I'm trying to make the desktop qt-components http://qt.gitorious.org/qt-components/desktop work inside Qt Designer. I'm trying
I am trying to make a simple user click action recorder in jquery but
I’m trying to make an embedded web page on my blackberry app, and I'm

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.