Use this code, put it into a class named RequestDrawOverPermission like described.
Getting closer.
Thanks for the reply. After creating a standard class module and moving the new coding over there I could compile and run the app. When I ran the app, it was taken to a list of apps where I can give the permission but my app was not in the list. I had already added SYSTEM_ALERT_WINDOW into the manifest editor based on the linked post. After looking at the coding from the post, I took a guess I also needed MANAGE_OVERLAY_PERMISSION in there as well. When I ran the app again my app was there in the list to turn on the permission.
The manifest editor now has these 2 new lines.
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
AddPermission(android.permission.MANAGE_OVERLAY_PERMISSION)
I have several log statements in the app and noticed the service module that I use to start to make the app screen display has this coding in the Service_Start procedure:
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
Log("About to call setup procedure.")
CallSub(Main, "Setup")
End Sub
I'm also using #StartAtBoot: true so the service module is loading up which I can see in the logs.
In the B4XMainPage I have this coding:
public Sub Setup
Log("At Setup procedure.")
Root.LoadLayout("MainPage")
WebViewABRICC.LoadUrl("https://mawaqit.net/en/abricc-acton-01720-united-states")
WebViewABRICC.Height = Root.Height
WebViewABRICC.Width = Root.Width
ImageViewABRICC.Height = Root.Height
ImageViewABRICC.Width = Root.Width
End Sub
The Log("At Setup procedure.") statement is not executed when I restart my test development phone. If I just start the app by tapping the app icon, then that log statement is executed. I also do know that the service module is starting because the Log("About to call setup procedure.") statement executes, but not the Setup procedure in B4XMainPage. Is there a Wait For I can use to wait until B4XMainPage actually starts before calling the Setup procedure?
Since this app is not large, I can post all of the code if that helps.