android 代码设置休眠,几行让Android进入休眠的C代码
生活随笔
收集整理的這篇文章主要介紹了
android 代码设置休眠,几行让Android进入休眠的C代码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
讓Android進入休眠的C代碼:
static void gotoSleep()
{
//echo standby >/sys/android_power/request_state
char *standby="standby" ;
int fd = open("/sys/android_power/request_state", O_WRONLY, 0);
if (fd == -1) {
perror("Could not open /sys/android_power/request_state\n");
return ;
}
write(fd, standby, strlen(standby));
close(fd);
}
static void wakeUp()
{
char *wake="wake";
int fd = open("/sys/android_power/request_state", O_WRONLY, 0);
if (fd == -1) {
perror("Could not open /sys/android_power/request_state\n");
return ;
}
write(fd, wake, strlen(wake));
close(fd);
}
總結
以上是生活随笔為你收集整理的android 代码设置休眠,几行让Android进入休眠的C代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: asp.net中ADO.NET连接SQL
- 下一篇: HtmlAgilityPack/xpat