Android Question PackageManager

D

Deleted member 103

Guest
Hi,

how can I convert this B4a functions in B4i?
Thank you.

B4X:
Sub getVersion As String
    Dim pm As PackageManager
    Return pm.GetVersionName(GetPackageName)
End Sub

Sub GetVersionCode As Int
    Dim pm As PackageManager
    Return pm.GetVersionCode(GetPackageName)
End Sub

Sub GetApplicationLabel As String
    Dim pm As PackageManager
    Return pm.GetApplicationLabel(GetPackageName)
End Sub

Sub GetPackageName As String
   Dim r As Reflector
   Return r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
You dont have these Values in a B4J Application i believe
B4X:
#Region  Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 400
#End Region
And there are no "packages" installed in Windows as this came from the base of android.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
For your own Program you could simple use
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Public VersionName As String = "v1.2.345"
    Public VersionCode As Int = 123
    Public ApplicationLabel As String = "My great Appname"
End Sub
but i think there is no way to get other java-apps name or versioncode
 
Upvote 0
Top