Recommended Method for Sending Commands to an Android Device

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!

Robert Galvin
JonYou can probably use Push

Jon

You can probably use Push Notifications like mentioned in: Open android app from PUSH notification - Stack Overflow

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jon-Luke West
As I understand this, the

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Jon-Luke, in this case a

Jon-Luke, in this case a simple TCP socket listener may fit your needs. Allowing the sender to bind to that socket and send a custom command.   I would echo Pietro's concern on this matter, and would suggest that you encrypt the messages before sending.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jon-Luke West
Bill & ,Thank you for raising

Bill & ,

Thank you for raising those security concerns.  We are planning this with security in mind; as the solution is security/device lock-down focused and all communication between the server and the device will be encrypted.  We originally did this on the Windows CE platform, and we are now redesigning the system for Android.

The dangerous things are sometimes the most fun hahaha...

Thanks!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
There is also a great writeup

There is also a great writeup on MQTT here:  https://developer.motorolasolutions.com/docs/DOC-2315

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Jon-Luke West
Bill,This looks like it could

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
By implementing the

By implementing the MqttCallBack(), you have complete control of what happens when the message is received. It's been a while since I've looked at this in depth, but I believe the user would not have to accept the incoming message.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Jon-Luke West
I will look into this. 

I will look into this.  Sounds like it might be exactly what we need.

Thank you.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Hi Jon,what you describe

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

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Jon-Luke West
I took all of this

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Jon-Luke,  MQTT uses

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments