Hey I want to use Intent object everything is fine but when I click on submit it is not opening map app

62 Views Asked by At
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:47.6,-122.3"));
if(intent.resolveActivity(getPackageManager())!=null)
{
    startActivity(intent);
}

I Tried this ScreenShot of Adnroid studio


Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:47.6,-122.3"));
  if(intent.resolveActivity(getPackageManager())!=null)
  {
    startActivity(intent);
  }


Expecting to let me move to map app but not working

1

There are 1 best solutions below

0
On BEST ANSWER
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", 47.6, -122.3);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

Try above code