For the following code, why does appendQueryParameter
open the correct given location but query
does not?:
String address = "Mountain View, California, United States";
Uri.Builder builder = new Uri.Builder();
builder.scheme("geo")
.path("0,0")
// here appendQueryParameter launches external Google Maps app with correct location but
// query(address) has the wrong location (user's current location), why?
.appendQueryParameter("q", address);
Uri uri = builder.build();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
Android documentation for appendQueryParameter says:
Encodes the key and value and then appends the parameter to the query string.
Whilst documentation for query says:
Encodes and sets the query.
Could the problem with query
be due to the tag it uses? What tag would it be using?