Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Get Your App Icon With Delphi XE5 Firemonkey On Android And Windows

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Android APK Icon | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSChris Rolliston put up a blog post about a month ago that has some sample code for accessing the icon from your Android APK file and your Windows binary file. The original blog post (here) only supported Android but then he made a second blog post which supports getting the icon file from your binary on Windows as well as the APK on Android. It uses the PackageManager API on Android which is actually a pretty powerful API that lets you access all of the information about all of the packages installed on the device (if you have the right permissions). You could for example read the icons of other packages on the device (using the getApplicationIcon() function) and use them within Delphi XE5 Firemonkey. The function for accessing a list of all the apps installed on the device is called getInstalledApplications(). The core of the get app icon code is:

  Activity := SharedActivity;
  Drawable := Activity.getPackageManager.getApplicationIcon(Activity.getApplicationInfo);
  Bitmap := TJBitmapDrawable.Wrap((Drawable as ILocalObject).GetObjectID).getBitmap;

 
Head over and view the full source of the function on his blog to access the app icon on Android.

Exit mobile version