notification用Intent传值的时候如果收不到,可以用bundle来传。
发送notify:
Intent intent=new Intent(this,MainActivity.class); Bundle bundle=new Bundle(); bundle.putString("lvbo","result"); intent.putExtras(bundle);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
在onNewIntent接收
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent);
String result=getIntent().getExtras().getString("lvbo");}
本文介绍了一种在Android应用中通过使用Bundle替代Intent传递值的方法,以确保Notification数据能够被正确接收。文中提供了发送和接收通知的具体代码示例。

1124

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



