Question


I'm trying to build an android application.
The purpose of this application is "pair" 2 android devices in such a way that the first android device will be able to perform the following actions on the second android device remotely:

1. Take a picture/video using the camera
2. Turn on/off the tape recorder
3. Get the current position of the phone using the GPS

I wondered if I can get a little help figuring out the following:

1. Is this possible to perform the above actions on regular devices (not rooted)?
2. Can I make a p2p connection and preform the above actions, or should I use a third party server to process all the requests?
3. If I do use a server to process the requests, what is the best way to set up the connection?

If you can redirect me to the relevant APIs, it would be truly appreciated.

Thanks!

Was it helpful?

Solution

Turn on/off the tape recorder

Since I am unaware of any Android device that actually has "tape" (short of people with cracked cases), I am going to translate this as "record some audio".

Is this possible to perform the above actions on regular devices (not rooted)?

Sure. Use MediaRecorder for the audio/video (or Camera for still images), and use LocationManager for GPS. You will need several permissions, which the user will need to agree to at installation time.

Can I make a p2p connection and preform the above actions, or should I use a third party server to process all the requests?

Virtually nothing on the Internet is true P2P. In particular, the only way to do true P2P on mobile devices is if they are on the same WiFi network and can directly address each other. Even then, having open ports (necessary to allow one app to connect to another) on a mobile device is not a very good idea, unless you have a very large legal defense fund to handle all of the lawsuits.

A more practical approach would be to use GCM for push notifications to trigger events.

If I do use a server to process the requests, what is the best way to set up the connection?

Using the Internet. Beyond that, it is impossible to answer, since there are a myriad of "servers".

OTHER TIPS

  1. Yes, it's possible.
  2. P2P is possible in theory, but then you will have to handle all kinds of network problems occuring if the mobile operators use NAT or firewalls.
  3. I would use HTTP, as it's most common and most robust on mobile devices. Consider using a IaaS that provides messaging system, such as pubnub, it will save you a lot of trouble and will not cost you much.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top