Android Question Detecting website address

trueboss323

Active Member
Licensed User
Longtime User
Is there a way to figure out what website the user is currently on? Regardless of which browser is being used i.e chrome, firefox
 
Ping the site.
Try to get data from the site, using an HTTP GET if it's offline, it will throw an error.
 
Upvote 0
Hi,
Do you have an example code of how I can do that? But my question was that I want to get the CURRENT address or webpage the user is on, not figure out if it's online or not.
 
Upvote 0
I have tried that code, and it returns me an error:
Code:
java.lang.RuntimeException: Object should first be initialized (Cursor).
 
Last edited:
Upvote 0
and it returns me an error
Do you set the right permission in your manifest?
Code:
AddPermission(com.android.browser.permission.READ_HISTORY_BOOKMARKS)
 
Upvote 0
Thank you Erel. I'm not sure though why this wouldn't work with some devices.

I have also tried coming up with another way, this time I check if any browser is running in the foreground, and if it is could I get the tab title at least. Is that possible?
 
Upvote 0
Hi Erel, I have tried testing this code again, and I got it working finally! But it only seems this would work on Chrome. Previously I had the Chrome app disabled which is why it kept giving me that crash. So right now I am using Firefox, is there anyway I can get this to work with Firefox?
 
Upvote 0
Back
Top