androidgoogle-maps

Android app starts Google Maps with Satellite view


You can start in your app the Google Maps app with code like:

String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);

Starting in Streetview mode is possible as well.

Is it possible to start Google Maps immediately with the Satellite view?

I could not find information about it via e.g. this Google Maps intent information.


Solution

  • You can try a different form of the intent using a universal, cross-platform URL to launch described here.

    This form permits the use of a basemap parameter with a value of satellite.

    The parameters of interest are here.

    Code fragment. Launch map intent on button press (labeled "Launch Map") - ignore other bits in the display:

    Button b = findViewById(R.id.main_button);
    b.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // Paris coordinates
                double latitude = 48.8575;
                double longitude = 2.3514;
                String uri = String.format(Locale.ENGLISH, "https://www.google.com/maps/@?api=1&map_action=map&center=%f,%f&zoom=10&basemap=satellite", latitude, longitude);
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
                MainActivity.this.startActivity(intent);
            }
        });
    

    And result:

    enter image description here