Android MediaButtonReceiver - is blocking event but do not handles it -


android mediabuttonreceiver - blocking event not handles it. log empty. - there no headphone icon on bar. before experimenting code icon there, , button starting , stopping music.

code:

public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      audiomanager manager = (audiomanager) getsystemservice(audio_service);     manager.registermediabuttoneventreceiver(new componentname(getpackagename(), mediabuttonreceiver.class.getname()));  }  public class mediabuttonreceiver extends broadcastreceiver {      @override      public void onreceive(context context, intent intent)      {              //doing nothing          toast toast1 = toast.maketext(context, intent.getaction(), toast.length_short);          toast1.show();           //doing nothing         textview t = (textview)findviewbyid(r.id.textview1);          t.settext("received");     (...) 

manifest:

    <receiver android:name="com.example.brom.mainactivity.mediabuttonreceiver">         <intent-filter android:priority="1000" >             <action android:name="android.intent.action.media_button"></action>         </intent-filter>       </receiver> 

android getting event sure - because screen waking up, when press button.

it working after spliting project in 2 class files. problem may in manifest declaration.

now is:


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -