推送通知对我来说不能正常工作,因为我使用的是旧的城市飞艇(现在简单地更名为飞艇) SDK。我使用的是8.3版,需要升级到9.0.0版。我正在阅读https://github.com/urbanairship/android-library/blob/master/documentation/migration/migration-guide.md以获取有关如何升级的说明。我找到了与我的案例相关的这一部分:
UrbanAirship库8.x到9.0.0
GCM
所有的GCM类都被移到了com.urbanairship.push.gcm
包中。如果您已在清单中手动添加GcmPushReceiver
或UAInstanceIDListenerService
,请更新条目。
我在源代码中发现了两个AndroidManifest.xml
文件:
<!-- Optional: Receives push and registration events from the Urban Airship SDK. -->
<service
android:name="com.urbanairship.push.UAInstanceIDListenerService"
android:exported="false" >
<intent-filter android:priority="-999" >
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<receiver
android:name="com.urbanairship.push.GcmPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter android:priority="-999" >
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
问题1.当指令要求更新条目in your manifest
时,它是指我上面列出的第一个还是第二个AndroidManifest.xml
文件?我假设它只能引用C:\Users[path]\app\src\main\AndroidManifest.xml
,因为C:\Users\[path]\app\build\intermediates\exploded-aar\com.urbanairship.android\urbanairship-sdk\8.3.2\AndroidManifest.xml
将在编译应用程序时自动生成。
问题2.当指令说in your manifest, please update the entries
时,是否意味着删除手动添加的行,因为包com.urbanairship.push.gcm
已经包含了GcmPushReceiver
和UAInstanceIDListenerService
,并且它会自动处理它?
谢谢。
更新1:在https://github.com/urbanairship/android-library/blob/master/urbanairship-gcm/src/main/AndroidManifest.xml上查看Android.Manifest.xml文件,一旦我升级到9.7.1版本,我的文件应该是这样的,对吗?然后,我应该在我的项目中包含在https://github.com/urbanairship/android-library/tree/master/urbanairship-gcm/src/main/java/com/urbanairship/push/gcm中列出的文件/类。对,是这样?
发布于 2019-04-30 09:00:40
现在我在我的build.gradle (Module: app)
中使用这个
// Urban Airship SDK
//compile 'com.urbanairship.android:urbanairship-sdk:8.3.+'
implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1'
不过,为了消除最初在使用implementation 'com.urbanairship.android:urbanairship-fcm:9.7.1'
时看到的一些错误,我还必须执行以下操作
compileSdkVersion 23
compileSdkVersion 28
in `build.gradle (Module: app)
我还使用了File > Invalidate Caches / Restart...
以防万一,以确保在修改build.gradle (Module: app)
文件后刷新所有内容。
https://stackoverflow.com/questions/55840387
复制相似问题