androiduriuribuilder

URI builder in Android, odd URL


I'm trying to use the URI builder in Android to create a URL with variables. I have read Use URI builder in Android or create URL with variables, but some symbols that I need aren't covered in that.

An example of URL that I want to create:

"https://commons.wikimedia.org/w/api.php?action=query&prop=categories|coordinates|pageprops&format=json&clshow=!hidden&coprop=type%7Cname%7Cdim%7Ccountry%7Cregion%7Cglobe&codistancefrompoint=38.11386944444445%7C13.356263888888888&generator=geosearch&redirects=&ggscoord=38.11386944444445%7C13.356263888888888&ggsradius=100&ggslimit=10&ggsnamespace=6&ggsprop=type%7Cname%7Cdim%7Ccountry%7Cregion%7Cglobe&ggsprimary=all&formatversion=2"

I will want to substitute the ggscoord with a variable. I know how to append the path and query parameters... but what builder method should I use for the %7C and | ?


Solution

  • In order to modify query, you may use appendQueryParameter for plain strings like "|", any you may use encodedQuery for pre-encoded strings like "%7C".

    There is no append method for pre-encoded query parameters.