gpt4 book ai didi

android - 为什么HMS PushKit需要android.permission.REQUEST_INSTALL_PACKAGES

转载 作者:行者123 更新时间:2023-12-05 00:15:36 24 4
gpt4 key购买 nike

最近我用这个gradle代码添加了HMS PushKit SDK:

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

在那之后,我注意到我的应用程序添加到了应用程序列表中,可以从未知来源安装应用程序(特殊权限)。我检查了该库依赖项之一的 AndroidManifest.xml 文件(com.huawei.hms.base.availableupdate),发现它具有此特殊权限:

<!-- 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" />

那么为什么 PushKit 需要这个权限呢?我不希望我的应用程序使用此权限。如果我用这段代码删除它会不会有问题(崩溃):

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

最佳答案

更新

取消权限后,华为手机不受影响,但非华为手机可能无法安装HMS Core APK。

会不会因为升级失败导致我们的应用程序崩溃?--不会,只会让应用程序无法自动升级,必须卸载并下载新版本。


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

该权限用于更新HMS Core和推送包APK。推送服务强依赖HMS Core和推送服务APK。如果不授予该权限,可能会导致应用安装失败,导致HMS和push kit的APK升级失败。

因此,此权限是强制性的。

关于android - 为什么HMS PushKit需要android.permission.REQUEST_INSTALL_PACKAGES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65977403/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com