1.Arouter PendingIntent
项目中进行模块划分的时候,有时候需要用到PendingIntent,PendingIntent中需要传入一个Intent,如果是处于两个模块的页面,如何传递呢?写类名.class的话两个模块又耦合了。
2.解决方案
Postcard postcard = ARouter.getInstance().build("/im/MessageActivity");
LogisticsCenter.completion(postcard);
Class<?> destination = postcard.getDestination();
Intent intent = new Intent(context, destination);
Bundle bundle = new Bundle();
bundle.putString("KEY_RECEIVER_IS_GROUP", "2");
bundle.putString("KEY_RECEIVER_ID", model.getOrganizeId());
bundle.putString("KEY_CHAT_TITLE", model.getOrganizeName());
intent.putExtras(bundle);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
new NotificationUtils(context, noticeNum, R.mipmap.logo).sendNotification(title, contentStr, pendingIntent);