在manifest里面找到这个provider
<!-- 适配Android N系统必需的ContentProvider声明,写权限包含应用包名-->
<provider android:name="com.baidu.android.pushservice.PushInfoProvider"
android:authorities="com.tianxin.malient.liteapp.bdpush" android:exported="true"
android:protectionLevel="signature"
android:writePermission="baidu.push.permission.WRITE_PUSHINFOPROVIDER.com.tianxin.mapclient.liteapp" />
第二行代码。项目包名后面,注意要加上.bdpush
即可
/**
* 接收通知点击的函数。
*
* @param context 上下文
* @param title 推送的通知的标题
* @param description 推送的通知的描述
* @param customContentString 自定义内容,为空或者json字符串
*/
@Override
public void onNotificationClicked(Context context, String title,
String description, String customContentString) {
String notifyString = "通知点击 onNotificationClicked title=\"" + title + "\" description=\""
+ description + "\" customContent=" + customContentString;
Log.i(TAG, notifyString);
// 自定义内容获取方式,mykey和myvalue对应通知推送时自定义内容中设置的键和值
if (!TextUtils.isEmpty(customContentString)) {
JSONObject customJson = null;
try {
customJson = new JSONObject(customContentString);
String myvalue = null;
if (!customJson.isNull("mykey")) {
myvalue = customJson.getString("mykey");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
// Demo更新界面展示代码,应用请在这里加入自己的处理逻辑
updateContent(context, notifyString);
}