Search code examples
androidpush-notificationandroid-permissionshuawei-mobile-serviceshuawei-push-notification

Why HMS PushKit needs android.permission.REQUEST_INSTALL_PACKAGES


Recently I've added HMS PushKit SDK with this gradle code:

implementation "com.huawei.hms:push:5.0.4.302"

After That I've noticed that my application added to the list of apps with access to install apps from unknown source (special permission). I checked the AndroidManifest.xml file of one of this library's dependency (com.huawei.hms.base.availableupdate) and saw that it has this special permission:

<!-- If it is Android 8.0, the targetSdkVersion of the application compilation configuration>=26, please be sure to add the following permissions --> 
<uses-permission  android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

So Why PushKit needs this permission? I don't want my app to use this permission. And If I remove it with this code is there gonna be a problem (crash):

<uses-permission
        android:name="android.permission.REQUEST_INSTALL_PACKAGES"
        tools:node="remove"/>

Solution

  • UPDATE

    If you remove this permission, it will not be affected on Huawei phones,but the HMS Core APK may not be installed on non-Huawei phones.

    can it cause to crash in our app because of upgrade failure?--no,Only will make the application cannot be automatically upgraded,have to uninstall and download the new version.


    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

    This permission is used to update the HMS Core and push kit APK. Push kit strongly depends on the HMS Core and push kit APK. If this permission is not granted, applications may fail to be installed, and causing upgrade failures of the HMS and push kit`s APK.

    Therefore, this permission is mandatory.