title: Write to device database and return its location
body: <p>I want to create an application where user can see the location of other device by number. The number will be fetched from device's contact list. On installing the application you agree that your location is visible to anyone who has your number.</p>
  
  <p>Suppose there are two devices A and B, and both have the app installed. In device A user opens the app, and he can see the location of device B in map. I was thinking that there should be some kind of "notification" or ping to be sent to B and in response B returns its location. So the "notification" will be some kind of database write, the database write will be "A has accessed your location at X time".</p>
  
  <p>Someone told me that I need a server in between that sends "notification" to and fro, and the device needs to run a background process so that its keeps listening to the notification, similar to WhatsApp or Viber.</p>
  
  <p>Is there any other way to implement this besides the "intermediate server" approach. A guy in #android-dev told me that there can be multiple approaches.</p>
  
  <p>I am new to Android development and it is going to be my first app.</p>
  
  <p>I have seen: <a href="https://stackoverflow.com/questions/10234364/push-notification-to-get-device-location">push notification to get device location</a></p>