在使用友盟推送的过程中,由于升级了推送sdk,推送的时候log能够打印出推送的消息,但是通知栏不会弹出,这个问题找了好久都没找到原因,代码又不能找到之前的版本。
这是我升级到的最新SDK
//基础组件库依赖(必须)
implementation 'com.umeng.umsdk:common:9.1.0'
// implementation 'com.umeng.umsdk:utdid:1.5.2'
//友盟push相关依赖(必须)
implementation 'com.umeng.umsdk:push:6.1.0'
log能接收到消息

解决方案: 当收到消息的时候,自定义通知栏,自己处理点击事件
1.自定义服务,接收友盟的消息

2.记得在AndroidManifest.xml 加推送服务
<!-- 友盟推送service -->
<service
android:name=".service.YouMengPushIntentService"
android:enabled="true"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":push" />
3.YouMengPushIntentService代码,自己处理了弹出通知栏
public class YouMengPushIntentService extends UmengMessageService {
NotificationManager manager;
int id;
public void getNotification(Context context, String title, String msg, String msgBody) {
LogUtil.e("YouMengPushIntentService", "getNotification");
manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
id = (i

最低0.47元/天 解锁文章
3920

被折叠的 条评论
为什么被折叠?



