T tman Member Licensed User Longtime User Jun 22, 2016 #1 How do I get my app to launch automatically when my usb accessory (AOA) is plugged in? Thus far I added these activity text lines to the manifest.xml < intent-filter> < action android:name="android.intent.action.MAIN"/> < category android:name="android.intent.category.LAUNCHER"/> < /intent-filter> < intent-filter> < action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/> < /intent-filter> < meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter"/> < /activity> I also added the proper "accessory_filter.xml" file to the res/xml directory Now I am not sure of where to go from here. I imagine I need some code in main activity to tell the app to open when the accessory notification is raised.
How do I get my app to launch automatically when my usb accessory (AOA) is plugged in? Thus far I added these activity text lines to the manifest.xml < intent-filter> < action android:name="android.intent.action.MAIN"/> < category android:name="android.intent.category.LAUNCHER"/> < /intent-filter> < intent-filter> < action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"/> < /intent-filter> < meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter"/> < /activity> I also added the proper "accessory_filter.xml" file to the res/xml directory Now I am not sure of where to go from here. I imagine I need some code in main activity to tell the app to open when the accessory notification is raised.
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2016 #2 Are you adding it with the manifest editor? Upvote 0
T tman Member Licensed User Longtime User Jun 25, 2016 #3 I decompiled the app made for the accessory and found this line in the manifest: <receiver android:name="com.embarcado.rtl.notifications.NotificationAlarm" /> It looks like I need to create a service in my app to receive the intent raised when the accessory is plugged in. I could use some guidance on how to go about this task. Upvote 0
I decompiled the app made for the accessory and found this line in the manifest: <receiver android:name="com.embarcado.rtl.notifications.NotificationAlarm" /> It looks like I need to create a service in my app to receive the intent raised when the accessory is plugged in. I could use some guidance on how to go about this task.
DonManfred Expert Licensed User Longtime User Jun 25, 2016 #4 look at the service code of the decompiled app too Upvote 0
T tman Member Licensed User Longtime User Jun 26, 2016 #5 Problem solved! I found a typo in my manifest - ugh! The manifest alone was enough to open my app automatically when the accessory is plugged into my phone. No further coding was needed in the app. Upvote 0
Problem solved! I found a typo in my manifest - ugh! The manifest alone was enough to open my app automatically when the accessory is plugged into my phone. No further coding was needed in the app.