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
 

imbault

Well-Known Member
Licensed User
Longtime User
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

trueboss323

Active Member
Licensed User
Longtime User
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

trueboss323

Active Member
Licensed User
Longtime User
I have tried that code, and it returns me an error:
B4X:
java.lang.RuntimeException: Object should first be initialized (Cursor).
 
Last edited:
Upvote 0

trueboss323

Active Member
Licensed User
Longtime User
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

trueboss323

Active Member
Licensed User
Longtime User
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…