gpt4 book ai didi

java - Wakelock - 标记名称应使用唯一前缀后跟冒号

转载 作者:搜寻专家 更新时间:2023-11-01 01:31:13 28 4
gpt4 key购买 nike

Screenshot of code in Android Studio

Tag name should use a unique prefix followed by a colon (found tag). For instance myapp:mywakelocktag. This will help with debugging less... (Ctrl+F1)

Wake Lock tags must follow the naming conventions defined in thePowerManager documentation. Issue id: InvalidWakeLockTag

    @Override
public void onSensorChanged(SensorEvent sensorEvent) {
float distance = sensorEvent.values[0];
if (!isVideo && !isSpeaker) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
if (distance < 4) {
if (wlOn != null && wlOn.isHeld()) {
wlOn.release();
}
if (pm != null) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
if (wlOff == null)
wlOff = pm.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
if (!wlOff.isHeld()) wlOff.acquire();
}
}
} else {
if (wlOff != null && wlOff.isHeld()) {
wlOff.release();
}
if (pm != null) {
if (wlOn == null)
wlOn = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag");
if (!wlOn.isHeld()) wlOn.acquire();
}
}
}
}

最佳答案

"tag" 更改为 "AppName:tag"

它正在搜索字符串中的冒号“:”。这不是一个非常明确的消息,我认为它是要我创建一个字符串变量并引用该变量。

关于java - Wakelock - 标记名称应使用唯一前缀后跟冒号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54004808/

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