Hi everyone, today I experienced an issue.
My app makes some checks online when it starts. But the first time a dialog is prompted asking to the user to allow the app to go on internet.
the dialog is not blocking! so my program will still going in the background, failing the checks because it has not the access to the network.
There is a way to wait the user to answer?
And, there is a way to show up this dialog again if the user miss-click and tap on "not allow"?
Hi everyone, today I experienced an issue.
My app makes some checks online when it starts. But the first time a dialog is prompted asking to the user to allow the app to go on internet. View attachment 106269
the dialog is not blocking! so my program will still going in the background, failing the checks because it has not the access to the network.
There is a way to wait the user to answer?
And, there is a way to show up this dialog again if the user miss-click and tap on "not allow"?
I had the same problem. On start I need to download privacy statement from the web site to show on the screen. My problem was that I sent a POST request to the server that pulled privacy statement from the web site and replied with html.
I fixed it by pulling statement directly from the web site by using DownLoadString which works regardless of the user's answer.
Check if it will work for you. If you need to send a POST request - The only thing I see is to create some new form that will be shown as a first screen that doesn't do anything on the Internet. So before you will go to the Internet your user will allow Internet connection.
I had the same problem. On start I need to download privacy statement from the web site to show on the screen. My problem was that I sent a POST request to the server that pulled privacy statement from the web site and replied with html.
I fixed it by pulling statement directly from the web site by using DownLoadString which works regardless of the user's answer.
Check if it will work for you. If you need to send a POST request - The only thing I see is to create some new form that will be shown as a first screen that doesn't do anything on the Internet. So before you will go to the Internet your user will allow Internet connection.
.Download method works for me - I see downloaded string even before allowed Internet connection
B4X:
Private Sub GetLegal
Try
Dim j As HttpJob
Dim str As String
hud.ProgressDialogShow("Starting")
j.Initialize("",Me)
j.Download("https://www.hcms-evv.com/medical-billing-services-terms-of-use")
Wait For(j) JobDone(j As HttpJob)
If j.Success Then
str=j.GetString
TOSStr=str
wvTOS.LoadHtml(str)
Else
Msgbox("Please check your Internet connection or allow the Network connection and restart the application.","HCMS")
str="NoConnection"
End If
j.Release
If str="NoConnection" Then
hud.ProgressDialogHide
Return
End If
Dim j As HttpJob
Dim str As String
j.Initialize("",Me)
j.Download("https://www.hcms-evv.com/medical-billing-services-privacy-policy")
Wait For(j) JobDone(j As HttpJob)
If j.Success Then
str=j.GetString
PrivacyStr=str
Else
Msgbox("Please check your Internet connection","HCMS")
End If
j.Release
hud.ProgressDialogHide
If TOSAccepted=False Then
btnNext.Text="Accept Terms Of Use"
pg.Title="Terms of Use"
End If
Catch
Log("Leagal_GetLegal " & LastException.description)
End Try
End Sub
Can you please show your code requesting the permission? I don't know what kind of permission you request but I solved a similar problem for the GPS/location permission request.
Can you please show your code requesting the permission? I don't know what kind of permission you request but I solved a similar problem for the GPS/location permission request.
.Download method works for me - I see downloaded string even before allowed Internet connection
B4X:
Private Sub GetLegal
Try
Dim j As HttpJob
Dim str As String
hud.ProgressDialogShow("Starting")
j.Initialize("",Me)
j.Download("https://www.hcms-evv.com/medical-billing-services-terms-of-use")
Wait For(j) JobDone(j As HttpJob)
If j.Success Then
str=j.GetString
TOSStr=str
wvTOS.LoadHtml(str)
Else
Msgbox("Please check your Internet connection or allow the Network connection and restart the application.","HCMS")
str="NoConnection"
End If
j.Release
If str="NoConnection" Then
hud.ProgressDialogHide
Return
End If
Dim j As HttpJob
Dim str As String
j.Initialize("",Me)
j.Download("https://www.hcms-evv.com/medical-billing-services-privacy-policy")
Wait For(j) JobDone(j As HttpJob)
If j.Success Then
str=j.GetString
PrivacyStr=str
Else
Msgbox("Please check your Internet connection","HCMS")
End If
j.Release
hud.ProgressDialogHide
If TOSAccepted=False Then
btnNext.Text="Accept Terms Of Use"
pg.Title="Terms of Use"
End If
Catch
Log("Leagal_GetLegal " & LastException.description)
End Try
End Sub
i did like so, the message still appear on first time, and if i did not answer the question, the app still tries to connect, but, it can't because i did not allowed it to go on internet yet
i did like so, the message still appear on first time, and if i did not answer the question, the app still tries to connect, but, it can't because i did not allowed it to go on internet yet
When an app starts, it can send broadcast UDP packet and to wait UDP_PacketArrived.
If there is no response during some seconds, repeat UDP packet . If there is no response during, let's say, 1 minute, this means that user did not allow access or did not reply to question.
When an app starts, it can send broadcast UDP packet and to wait UDP_PacketArrived.
If there is no response during some seconds, repeat UDP packet . If there is no response during, let's say, 1 minute, this means that user did not allow access or did not reply to question.
Apple does not offer public API to manipulate with this permission. User can reset a permission outside your program (using Settings).
In these conditions an app can do following. When starts, it sends UDP package and shows a splash screen. If no UDP_PacketArrived during 1-2 seconds an app shows a warning in the midddle of splash screen with a text (Please, allow access to local network).
Imagine the first start of the app. User will see a system dialog only (which will cover your warning). If user will not allow access, he will see your message only.
Apple does not offer public API to manipulate with this permission. User can reset a permission outside your program (using Settings).
In these conditions an app can do following. When starts, it sends UDP package and shows a splash screen. If no UDP_PacketArrived during 1-2 seconds an app shows a warning in the midddle of splash screen with a text (Please, allow access to local network).
Imagine the first start of the app. User will see a system dialog only (which will cover your warning). If user will not allow access, he will see your message only.