Reputation: 726
How do I resolve a shortened url (bit.ly/dfasdfasf) to the re-directed url in android?
Upvotes: 3
Views: 2087
Reputation: 8132
You would probably want to use the Bit.ly API expand
function.
From the docs:
Given a bitly URL or hash (or multiple), /v3/expand decodes it and returns back the target URL
Upvotes: 2
Reputation: 35598
You have to request the URL and then inspect the response to determine where the server is redirecting you to. You can do this by using Android's HTTP libraries or Java Sockets. Alternatively, if you know it's a bit.ly URL, you can use their API to expand the shortened url.
Upvotes: 4
Reputation: 18276
The HttpURLConnection class redirect the connection in a max of 5 jumps.
Upvotes: 1