gpt4 book ai didi

android - 如果我只在 Google Play 商店发布,我是否需要 Google Play 服务的 android.permission.WAKE_LOCK?

转载 作者:可可西里 更新时间:2023-11-01 18:49:35 30 4
gpt4 key购买 nike

我正在尝试集成 Google Analytics for Android。根据 documentation here ,它要求添加 android.permission.WAKE_LOCK(提供下面的注释)。我不是很清楚。如果我仅在 Google Play Store 中发布应用程序,我还需要这个吗?

如果这不是绝对必要的话,我真的不想要求用户额外的许可。

<!-- Optional permission for reliable local dispatching on non-Google Play devices -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

特别是,我不明白这个注释的实际含义here :

Optionally a WAKE_LOCK permission can be requested to improve dispatching on non-Google Play devices.

最佳答案

更新:从 Android 6(API 级别 23)开始,WAKE_LOCK 被归类为“normal”权限,这意味着该权限是自动授予的。删除 WAKE_LOCK 权限通常会导致应用程序崩溃(见下文)所以我会避免这样做。


我也是这样。我不想添加额外的权限,因为它会显着减少使用最新版本应用的人数(因为新权限意味着用户必须明确选择接收应用更新)。

我相信我已经通过结合 this SO question 上的一些答案找到了解决方案。 .

首先,将“tools”命名空间添加到应用程序的 list 中

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

其次,添加“WAKE_LOCK”权限但使用删除选项

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

现在,当我上传新的 APK 时,我可以看到不再需要权限:

wake lock permission removed

重要

这个解决方案似乎不再可行。我现在收到大量 RuntimeExceptions 抛出消息“用户 10182 和当前进程都没有 android.permission.WAKE_LOCK。”

Fatal Exception: java.lang.RuntimeException
Unable to start receiver com.google.android.gms.measurement.AppMeasurementReceiver: java.lang.SecurityException: Neither user 10182 nor current process has android.permission.WAKE_LOCK.

关于android - 如果我只在 Google Play 商店发布,我是否需要 Google Play 服务的 android.permission.WAKE_LOCK?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30960275/

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