The Google URL Shortener API can be used on Android by using the URL Shortener Client Library for Java. To use the library, you need to first add the library to your project. You can do this by adding the following line to your build.gradle file:
dependencies {
compile 'com.google.apis:google-api-services-urlshortener:v1-rev25-1.19.0'
}
Once you have added the library to your project, you can use the URL Shortener API by creating an instance of the Urlshortener class and calling the setUrl() or setLongUrl() methods. For example:
Urlshortener urlshortener = new Urlshortener(httpTransport, jsonFactory, null);
urlshortener.setUrl("http://www.example.com");
You can also call the expand() or shorten() methods directly on the Urlshortener class. For example:
urlshortener.expand("http://goo.gl/fbsS");
urlshortener.shorten("http://www.example.com");