Android 在后台推送通知

Android 在后台推送通知,android,parse-platform,Android,Parse Platform,我想知道如何在不让用户知道已收到推送通知的情况下推送通知。只是我的应用程序应该知道通知,并根据通知执行所需的任务 public class GCMIntentService extends GCMBaseIntentService { @Override protected void onMessage(Context context, Intent intent) { Log.i(TAG, "Received message"); if (intent.getExtras().

我想知道如何在不让用户知道已收到推送通知的情况下推送通知。只是我的应用程序应该知道通知,并根据通知执行所需的任务

public class GCMIntentService extends GCMBaseIntentService
{
@Override
protected void onMessage(Context context, Intent intent)
{
    Log.i(TAG, "Received message");
    if (intent.getExtras().containsKey("payload"))
    {
        String message = intent.getExtras().getString("payload");
        CommonUtilities.displayMessage(context, message);
        // notifies user
        //generateNotification(context, message);
    }

   }
}
在此方法中,当消息到达时,不要通知用户

编辑:

此答案仅适用于您在自己实现的应用程序中直接使用GCM的情况。
如果您正在使用parse.com进行此操作,则无法实现您提出的问题。因为解析API会在内部通知此用户。

可以通过您用于实现GCM服务的GCMBaseIntentService消息上的重写方法来实现。只是不要通过这个方法通知用户。请你能发布一些代码如何推送它吗?嘿,但我正在使用parse.GCMBaseIntentService类没有显示