Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 推送机器人:如何在布局中显示通知?_Android_Google Cloud Messaging_Pushbots - Fatal编程技术网

Android 推送机器人:如何在布局中显示通知?

Android 推送机器人:如何在布局中显示通知?,android,google-cloud-messaging,pushbots,Android,Google Cloud Messaging,Pushbots,我不熟悉堆栈溢出 我正在开发一个android应用程序,它使用推送机器人发送推送通知。我已经准备好在我的应用程序中启用推送机器人。我甚至可以发送推送通知。但我想存储通知文本并在应用程序中显示它们,而不仅仅是通知栏。请帮我解决这个问题。如果我的语言不正确,请原谅 多谢各位 接收器类别: import java.util.HashMap; import com.pushbots.push.Pushbots; import android.content.BroadcastReceiver; impo

我不熟悉堆栈溢出

我正在开发一个android应用程序,它使用推送机器人发送推送通知。我已经准备好在我的应用程序中启用推送机器人。我甚至可以发送推送通知。但我想存储通知文本并在应用程序中显示它们,而不仅仅是通知栏。请帮我解决这个问题。如果我的语言不正确,请原谅

多谢各位

接收器类别:

import java.util.HashMap;
import com.pushbots.push.Pushbots;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class customPushReceiver extends BroadcastReceiver
{
    private static final String TAG = "customPushReceiver";
    @Override
    public void onReceive(Context context, Intent intent)
    {
        String action = intent.getAction();
        Log.d(TAG, "action=" + action);
        // Handle Push Message when opened
        if (action.equals(Pushbots.MSG_OPENED)) {
            HashMap<?, ?> PushdataOpen = (HashMap<?, ?>)  intent.getExtras().get(Pushbots.MSG_OPEN);                intent.getExtras().get(Pushbots.MSG_OPEN);
        Log.w(TAG, "User clicked notification with Message: " + PushdataOpen.get("message"));
        // Start activity if not active
        // set the value of local variable "active" in onStart()/onStop() in MainActivity
        // to check for MainActivity status
        if(!MainActivity.isActive()){
            Intent launch = new Intent(Intent.ACTION_MAIN);
            launch.setClass(Pushbots.getInstance().appContext, MainActivity.class);
            launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            Pushbots.getInstance().appContext.startActivity(launch);
        }
        // Handle Push Message when received
        }else if(action.equals(Pushbots.MSG_RECEIVE)){
            HashMap<?, ?> Pushdata = (HashMap<?, ?>)  intent.getExtras().get(Pushbots.MSG_RECEIVE);
            Log.w(TAG, "User Received notification with Message: " + Pushdata.get("message"));
        }
    }
}
以下是日志中最近的一些行:

07-14 23:42:42.752:V/GCMBroadcastReceiver2491:onReceive:com.google.android.c2dm.intent.RECEIVE

07-14 23:42:42.752:V/GCMBroadcastReceiver2491:GCM IntentService类:com.pushbots.push.gcminentservice

07-14 23:42:42.752:V/pbgcmbaseintentservice 2491:获取尾波锁

07-14 23:42:42.760:I/PBGCMinentService2491:收到通知

07-14 23:42:42.760:D/PBGenerateNotification2491:当用户单击通知时,将从状态栏中取消通知

07-14 23:42:42.764:D/PBRequestTask2491:PUT请求:

07-14 23:42:42.780:V/pbgcmbaseintentservice 2491:释放尾波锁

07-14 23:42:49.888:D/PB2491:PushBots请求成功

07-14 23:43:51.532:D/PBMsgReceiver2491:未设置意图接收器,未发送com.pushbots.MSG\u已打开

07-14 23:43:51.532:D/PBRequestTask2491:PUT请求:


07-14 23:43:51.812:D/PB2491:PushBots请求成功

将接收到的数据存储在本地数据库中谢谢。但我不知道如何将推送机器人发送的通知存储在本地数据库中。请发布您的通知代码通知不会存储在数据库中,但通知中的数据将被存储请发布相关的显示/集成代码。
Pushbots.getInstance().regID();