[บทเรียน,B4X] Get PackageName

Theera

Well-Known Member
Licensed User
Longtime User




Thank you for Alexander Stolte's code [B4X]
B4X:
Private Sub GetPackageName As String
    #If B4A
    Return Application.PackageName
    #Else If B4I
    Dim no As NativeObject
    no = no.Initialize("NSBundle").RunMethod("mainBundle", Null)
    Dim name As Object = no.RunMethod("objectForInfoDictionaryKey:", Array("CFBundleIdentifier"))
    Return name
    #Else If B4J
    Dim joBA As JavaObject
    joBA.InitializeStatic("anywheresoftware.b4a.BA")
    Return joBA.GetField("packageName")
    #End If
End Sub
 
Last edited:
Top