Android Question detecting if the default browser is active

tkristensen

Member
Licensed User
Longtime User
Thanks in advance...

I need to detect from within my app (in the kiosk service most likely) whether the tablets default browser is active.

I have tried the operatingsystem library and the activitymanager library, but I am not seeing anything that i recognize as the default browser showing the returned tasks or services.

Any ideas?

Thanks again
 

tkristensen

Member
Licensed User
Longtime User
If you are creating a kiosk app then it will be easier to use an internal WebView instead.

Agreed, and the app was written using the internal webview, however there is a problem. The internal webview is not working properly with the specific site that we have to connect with in this app, however the default browser is. This is anecdotal at this point, since this site is governed by HIPPA rules and I do not have patient information to actually use the site... it is just being reported to me. Specifically, they are not able to successfully register on the site using the webview but are able to using the default browser, so I am scambling to get a working solution in place.

I have tried using the Chrome client in webviewextras but it did not change the behaviour.

Of note, this is with B4A 4.30 if that makes any difference.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can play with this code:
B4X:
Sub Process_Globals
   Private t As Timer
   Private activityManager As JavaObject
End Sub

Sub Service_Create
   t.Initialize("t", 1000)
   t.Enabled = True
   activityManager = activityManager.InitializeContext.RunMethodJO("getSystemService", Array("activity"))
End Sub

Sub t_Tick
   Log("****************")
   Dim tasks As List = activityManager.RunMethod("getRunningTasks", Array As Object(5))
   For Each task As JavaObject In tasks
     Log(task.GetFieldJO("topActivity").RunMethod("getPackageName", Null))
   Next
End Sub
It doesn't seem to show other tasks in Android 6.
 
Upvote 0
Top