我正在尝试来自以下https://firebase.google.com/docs/samples的 Firebase 云消息传递快速入门示例代码 (Android)
我设法运行了示例代码,但是当我尝试从 Firebase 控制台发送通知时,尽管我可以在 logcat 中看到我发送的通知内容,但它没有显示在我的 Android Studio 模拟器中。logcat 中几乎没有错误。
我正在使用 Android Studio 2.1.1 Windows 64 位模拟器 Nexus_5x Android API 23
我可以在 logcat 中看到通知,有效负载为“hello 3”
05-30 15:13:25.746 2729-7428/com.google.firebase.quickstart.fcm D/MyFirebaseMsgService: From: 621412269084
05-30 15:13:25.746 2729-7428/com.google.firebase.quickstart.fcm D/MyFirebaseMsgService: Notification Message Body: hello 3
令牌 ID 取自下方
05-30 15:09:14.229 2729-2729/com.google.firebase.quickstart.fcm D/MainActivity: InstanceID token:
d58dJBNq_-E:APA91bHd8ZnNmVfKmMIEwnYgcx-T77E8UwU_jrrZkC4WWoZ6uZ-2lL6Dg4zZEEMvtUs2V86VjnNogOcAZKa1LF7ICvxNrEuWADgsibXt_6XoKDVmAvmsAFrzmJM4l8_Q-DcbjhN55kEx
在 logcat 中发现了一些错误
05-30 15:12:06.967 2234-6271/com.google.android.gms I/EventLogChimeraService: Aggregate from 1464619326768 (log), 1464619326768 (data)
05-30 15:12:07.029 2234-6275/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics.
05-30 15:12:07.070 2234-6276/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics.
05-30 15:13:25.724 1866-2597/com.google.android.gms.persistent D/GCM: Error whitelisting app for waking in doze
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at ott.a(SourceFile:49473)
at ott.c(SourceFile:1366)
at otn.b(SourceFile:638)
at ahge.a(SourceFile:998)
at ahgf.run(SourceFile:1070)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.SecurityException: Calling app u0a7 is not on whitelist
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at android.app.usage.IUsageStatsManager$Stub$Proxy.whitelistAppTemporarily(IUsageStatsManager.java:293)
at android.app.usage.UsageStatsManager.whitelistAppTemporarily(UsageStatsManager.java:266)
at java.lang.reflect.Method.invoke(Native Method)
at ott.a(SourceFile:49473)
at ott.c(SourceFile:1366)
at otn.b(SourceFile:638)
at ahge.a(SourceFile:998)
at ahgf.run(SourceFile:1070)
at java.lang.Thread.run(Thread.java:818)
05-30 15:13:25.735 2729-7429/com.google.firebase.quickstart.fcm I/FA: Tag Manager is not found and thus will not be used
05-30 15:13:25.746 2729-7428/com.google.firebase.quickstart.fcm D/MyFirebaseMsgService: From: 621412269084
05-30 15:13:25.746 2729-7428/com.google.firebase.quickstart.fcm D/MyFirebaseMsgService: Notification Message Body: hello 3
05-30 15:13:25.928 1200-1940/? D/WVCdm: Instantiating CDM.
05-30 15:13:25.929 1200-1602/? I/WVCdm: CdmEngine::OpenSession
05-30 15:13:25.929 1200-1602/? I/WVCdm: Level3 Library Sep 28 2015 13:08:28
05-30 15:13:25.930 1200-1602/? W/WVCdm: Could not read /data/mediadrm/IDM1013/ay64.dat2: No such file or directory
05-30 15:13:25.930 1200-1602/? W/WVCdm: Could not load liboemcrypto.so. Falling back to L3. dlopen failed: library "liboemcrypto.so" not found
05-30 15:13:25.932 1535-2145/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
05-30 15:13:25.947 1200-1602/? I/WVCdm: CdmEngine::QueryKeyControlInfo
05-30 15:13:25.949 1200-1200/? W/WVCdm: BufferReader::Read<T> : Failure during parse: Not enough bytes (4)
05-30 15:13:25.949 1200-1200/? W/WVCdm: CdmEngine::ExtractWidevinePssh: Unable to read atom size.
05-30 15:13:25.949 1200-1200/? I/WVCdm: CdmEngine::GenerateKeyRequest
05-30 15:13:25.950 1200-1200/? D/WVCdm: PrepareKeyRequest: nonce=1125203836
05-30 15:13:26.041 1200-1991/? I/WVCdm: CdmEngine::CloseSession
05-30 15:13:26.061 1866-7431/com.google.android.gms.persistent I/PhenotypeFlagCommitter: Experiment Configs successfully retrieved for com.google.android.gms.playlog.uploader
05-30 15:13:26.062 1866-7431/com.google.android.gms.persistent I/GoogleURLConnFactory: Using platform SSLCertificateSocketFactory
05-30 15:13:26.086 1535-2728/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
[ 05-30 15:13:26.447 3544: 3557 D/ ]
HostConnection::get() New Host Connection established 0xae428680, tid 3557
05-30 15:13:26.505 1535-1929/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
05-30 15:13:26.635 1535-1898/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
05-30 15:13:26.637 1535-1546/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
05-30 15:13:26.637 1866-7431/com.google.android.gms.persistent W/Uploader: no longer exists, so no auth token.
05-30 15:13:26.777 1535-1546/system_process I/AccountManagerService: getTypesVisibleToCaller: isPermitted? true
05-30 15:13:26.977 1866-7432/com.google.android.gms.persistent W/GLSUser: [AppCertManager] IOException while requesting key:
java.io.IOException: Invalid device key response.
at exx.a(SourceFile:267)
at exx.a(SourceFile:2235)
at exw.a(SourceFile:46)
at exq.a(SourceFile:55)
at exp.a(SourceFile:113)
at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.a(SourceFile:1054)
at ovi.run(SourceFile:179)
05-30 15:13:32.163 2234-7537/com.google.android.gms D/DropBoxEntryAddedChimeraService: User is not opted-in to Usage & Diagnostics.