mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-18 05:09:15 +00:00
Intmex multiventa
This commit is contained in:
73
B4A/C_UpdateAvailable.bas
Normal file
73
B4A/C_UpdateAvailable.bas
Normal file
@@ -0,0 +1,73 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=11.5
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
'load the layout to Root
|
||||
Root.Color = Colors.Transparent
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Try
|
||||
Do While Not(CanRequestPackageInstalls)
|
||||
MsgboxAsync($"Por favor permita que ${Application.PackageName} instale actualizaciones"$, "Instalar actualización")
|
||||
Wait For Msgbox_Result(Result As Int)
|
||||
Dim in As Intent
|
||||
in.Initialize("android.settings.MANAGE_UNKNOWN_APP_SOURCES", "package:" & Application.PackageName)
|
||||
StartActivity(in)
|
||||
Loop
|
||||
Catch
|
||||
Log("updateAvailable() Error - " & LastException.Message)
|
||||
End Try
|
||||
If appUpdater.newApp.update Then
|
||||
ofreceActualizacion
|
||||
Else
|
||||
sinActualizacion
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'////////////////////////////////////////////////////////////////////////////////////////////
|
||||
'//// Esta es una actividad usada por el servicio appUpdater para mostrar notificaciones
|
||||
'//// cuando hay alguna actualizacion de apk.
|
||||
'////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Sub CanRequestPackageInstalls As Boolean
|
||||
' // https://www.b4x.com/android/forum/threads/version-safe-apk-installation.87667/#content
|
||||
Dim ctxt As JavaObject
|
||||
ctxt.InitializeContext
|
||||
Dim PackageManager As JavaObject = ctxt.RunMethod("getPackageManager", Null)
|
||||
Return PackageManager.RunMethod("canRequestPackageInstalls", Null)
|
||||
End Sub
|
||||
|
||||
Sub ofreceActualizacion
|
||||
If Msgbox2(appUpdater.newApp.newMsg,"Actualización disponible","Si","","No",Null) = DialogResponse.Positive Then 'ignore
|
||||
' StartService(DownloadService)
|
||||
CallSubDelayed(appUpdater, "download_newApk")
|
||||
End If
|
||||
B4XPages.MainPage.ocultaProgreso
|
||||
StartActivity(Main)
|
||||
' Activity.Finish
|
||||
B4XPages.ShowPage("Login")
|
||||
End Sub
|
||||
|
||||
Sub sinActualizacion
|
||||
Msgbox(appUpdater.newApp.okMsg, "Aplicación al corriente") 'ignore
|
||||
' StartActivity(Main)
|
||||
B4XPages.MainPage.ocultaProgreso
|
||||
B4XPages.ShowPage("Login")
|
||||
End Sub
|
||||
Reference in New Issue
Block a user