Arn*_*aud 32 android android-virtual-device android-emulator
当移动设备进入睡眠/省电模式时,我的Android应用程序的某些用户会报告错误.
我想在Android虚拟设备上测试该问题.是否可以在AVD上模拟手机进入睡眠/省电模式?
提前致谢.
小智 42
在模拟器上尝试以下操作
Settings
Developer options
Stay awake
(从顶部开始的第3个选项)如果不更改,仿真器将在1分钟后进入休眠状态(默认设置).
Developer options
默认情况下未启用,要启用它,请执行以下操作:
Settings
About emulated device
Build number
7次,您将收到通知,Developer options
现在已启用Developer options
小智 6
要使用命令行使设备进入睡眠状态,请运行:
adb shell input keyevent 223
要使用命令行将设备从睡眠状态唤醒,请运行:
adb shell input keyevent 224
有关可以使用 ADB 发送的关键事件的更多信息,请查看KeyEventKEYCODE_...
的常量,例如:
/** Key code constant: Sleep key.
* Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it
* has no effect if the device is already asleep. */
public static final int KEYCODE_SLEEP = 223;
/** Key code constant: Wakeup key.
* Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it
* has no effect if the device is already awake. */
public static final int KEYCODE_WAKEUP = 224;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16867 次 |
最近记录: |