I sat so long on an older SDK that just worked, that I never bothered to tinker around with runtime permissions. Now with Android 14 and the installer blocking the ability of allowing older SDK targeted apps from installing, I have to move forward.
Now I am running into problems, I am using AppUpdating 2.05 and the CheckInstallationRequirements permission always returns false no matter what.
I inserted a Log in the code above, and it just outputs false. I am running a Samsung Galaxy Tab A7 Lite, and its running the latest OneUI which is still Android 13 based.
It takes me to the unknown sources setting screen like intended, and the permission is turned ON. Turning it off and back on makes no difference.
Hitting the back arrow, brings me back to the app and just outputs a False permission and gives up.
Here is the code that calls the above subroutine:
I cant use the UDG Example project for testing because it is complaining that starter is declared twice.
Any ideas? thanks!
Now I am running into problems, I am using AppUpdating 2.05 and the CheckInstallationRequirements permission always returns false no matter what.
B4X:
'Check whether we already have permission for install other apps.
'If not we open the relevant settings page
'then wait for Activity_Resume and check the value of CanRequestPackageInstalls again
Private Sub CheckInstallationRequirements As ResumableSub
Dim p As Phone
If File.ExternalWritable = False Then
MsgboxAsync("Storage card not available. Make sure that your device is not connected in USB storage mode.", "")
Return False
Else If p.SdkVersion >= 26 And updater.CanRequestPackageInstalls = False Then
MsgboxAsync("In order to receive updates, this application requires permission to install updates to itself. Please allow access.", "")
Wait For Msgbox_Result(Result As Int)
Dim in As Intent
in.Initialize("android.settings.MANAGE_UNKNOWN_APP_SOURCES", "package:" & Application.PackageName)
StartActivity(in)
Wait For Activity_Resume '<-- wait for Activity_Resume
Log(updater.CanRequestPackageInstalls) 'Check the permission (Continues to Return False)
Return updater.CanRequestPackageInstalls
Else If updater.CheckNonMarketAppsEnabled = False Then
MsgboxAsync("Please enable installation of non-market applications." & CRLF & "Under Settings - Security - Unknown sources" _
& CRLF & "Or Settings - Applications - Unknown sources", "")
Return False
Else
Return True
End If
End Sub
I inserted a Log in the code above, and it just outputs false. I am running a Samsung Galaxy Tab A7 Lite, and its running the latest OneUI which is still Android 13 based.
It takes me to the unknown sources setting screen like intended, and the permission is turned ON. Turning it off and back on makes no difference.
Hitting the back arrow, brings me back to the app and just outputs a False permission and gives up.
Here is the code that calls the above subroutine:
B4X:
'This subs gets called after each command is executed
Sub update_UpdateComplete
Log($"UpdateComplete - time: ${DateTime.Time(DateTime.Now)}"$)
'too lazy to manage error conditions..check apkupdt.ERR_xxx codes if you like
Select updater.Status
Case updater.OK_CURVER
' Log("Running apk version: " & updater.CurVN)
updater.ReadWebVN
Case updater.OK_WEBVER
' Log("Webserver apk version: " & updater.WebVN)
' Log("Optional Change Log data: " & updater.WebChangeLog)
If updater.CurVN < updater.WebVN Then
Msgbox2Async("There is a newer version available. Do you wish to download?" & CRLF & updater.WebChangeLog, "UPDATE FOUND", "Yes", "", "No", Null, False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
ProgressDialogHide
ProgressDialogShow2("Downloading Update, Please Wait.", False)
Wait For (CheckInstallationRequirements) Complete (Result2 As Boolean)
Updating = Result2
updater.UpdateApk(Result2)
Else
AGsWJWsj 'ContinueBoot
End If
Else
AGsWJWsj 'ContinueBoot
End If
Case updater.OK_NEWERAPK
' Log("Newer version available")
Case updater.NO_NEWERAPK
' Log("No newer version available")
AGsWJWsj 'ContinueBoot
Case updater.OK_DOWNLOAD
' Log("Newer version downloaded")
Case updater.OK_INSTALL
' Log("User asked to install newer version")
Case Else
Log("Status: "&updater.Status)
' Msgbox("An error occured during the update process, Please try again later.", "Download Error")
AGsWJWsj 'ContinueBoot
End Select
End Sub
I cant use the UDG Example project for testing because it is complaining that starter is declared twice.
Any ideas? thanks!