We are trying to architect a way to remotely launch an application on an Android Device from a server within an intranet, and I am wondering if anyone has any recommendations on how to accomplish this.
The Android Device will already be talking to the server as a client, but, under certain circumstances, we will want to either launch an application or broadcast an intent on the device via command from the server. Is there something in the native Android libraries or the EMDK or is this really only feasible by hosting an Apache web server on the Android Device itself? If we must go the route of web server on the Android Device, does anyone have any recommendations on how to accomplish this? The org.apache.http package was deprecated from the native Android libraries, and I am unsure exactly what package I should be investigating. The java.net library looks promising.
Thank you very much!
Recommended Method for Sending Commands to an Android Device// Expert user has replied. |
7 Replies
I took all of this information back to my team, and we discussed our go-forward plan. We decided that, in order to preserve the appropriate and secure client-server architecture, it is best to utilize MQTT to send Push Notifications from the intranet server to the Android Client and have a background service running on the device which interprets the content of the Push Notification and performs the correct action in response.
,
Reading about MQTT, I am having a hard time understanding if it is used for more broadcast-like communication explicitly or can handle specific M2M messaging; so I can say "Send this message to this IP Address" and push a notification to the Android device. Can you help me understand this better?
Thank you.
Hi Jon-Luke, MQTT uses Publish/Subscribe. So the idea would be that your app or more likely your service running on the device would subscribe to some "topic". If you wanted to target specific messages go to a specific device, then the topic might be based on the device name, IP address, or some other unique identifier. The app or service will connect to a broker (server) and subscribe to that topic. When a message is published on the broker that matches that topic, your app/service will receive the message. It's been a while since I played with this, but I think you can subscribe to multiple topics too, so you might have one topic that all devices register for, and another one that is device specific.
There is also a great writeup on MQTT here: https://developer.motorolasolutions.com/docs/DOC-2315
Bill,
This looks like it could be helpful, but, like my response to , I believe the user will still be required to tap the notification in order to "accept" the trigger to launch the application. Do you know if MQTT has a way around that?
Thanks.
Hi Jon,
what you describe seems very dangerous! :-)
There's nothing standard that implement what you describe (mainly because can be a security risk). The basic idea is that you're going to build something that allows to remote control the Activity Manager (am command line utility on android) to send Intent/start app and activities.
As an example this is something that is possible to do with a tool like drozer, that is is a comprehensive security audit and attack framework for Android.
Would be interesting to understand what is the use case you have in mind to understand if there're different solutions available.
Best regards
~Pietro
Jon
You can probably use Push Notifications like mentioned in: Open android app from PUSH notification - Stack Overflow
As I understand this, the user will be required to click the notification in order to trigger the application start. Unfortunately this does not meet our requirements, but thank you for sharing this. I'm sure I will be able to use this info in future development. In this instance, we also wish to have the device locked down using EHS; so the notification bar will be inaccessible.
Thanks again.