How to create a real time location sharing android app

iyashwant picture iyashwant · May 11, 2017 · Viewed 16.8k times · Source

I want to create an app where people can see where they and their friends are Eg: - imagine 2 people are using the app they should be able to see each other's location in real time and they should be able to navigate to each other Can someone help me get the resources for creating such an app

Answer

Aman Jain picture Aman Jain · May 11, 2017

Building real-time location sharing app requires two major things:

  • Google Fused Location API (On Device Side)
  • A two-way communication channel between device and server.

Using above those in parallel to generate location data and send it to the server needs to be a fine balance between accuracy and battery drain.

You can use the HyperTrack SDK to build real-time location sharing feature in few steps.

Step 1

Follow setup guide to integrate HyperTrack SDK

Step 2

Use SDK method HyperTrack.createAndAssignAction using lookupID and expectedPlace to generate location sharing tracking URL to share with your friend.

Using tracking URL your friends can track you.

Step 3

On the other end you can fetch tracking detail from tracking URL to create another action to share your friend location using the same lookupID and expectedPlace and to fetch the lookupID and expectedPlace, call SDK method HyperTrack.getActionsForLookupId and repeat Step 2.

Step 4

Now to see the updated location in google map layout on your phone, you can integrate Live Tracking View provided by SDK. After integration happens, call HyperTrack.trackActionByLookupId method using the same lookupID to see the real-time updating location of your friends.

You can also refer to the implementation of live location sharing feature here and we have open-sourced our live location sharing app https://github.com/hypertrack/hypertrack-live-android .

Feel free to ask anything.

enter image description here

Disclaimer: I was an engineer of HyperTrack.

We have worked hard to make the SDK battery efficient and accurate without compromising on realtime-ness of the locations data. In case of issue, we provide any kind of technical support required during and after integration.