Ok, I will explain because it could be weird, but I code an Application to help paperboy to be track on a map, so the manager can find him to restock and find easily at the end of the day.
So we install the app on our phone with a ID and at the beginning of the day, we give a phone to every paperboy. But, we don't want him to go in the status bar and remove the network or the positioning. In the passed I used this:
You will need to add those permissions into your Manifest:
in the Activity:
But in Android 11 it is not working anymore. what I can do now?
So we install the app on our phone with a ID and at the beginning of the day, we give a phone to every paperboy. But, we don't want him to go in the status bar and remove the network or the positioning. In the passed I used this:
You will need to add those permissions into your Manifest:
AddPermission(android.permission.SYSTEM_OVERLAY_WINDOW)
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
in the Activity:
#Region Code to disable access to the StatusBar
'Code translated by Erel:
'https://www.b4x.com/android/forum/threads/overlay-over-the-status_bar.49221/#post-309833
'Original source code:
'http://stackoverflow.com/questions/9815901/display-view-above-status-bar/25384365#25384365
Sub AddOverlay
Dim mView As Label
mView.Initialize("")
mView.Text = Sentence
Dim mlp As JavaObject
Dim vtype As Int = -1, pixelFormat As Int = -3
mlp.InitializeNewInstance("android.view.WindowManager$LayoutParams", Array(vtype, 100, 2010,296, pixelFormat))
mlp.SetField("gravity", Bit.OR(Gravity.TOP, Gravity.CENTER))
Dim windowManager As JavaObject = GetContext.RunMethod("getSystemService", Array("window"))
windowManager.RunMethod("addView", Array(mView, mlp))
End Sub
Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub
#End Region
But in Android 11 it is not working anymore. what I can do now?