tiago ERNST
tiago ERNST

Reputation: 35

How can i send my location throught whatsapp while keeping it updated?

What i'm looking for is something like facebook's messenger sharing location, for the moment i have this :

public void sendMessage() {
    String whatsAppMessage = "http://maps.google.com/maps?saddr=" + mCurrentLocation.getLatitude()+ "," + mCurrentLocation.getLongitude();
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, whatsAppMessage);
    sendIntent.setType("text/plain");
    sendIntent.setPackage("com.whatsapp");
    startActivity(sendIntent);
}

I supose i could use something like firebase's firestore to store the location and keep it updated on different devices. But like can i keep it updating on whatsapp or should i do it on my app ?(having a marker that moves following the users movement) for the moment what I have is this

Any help appreciated thanks !

Upvotes: 0

Views: 104

Answers (1)

Arthur Attout
Arthur Attout

Reputation: 2926

Using the firestore won't solve anything, because you'll end up sending a bunch of messages anyways (possibly flooding your destinator's inbox if you update it constantly).

You won't be able to bind the location of your phone to a real-time update on your destinator's whatsapp inbox, because they will probably open it with Google Maps, and your app will not be able to tell Google Map on this specific phone to move a marker around.

You should re-think the architecture of your app. You can embed a Google Map Activity in your app in your app instead, and make it update using Firebase. But that will require (as I said) to re-think your process.

Upvotes: 1

Related Questions