Wednesday, March 5, 2014

Android 4.03 usb does not respond to a message waiting.


Android 4.03 usb does not respond to a message waiting, I signed up online that's why the news that there is no mechanism to respond to it? Also need to set something in AndroidManifest.xml it?

 

@ Override
protected void onStart () {
super.onStart ();

final IntentFilter intentFilter = new IntentFilter ();
intentFilter.addAction (UsbManager.ACTION_USB_DEVICE_ATTACHED);
intentFilter.addAction (UsbManager.ACTION_USB_DEVICE_DETACHED);
intentFilter.addAction (UsbManager.ACTION_USB_ACCESSORY_ATTACHED);
intentFilter.addAction ("android.hardware.usb.action.USB_STATE");
registerReceiver (receiver, intentFilter);
}
private final BroadcastReceiver receiver = new BroadcastReceiver () {

@ Override
public void onReceive (Context context, Intent intent) {
final String action = intent.getAction ();
/ / Breakpoint does not respond? Will also need to add anything?
if (intent.getAction (). equals (UsbManager.ACTION_USB_DEVICE_ATTACHED)) {
. boolean connected = intent.getExtras () getBoolean (UsbManager.EXTRA_ACCESSORY);
if (! connected) {
/ / It was disconnected from the plug, do something ...
}
}
}
};
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Find a reason, because it is not deployed as a system app, so there is no response to the incident.
Reply:
filter.addDataScheme ("file") ;/ / this line must be otherwise unable to receive radio
Reply:
You can now have a
Reply:
Are you entrap,
android.hardware.usb.action.USB_STATE This is not an increase filter.addDataScheme ("file"); this statement.

Only Intent.ACTION_MEDIA_MOUNTED on usb mount like it needs filter.addDataScheme ("file");

No comments:

Post a Comment