0

I have an Android tablet that does not have gps how can programmatically enter latitude and longitude And see virtual position on the android google maps.

setlocation(double latitude, double longitude)
bgh
  • 1
  • 2

3 Answers3

0

Are you using the Google maps api? If not, I think it would solve your problem. It has the option of moving the map camera to whatever position you like. You would need to provide the latitude and longitude.

https://developers.google.com/maps/documentation/android-api/

The link also has all the necessary code. I'm assuming you will be getting the location through the tablet's network provider.

EDIT: So, assuming you'll be having the latitude and longitude before hand and you wish to open the Google maps app - you should use the intent feature in android. It would go like this -

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);

Here saddr and daddr are start and end coordinates. Also, I got this from here - Launching Google Maps Directions via an intent on Android

NOTE: The above code will open the google maps app and won't show you the map in your very own app.

0

i use this and worked for my

                            Uri gmmIntentUri = Uri.parse("geo:0,0?q="+f);

                        Intent i2 = new Intent();
                        i2.setPackage("com.google.android.apps.maps");
                        i2.setAction(Intent.ACTION_VIEW);
                        i2.setData(gmmIntentUri);
                        i2.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);

                        context.startActivity(i2);

f = lat and lon f="0.0000,0.0000"

bgh
  • 1
  • 2
-1

I want to get lat and lon from a string and send be as gps data and refresh it in the service. Update when send new string and show up on the Google Map app in tablet.

bgh
  • 1
  • 2