1. Download our Official Android App: Forums for Android!

Geo location using geo Uri

Discussion in 'Android Devices' started by Pickles57, Sep 13, 2017.

  1. Pickles57

    Pickles57 Lurker
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    1
    Joined:
    Sep 13, 2017

    Sep 13, 2017
    1
    0
    15
    I am trying to get my app to go to a specific latitude and longitude, but when it launches Google Maps or Google Earth it always defaults to my current location. Code is as follows:
    Code
    Button mapButton = (Button) findViewById(R.id.button2);
    mapButton.setOnClickListener(new View.OnClickListener() {
    @override
    public void onClick(View view) {
    String geoURI = "geo:37.422,-122.0847z=23";
    Uri geo = Uri.parse(geoURI);
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, geo);
    if (mapIntent.resolveActivity(getPackageManager()) != null) {
    startActivity(mapIntent);
    \Code

    How do I get it to override the default location and go to the coordinates I have hard coded above?
     

    Advertisement

Share This Page

Loading...