Hi, reading the info from an APK file - NOT an installed app!!!
Using this code i can see the packageName, versionName, versionCode?!? And in most cases the apps Icon, But I want the application title (The one shown by the launcher and in the title bar on most apps)
How can I get the app title? and why is the icon hit and miss?
I have added a small project to play with!
The first person to post the working code will be sent 10 euros via paypal!
Thanks!
Using this code i can see the packageName, versionName, versionCode?!? And in most cases the apps Icon, But I want the application title (The one shown by the launcher and in the title bar on most apps)
B4X:
Dim icon As BitmapDrawable
Dim r, r2 As Reflector
Dim packageName, fullpath As String
File.Copy(File.DirAssets,"b4a_bridge.apk",File.DirInternal,"b4a_bridge.apk")
fullpath = File.Combine(File.DirInternal, "b4a_bridge.apk")
r.Target = r.GetContext
r.Target = r.RunMethod("getPackageManager") ' PackageManager
r2.Target = r.RunMethod3("getPackageArchiveInfo", fullpath , "java.lang.String", 1, "java.lang.int") ' List<PackageInfo>
packageName=r2.GetField("packageName")
Log(r2.GetField("packageName"))
Log(r2.GetField("versionName"))
Log(r2.GetField("versionCode"))
'Log(r2.GetField("applicationLabel")) Trying to get the - App Title?!
r2.Target=r2.GetField("applicationInfo")
r2.SetField("publicSourceDir",fullpath , "java.lang.String")
r2.SetField("sourceDir",fullpath , "java.lang.String")
Try
icon=r.RunMethod4("getApplicationIcon", Array As Object(r2.Target), Array As String("android.content.pm.ApplicationInfo"))
Msgbox2(packageName, "packageIcon", "Close", "", "", icon.Bitmap)
Catch
Log("Error / No Image")
End Try
How can I get the app title? and why is the icon hit and miss?
I have added a small project to play with!
The first person to post the working code will be sent 10 euros via paypal!
Thanks!
Attachments
Last edited: