Click here to Skip to main content
15,748,049 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am receiving SMS containing the data I needed such as latitude and longitude. I have successfully parse the SMS body and saved in into the database. I wanted to retrieve the stored coordinates and display it on Google Map.

What I have tried:

I am new to Android. Can you advice me what to do?
Updated 15-Mar-19 6:28am
Gerry Schmitz 15-Mar-19 11:08am    
Advice on what? It says: "Ask a Question"; you say "Give me advice"!

How does one follow the other?

Here's one way to do this:
// Create a Uri from an intent string. Use the result to create an Intent.
// Example latitude = 46.414382, longitude = 10.013988
Uri gmmIntentUri = Uri.parse("google.streetview:cbll=46.414382,10.013988");

// Create an Intent from gmmIntentUri. Set the action to ACTION_VIEW
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);

// Make the Intent explicit by setting the Google Maps package

// Attempt to start an activity that can handle the Intent

See: Google Maps Intents for Android  |  Maps URLs  |  Google Developers[^]

Share this answer
You would need to use the Google Maps SDK for Android for that, since you have gotten the latlong coordinates, you can use the Java code to render that.

Remember that you need to have a Google Maps API key for this to work, as Google's native Maps app would need you to call it from an Intent—and you do not control anything beyond that stage.

Check this page to know how to assign markers to the Google Maps: Markers  |  Maps SDK for Android  |  Google Developers[^], simplest of the code would be like,
// Code copied from the link above
private static final LatLng PERTH = new LatLng(-31.952854, 115.857342);
private static final LatLng SYDNEY = new LatLng(-33.87365, 151.20689);
private static final LatLng BRISBANE = new LatLng(-27.47093, 153.0235);

public void onMapReady(GoogleMap map) {
    mMap = map;

    // Add some markers to the map, and add a data object to each marker.
    mPerth = mMap.addMarker(new MarkerOptions()

    mSydney = mMap.addMarker(new MarkerOptions()

    mBrisbane = mMap.addMarker(new MarkerOptions()

    // Set a listener for marker click.
You need to provide the position values for your own coordinates that you have in the database.

Read the complete guide for Google Maps SDK for Android here, Overview  |  Maps SDK for Android  |  Google Developers[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900