HMS-Core / hms-cordova-plugin

This repo contains all of Cordova HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
89 stars 42 forks source link

Support for Android 12 (API level 31) #101

Closed nunoarruda closed 1 year ago

nunoarruda commented 1 year ago

Description This plugin fails to build in an Android project using the target SDK 31.

Expected behavior Build successfully

Current behavior Build fails

Logs

Manifest merger failed : android:exported needs to be explicitly specified for element <receiver#com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Environment

Xuejiao-Shi commented 1 year ago

com.huawei.hms:push:6.5.0.300 Fixed some issues for adapting to Android 12 (targetSdkVersion=31).

Before the new version of the plug-in released, as a workaround solution, you could manually modify the SDK version to com.huawei.hms:push:6.5.0.300 by following this guide.

nunoarruda commented 1 year ago

Replacing com.huawei.hms:push:6.3.0.304 with com.huawei.hms:push:6.5.0.300 wasn't enough for me.

I also had to replace...

<receiver android:name="com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver">

With...

<receiver android:name="com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver" android:exported="true">

Now my Capacitor Android project builds successfully.

Please release a new version with these fixes when you have a chance. Thanks in advance.

Xuejiao-Shi commented 1 year ago

@nunoarruda Thank you for providing the information regarding this issue, we'll record it and feedback to the R&D team, thanks.

vjfuenzalida commented 1 year ago

Any news on this? Versions 6.5.0.300 and 6.7.0.300 are already published for native projects, but I think what we need is the Ionic Native/Cordova support: the@hmscore/cordova-plugin-hms-push and @hmscore/ionic-native-hms-push NPM packages (hopefully anything higher than the 6.3.0-304 version)

furkanaydgn commented 1 year ago

Hello @vjfuenzalida and @nunoarruda ,

Android API level 31 support has been added with the latest update of @hmscore/cordova-plugin-hms-push. You can use this link to download the latest version of Huawei Cordova Push.

For more information about Huawei Cordova Push, you can access its official documentation via this link.