Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiDemoFiremonkeyShowcaseUtility

App Launcher With Full Source Code For Delphi XE7 Firemonkey On Android

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

Delphi XE7 Firemonkey Android Package List | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSOne problem you can have on Android as a user and/or Delphi XE7 Firemonkey developer is having to swipe through pages and pages of icons to find that app you want to launch because you have so many apps installed on the device. One solution to this problem is demonstrated in this demo app called AppList. Basically it has a filterable list of all of the apps installed on your phone which easily allows you to find and launch the right app. You can type in a few letters and launch the app Instead of swiping through pages and pages of icons to find what you want. It acts similar to how the Start|Run search functionality works on Windows. It cost me $100 to have this app built through oDesk. There are three different pieces of functionality demonstrated in the app. These pieces are reading the list of installed apps on the device, loading and caching the icon for each app, and launching the app itself. The functionality in this app is Android specific so it won’t compile for the other platforms (Windows, IOS, or Mac OSX) because it uses the Android specific JNI. This code should also work in Appmethod. Here is the function for launching an app on Android:
procedure TformMain.OpenApp(PackageName, AppName : JString);
var
Intent : JIntent;
NativeComponent : JComponentName;
begin
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_MAIN);
Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);
NativeComponent := TJComponentName.JavaClass.init(PackageName, AppName);
Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
Intent.setComponent(NativeComponent);
SharedActivity.startActivity(Intent);
end;

Here is the function for listing the apps installed on the device:
function TformMain.GetActivityAppList: JList;
var
tempList : JList;
Intent : JIntent;
Manager : JPackageManager;
begin
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_MAIN);
Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);
Manager := SharedActivity.getPackageManager;
tempList := nil;
tempList := Manager.queryIntentActivities(Intent, 0);
Result := tempList;
end;

And you’ll have to download the demo itself to get the code for reading and caching the icon for each app.

Download the full source code for the Android app list launcher for Delphi XE7 Firemonkey.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

2 Comments

Leave a Reply