I am developing an application for proof of concept at school and I need to develop a simple app that lets a parent track a child’s android device. I’ve figured out how to use GPS to get location updates now What is the best way to bridge the gap between parent’s device and the child’s device? How will the app know who is Parent and who is child? Also is it best to send the child’s data using getLastKnownLocation(best) to a remote server and then some how send to parent, or is there an easier way to do this?
Thanks in advance.
03/25/2012 ********Update***********************
Ok based on the advice from you guys I have the php code in a file
<?php
$thisString = $_POST["action"]; // Variable to receive the request from
echo $thisString;
?>
and I send the string to the web-service with this code in a method
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://kre8tiveinspired.com/android/simpleTest.php");
// This is the data to send
String MyName = **"String Test"**; //any data to send
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("action", MyName));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String response = httpclient.execute(httppost, responseHandler);
//This is the response from a php application
String reverseString = response;
Toast.makeText(this, "response " + reverseString, Toast.LENGTH_LONG).show();
}...
It gives me a toast saying “response String Test”.
OK now it works but How will I send two different variables like long and lat. and then receive two different variables from the responseHandler when I execute the
httpclient.execute(httppost, responseHandler command.
You should probably have your app register an alarm that wakes a service installed with your app on the child phone. This service should send location data to a server which will push it to the parent phone. The app will also need to install a service on the parent phone to receive notifications.
To decide which is the parent and which is the child you would most likely need to configure the app individually on each phone i.e. have the parent install the app on their phone and on the child phone and set the child phone as child and theirs as parent. You might password protect this setting. The other option would be to develop two apps, Where’s My Kid (tracking) and Where’s My Kid (parent).
Finally, you need a system running on a server to manage the data coming from the child. It would then send relevant information to the parent device. You might also have the parent create an account and then have them log in on the parent and child devices so that the server knows where to send the information.
This is not an easy project. If you are looking to build something commercial or distributive, it will require quite a bit of work. If it’s really only a proof of concept as you mentioned, you can cut some corners. Either way, what I outlined is pretty much the minimum you will need.