注册

Android 关于集成环信点击行为不唤起落地页问题

1、华为推送前台点击行为不唤起落地页问题

华为系统级别通知,应用系统特性,华为指定固定跳转页面action(如:刷屏页面、广告页面),可实现前台或后台都唤起落地页

{
"async":false,
"targets": [
"cs1"
],
"strategy": 2,
"pushMessage": {
"title": "环信",
"content": "你好,欢迎使用环信推送服务",
"sub_title": "环信",
"ext":{
"test":"skip test"
},
"config": {
"clickAction": {
"action": "com.a.b.shot"
}
}
}
}

2、小米vivo离线点击未触发重写方法

vivo 没有点击回调,可在跳转页面获取,vivo指定 activity


注意:小米预定义通知不走onNotificationMessageClicked。指定跳转类型为预定义通知。


不指定,点击回调我们的应用测试正常。可自行重写PushMessageReceiver 验证是否小米sdk 未触发 PushMessageReceiver.onNotificationMessageClicked

指定,小米推送配置指定action,在相应的Activity中可以调用Intent的getSerializableExtra(PushMessageHelper.KEY_MESSAGE)方法得到MiPushMessage对象。


public class MyMipushReceiver extends EMMiMsgReceiver {

@Override
public void onNotificationMessageClicked(Context context, MiPushMessage miPushMessage) {
String extStr = miPushMessage.getContent();
JSONObject extras = new JSONObject(extStr);
if (extras !=null ){
String t = extras.getString("xxxx");
//handle
}
}
}

public class EMMiMsgReceiver extends PushMessageReceiver {
private static final String TAG = "EMMiMsgReceiver";

public void onNotificationMessageClicked(Context context, MiPushMessage message) {
EMLog.i(TAG, "onNotificationMessageClicked is called. " + message.toString());
Intent msgIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
msgIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(msgIntent);
}
}


4、oppo 和魅族的点击能力(是否和华为一样)

经验证行为和华为一样,前台情况下也需要指定跳转页,oppo, 魅族指定 activity

{
"async":false,
"targets": [
"cs1"
],
"strategy": 2,
"pushMessage": {
"title": "公子小白有点黑",
"content": "你好,欢迎使用环信推送服务",
"sub_title": "环信",
"config": {
"clickAction": {
"action": "com.a.b.shot",
"activity": "com.hyphenate.easeim.section.me.activity.AboutHxActivity"
}
}
}
}


5、离线扩展对应问题,设置的内容和获取对应即可。

如设置:"ext":{"test1":"t1", "test2":"t2"},获取如下

public class MainActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Bundle extras = getIntent().getExtras();
if (extras != null) {
String t = extras.getString("test1");
String f = extras.getString("test2");
//TODO
}
}
}


0 个评论

要回复文章请先登录注册