我有一个使用 Firebase 的 Android React Native 应用程序。它现在需要在应用程序中发送消息,我已按照此处的说明进行操作。
当我使用我的 Android 模拟器的实例 ID 从 Firebase 发送测试消息时,我在重新启动应用程序时收到以下信息:
2019-11-21 15:26:43.472 6075-6075/? I/FIAM.Headless: Starting InAppMessaging runtime with Instance ID xxxxx
2019-11-21 15:26:43.746 6075-6075/? I/FIAM.Headless: Setting display event listener
2019-11-21 15:26:43.752 6075-6075/? I/FIAM.Headless: went foreground
2019-11-21 15:26:43.759 6075-6110/? I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: true | App Fresh Install: true
2019-11-21 15:26:43.780 6075-6110/? W/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/example.app/files/fiam_impressions_store_file: open failed: ENOENT (No such file or directory)
2019-11-21 15:26:43.795 6075-6110/? I/FIAM.Headless: Fetching campaigns from service.
2019-11-21 15:26:49.556 6075-6110/example.app I/FIAM.Headless: Successfully fetched 1 messages from backend
从最后一行来看,已经收到一条消息。但是,模拟器上的应用程序中没有显示任何内容。
我所做的唯一更改是使用旧版本的com.google.firebase:firebase-inappmessaging-display
andcom.google.firebase:firebase-analytics
以便正确同步 gradle 文件。我的build.gradle
文件:
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation "com.google.firebase:firebase-core:16.0.6"
implementation "com.google.firebase:firebase-firestore:17.1.5"
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation "com.google.firebase:firebase-storage:16.1.0"
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.5'
implementation 'com.google.firebase:firebase-analytics:16.0.6'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
transitive = true
}
implementation "com.google.android.gms:play-services-auth:16.0.1"
除了上述说明外,我还需要做些什么吗?