This commit is contained in:
18142669586 2022-08-22 18:15:47 +08:00
parent 318a3dcf8c
commit c303ad1f83
2 changed files with 37 additions and 1 deletions

View File

@ -32,7 +32,10 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/
public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符
public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
// public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境
public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager";
/**

View File

@ -6,6 +6,8 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
@ -125,11 +127,18 @@ import cn.rongcloud.rtc.api.RCRTCConfig;
import cn.rongcloud.rtc.api.RCRTCEngine;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.rong.imkit.config.RongConfigCenter;
import io.rong.imkit.notification.NotificationConfig;
import io.rong.imlib.RongIMClient;
import kotlin.Unit;
import static com.yunbao.common.CommonAppContext.isReady;
import io.rong.imlib.model.Message;
import io.rong.push.PushManager;
import io.rong.push.PushType;
import kotlin.*;
@Route(path = RouteUtil.PATH_MAIN)
public class MainActivity extends AbsActivity implements MainAppBarLayoutListener {
@ -292,6 +301,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
// Log and toast
Log.d(TAG, token);
PushManager.getInstance()
.onReceiveToken(MainActivity.this, PushType.GOOGLE_FCM, token);
Toast.makeText(MainActivity.this, token, Toast.LENGTH_SHORT).show();
}
});
@ -392,6 +403,28 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
mViewPager.setCurrentItem(0);
mTabButtonGroup.setCurPosition(0);
isInstructor();
RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() {
@Override
public boolean isNotificationIntercepted(Message message) {
return true;
}
@Override
public PendingIntent onPendingIntent(PendingIntent pendingIntent, Intent intent) {
return null;
}
@Override
public boolean isHighPriorityMessage(Message message) {
return false;
}
@Override
public NotificationChannel onRegisterChannel(NotificationChannel notificationChannel) {
return null;
}
});
RxView.clicks(findViewById(R.id.banner_click))
.throttleFirst(2, TimeUnit.SECONDS)
.subscribe(new Observer<Unit>() {