gpt4 book ai didi

android-接收推送通知文本并在 Activity 中显示

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:10:20 26 4
gpt4 key购买 nike

我能够从“Parse”(第 3 方)发送推送通知。但是,当用户收到该消息时,我想以某个字符串的形式接收该消息并将其显示在某个 Activity 中。单击通知后,我使用以下默认代码“解析”进行某些 Activity

PushService.setDefaultPushCallback(this, PushNoti.class);//change the class where u want to go after clicking on noti
ParseInstallation.getCurrentInstallation().saveInBackground();

通过使用它,我也可以参加该 Activity ,但是有人可以帮助我在某个字符串中获取该文本并显示它吗?或者,是否有任何默认方法在点击通知后被调用? (与 iOS 一样)

请不要将此帖子视为 Android - Receive Push notification and display it - not quite understanding 的重复帖子因为我没有使用钛。

最佳答案

在启动的Activity中获取通知的所有json数据的方式是:

Intent intent = getIntent(); 
Bundle extras = intent.getExtras();
String jsonData = extras.getString( "com.parse.Data" );
Log.d("MyApp",jsonData);

关于android-接收推送通知文本并在 Activity 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17789952/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com