I'm upgrading from a really old version of Pushwoosh to the latest version. I'm using the PushGCMIntentService to create a CustomPushService as seen below. But the PushGCMIntentService isn't existing anymore so it seems? How can use my CustomPushService now? Is there a new version of the intentService? Or should I rewrite the whole class?

public class CustomPushService extends PushGCMIntentService {

public static final String JSON = "u";
private static final String PUSH_CONTENT = "title";
private static final String MESSAGE_ID = "message_id";
private static final String BADGE = "badge";

protected void onMessage(Context context, Intent intent) {
    String alert = intent.getStringExtra(PUSH_CONTENT);
    String extra = intent.getStringExtra(JSON);

    Integer messageId = null;
    Integer badge = null;

    if (extra != null) {
        JSONObject extraJson;
        try {
            extraJson = new JSONObject(extra);
            try {
                messageId = extraJson.getInt(MESSAGE_ID);
            } catch (JSONException e) {
                // ignore exception is safe here: messageId can be null
            try {
                badge = extraJson.getInt(BADGE);
            } catch (JSONException e) {
                // ignore exception is safe here: badge can be null
        } catch (JSONException e) {
            // ignore exception is safe here: messageId and badge can be null

    if (extra != null) {
        showMessageNotification(context, alert, messageId, badge);

    } else if (MainActivity.isOpen() || InCallActivity.isOpen()) {
        showGeneralNotification(context, alert);

private void showMessageNotification(Context context, String alert, Integer messageId, Integer badge) {
    if (badge != null) {
        Utils.setBadgeCount(context, badge);
        if (TextUtils.isEmpty(alert)) {
            new GetUnreadMessageInfo(true, false).execute();
        } else {
            Intent messageCountIntent = new Intent(MessageReceiver.NAME);
            messageCountIntent.putExtra(MessageReceiver.KEY_MESSAGE_COUNT, badge);
            messageCountIntent.putExtra(MessageReceiver.KEY_MESSAGE_ID, messageId);
            messageCountIntent.putExtra(MessageReceiver.KEY_MESSAGE_TEXT, alert);
            messageCountIntent.putExtra(MessageReceiver.KEY_MAKE_SOUND, true);
            messageCountIntent.putExtra(MessageReceiver.KEY_RELOAD_INBOX, true);

private void showGeneralNotification(Context context, String alert) {
    if (!AppContext.instance().getSipControl().isCallActive()) {
        Intent intent = new Intent(context, MainActivity.class);
        intent.putExtra(MainActivity.PUSH_DIALOG_TEXT, alert);


asked 05 Jan '17, 13:18
Tripwire's gravatar image


edited 05 Jan '17, 13:40


Please note that our Android SDK was significantly modified in recent times, so the most actual versions might be incompatible with projects created with use of older versions, so we would like to recommend you integrate it following the guide below:


If you would like to customize a view of push notification alerts you will need to create a custom Factory:


If you need to programmatically select which activity to display as a result of push notification, you can create custom broadcast receiver to receive push notification tap event:


Kind regards, Alex Belyaev

Pushwoosh team

permanent link
answered 09 Jan '17, 11:58
Alex's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Jan '17, 13:18

question was seen: 421 times

last updated: 09 Jan '17, 11:58