disable notification.

Comments

3 comments

  • Avatar
    Dmitry Dyudeev

    Hello Sumeet,

    Actually, you can create a custom push intent service that extends PushGCMIntentService, that would receive all the main events, such as onRegistered, onUnregistered, onMessage, etc. You can re-define these methods in order to change your application's behaviour.

    Please note that you would have to replace the following line in the Manifest

    < service android:name="com.arellomobile.android.push.PushGCMIntentService" />
    

    with

    < service android:name=".CustomPushService" />
    < meta-data android:name="PW_PUSH_SERVICE" android:value="PACKAGE_NAME.CustomPushService" />
    
  • Avatar
    Sumitguha7

    Thanks a lot Dmitry, your solution worked for me.

  • Avatar
    Iskor Roksi

    I'm trying to push message String in JSON format like {"modelName":"XVU-519"}. It's showing the JSON String value in notification/status bar but it's now how I wanted it to be. I tried this solution for me to disable showing of notification and code is below, for simplicity I comment it out not to invoke the overriden method.

    public class CustomPushService extends PushGCMIntentService {

    private final String TAG = CustomPushService.class.getSimpleName();
    
    @Override
    protected void onRegistered(Context context, String s) {
        super.onRegistered(context, s);
    }
    
    @Override
    protected void onUnregistered(Context context, String s) {
        super.onUnregistered(context, s);
    }
    
    @Override
    protected void onMessage(Context context, Intent intent) {
        //super.onMessage(context, intent);
        Log.d(TAG, "onMessage " + intent.getExtras().getString(PushManager.PUSH_RECEIVE_EVENT));
    }
    

    }

    On my log message is null.

    CustomPushService﹕ onMessage null

    Any answer what's wrong with my implementation? It would be much helpful if a utility class have method of defining behavior to show or not to show the push message receive. Thanks! :)

Please sign in to leave a comment.