Use volume keys when phone is locked in android devices -


before everything, search in site , google still have problem , need please.

i want know how can use volume keys while phone locked? i'm using code , while phone not locked it's work not when it's locked.

public boolean onkeydown(int keycode, keyevent event) {     if ((keycode == keyevent.keycode_volume_up)) {         //          // return true because want handle key         return true;     }     if ((keycode == keyevent.keycode_volume_down)) {         //          // return true because want handle key         return true;     } 

i know have use broadcastreceiver matter. but, want know how? if guys give me live example or kind of tutorial can use.

i added manifest file

    <receiver         android:name=".countreciever"         android:process=":remote" >         <intent-filter>             <action android:name="addedcounting" />         </intent-filter>     </receiver> 

and created activity

import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.util.log; import android.widget.toast; public class countreciever extends broadcastreceiver { @override public void onreceive(context context, intent k2) {     // todo auto-generated method stub     toast.maketext(context, "received!", toast.length_long).show();     log.i("in receiver", "ohaaaha");     intent intent = new intent(context,addedcounting.class);     intent.addflags(intent.flag_activity_new_task);     context.startactivity(intent);   } } 

and in addedcounting activity have piece of code added @ beginning of post control volume keys.

but it's still not working. if guys can on appreciate it.

last not least, don't receive error.

thank of , time.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -