React-Native 从通知中传递来自 Java 的数据

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)

我宁愿不使用外部库。