我有一个缩短的url完成http://goo.gl/ 我需要得到原始的网址。在ANDROID中有没有这样做?谷歌URL缩短解码android
我试做短什么 -
编译 'com.andreabaccega:googlshortenerlib:1.0.0'
GoogleShortenerPerformer shortener = new GoogleShortenerPerformer(new OkHttpClient());
String longUrl = "http://www.andreabaccega.com/";
GooglShortenerResult result = shortener.shortenUrl(
new GooglShortenerRequestBuilder()
.buildRequest(longUrl)
);
if (Status.SUCCESS.equals(result.getStatus())) {
// all ok result.getShortenedUrl() contains the shortened url!
} else if (Status.IO_EXCEPTION.equals(result.getStatus())) {
// connectivity error. result.getException() returns the thrown exception while performing
// the request to google servers!
} else {
// Status.RESPONSE_ERROR
// this happens if google replies with an unexpected response or if there are some other issues processing
// the result.
// result.getException() contains a GooglShortenerException containing a message that can help resolve the issue!
}
为了什么,我得到了反对票的人吗? – Anirban
如果你不能帮助,请不要给予否定的投票。我没有相关的解决方案,我搜索了近2个小时,这就是为什么我问。 – Anirban