Chinaunix首页 | 论坛 | 博客
  • 博客访问: 300831
  • 博文数量: 43
  • 博客积分: 2071
  • 博客等级: 大尉
  • 技术积分: 488
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-25 17:48
文章分类

全部博文(43)

文章存档

2014年(5)

2013年(4)

2011年(9)

2010年(8)

2009年(17)

我的朋友

分类: Android平台

2013-05-02 21:26:11

the below is one method to launch Android application by one hardware key.
I use "keycodes" in init..rc in this method.

1.make sure "=y" in kernel configuration file.

2.in init..rc, add below lines.
service launch_apk /system/bin/sh /system/bin/launch_apk.sh
    disabled
    oneshot
    keycodes 270
270 is one example of key index.

3.add one script file named launch_apk.sh in /system/bin/.
the context is as below.
    am start com.example.sendintent/com.example.sendintentMainActivity
com.example.sendintent. is one example of Main Activity of the targeted application.

4.in fact, this "keycodes" method is designed to be used in debuggable mode, see below comments in /system/core/init.keychords.c
    // only handle keychords if ro.debuggable is set or adb is enabled.
    // the logic here is that bugreports should be enabled in userdebug or eng builds
    // and on user builds for users that are developers.
so if you want to use this method in the version faced to end-user, you need do walk around here.
阅读(713) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~