onkeydown - android policy phonewindow getSystemService permission denied -


i trying use

context.getsystemservice(context.activity_service)

to topactivity in onkeydown method of class phonewindow.java.but told "java.lang.securityexception: permission denial: gettasks()",how can change permission or code right ?

below piece of code

protected boolean onkeydown(int featureid, int keycode, keyevent event) {    context mcontext;    mcontext = getcontext();    activitymanager mactivitymanager = (activitymanager)mcontext.getsystemservice(context.activity_service);    componentname mcname = mactivitymanager.getrunningtasks(1).get(0).topactivity;    string activityname = mcname.getclassname().tostring();    log.d(tag, "packagename " + activityname);    ... } 

<uses-permission android:name="android.permission.get_tasks" > </uses-permission> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -