Ale*_*xey 5 java android react-native
我有一个 Android 服务,它以特定的时间间隔发出通知。我需要用户在点击通知后导航到某个页面。
这是我使用的配置。这确实打开了应用程序,但我不知道如何将数据发布到 React-Native。
Bundle b = new Bundle();
b.putString("MyNameBundle", "Please Work");
final NotificationCompat.Builder builder =
new NotificationCompat.Builder(this).
setContentTitle("Sample Title").
setContentText("SampleText").
setSmallIcon(R.mipmap.notify);
setExtras(b);
Intent testIntent = new Intent(this, MainActivity.class);
testIntent.putExtras(b);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, testIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);
final NotificationManager nManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Run Code Online (Sandbox Code Playgroud)
我宁愿不使用外部库。
| 归档时间: |
|
| 查看次数: |
290 次 |
| 最近记录: |