HMS-Core / hms-react-native-plugin

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

Ads kit: VAST player needs permission on Android 31 #283

Closed megaacheyounes closed 1 year ago

megaacheyounes commented 1 year ago

when running ads example project on Android 12, VAST ads fails to load due to a soft exception in ads SDK, caused by missing permission : android.permission.READ_PHONE_STATE Ads example project should be updated by adding the permission to manifest file, and request that permission dynamically during runtime.

error:

 java.lang.SecurityException: listen
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2443)
        at android.os.Parcel.createException(Parcel.java:2427)
        at android.os.Parcel.readException(Parcel.java:2410)
        at android.os.Parcel.readException(Parcel.java:2352)
        at com.android.internal.telephony.ITelephonyRegistry$Stub$Proxy.listenWithEventList(ITelephonyRegistry.java:1036)
        at android.telephony.TelephonyRegistryManager.listenFromListener(TelephonyRegistryManager.java:250)
        at android.telephony.TelephonyManager.listen(TelephonyManager.java:6199)
        at com.huawei.hms.ads.vast.player.base.BaseVideoController.setPhoneStateListener(BaseVideoController.java:4)
        at com.huawei.hms.ads.vast.player.base.BaseVideoController.<init>(BaseVideoController.java:66)
        at com.huawei.hms.ads.vast.player.api.DefaultVideoController.<init>(DefaultVideoController.java:3)
        at com.huawei.hms.ads.vast.player.api.DefaultVideoController.<init>(DefaultVideoController.java:2)
        at com.huawei.hms.ads.vast.player.api.DefaultVideoController.<init>(DefaultVideoController.java:1)
        at com.huawei.hms.rn.ads.HMSAdsVastView.loadAd(HMSAdsVastView.java:131)
        at com.huawei.hms.rn.ads.HMSAdsVastView$Manager.receiveCommand(HMSAdsVastView.java:450)
        at com.huawei.hms.rn.ads.HMSAdsVastView$Manager.receiveCommand(HMSAdsVastView.java:367)
[...]
ozkulbeng commented 1 year ago

Hi @megaacheyounes

Due to global convention and the conflict issues of different permission handlers, the permissions, especially ones that require user actions, are being implemented by app developers, hence they are not developed on the demo applications of our plugins. You are advised to use your own or third-party permission handler in order to use the plugin.

Thank you for your interest in our projects.

megaacheyounes commented 1 year ago

This does not make any sense, if you want developers to just read or copy code from App.js then why not put that code in README.md file or just include that App.js file alone ? Why would you make the example/demo an entire react-native project if people can't just clone and run it ?