Android Question Check the source where an app was installed from

KMatle

Expert
Licensed User
Is it possible to check (within the app by code) which the source was the app was installed from? (Google Play or other)
 

Erel

Administrator
Staff member
Licensed User
B4X:
Sub GetInstallerPackageName As String
   Dim jo As JavaObject
   jo.InitializeContext
   jo = jo.RunMethod("getPackageManager", Null)
   Dim o As Object = jo.RunMethod("getInstallerPackageName", Array(Application.PackageName))
   If o = Null Then Return "N/A" Else Return o
End Sub
 

HAH

Active Member
Licensed User
Is this code suitable and not hackable for paid app, so it should not installed from other sources like copying ...
Or there is another and better scenario?
 

Erel

Administrator
Staff member
Licensed User
It is "hackable". A hacker can remove this check or modify it as needed. It is also possible to change the "installer package name" with ADB.
 
Top