Android Question Broadcast intent

stari

Active Member
Licensed User
Longtime User
Hi,
i have simple questions: is possible to broadcast intent "Unplugged" ?
So i will inform OS, that Headphones are not plugged inn and OS will not start a stupid audio Player.
THKS
 

stari

Active Member
Licensed User
Longtime User
Hi,
i have a problem with library. On this link http://android.amberfog.com/?p=415 i found a solution, but i can't make library working.
I need this solution:
//
// start java code for change on b4a lib BroadcastReceiver (2.0):
//
public void onReceive(Context context, Intent intent)
{
action = intent.getAction();
if (Intent.ACTION_MEDIA_BUTTON.equals(action))
{
KeyEvent event = (KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
ba.raiseEvent(this, (new StringBuilder(String.valueOf(eventName))).append("_onreceive").toString(), new Object[] {
action, event.getAction(), event.getKeyCode(), event.getRepeatCount(), event.getDownTime(), event.getEventTime()
});
}
else
{
ba.raiseEvent(this, (new StringBuilder(String.valueOf(eventName))).append("_onreceive").toString(), new Object[] {
action, intent, "", "", "", ""
});
}
}
//
// end java code
//
But i have no expirience with librarys.
Thks for litle help.
 

Attachments

  • phc2.zip
    23.9 KB · Views: 155
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
There is a broadcast-reciever library here in forum (search for it)....

Edit: In a other thread you stated that you got it running. Now you want to get help to build a wrapper which already exist (The broadcast reciever)???

I´m out here
 
Upvote 0

stari

Active Member
Licensed User
Longtime User
There is a broadcast-reciever library here in forum (search for it)....

Edit: In a other thread you stated that you got it running. Now you want to get help to build a wrapper which already exist (The broadcast reciever)???

I´m out here
The broadcasr-reciever library is slightly diferent.
My solution , the older version,that you mention, is working , but not on all phones. For example, on Samsung S3, S4 GooglePlay prevents my app to recieve Button state. so, why new version and new library.
 
Upvote 0
Top