Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Added support for getting the current launcher app package #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gyuri-fluttech
Copy link

No description provided.

@g123k
Copy link
Owner

g123k commented Apr 1, 2022

Hello, I'm not sure to understand the goal of this PR.
You want to know the package name of the current app?

@gyuri-fluttech
Copy link
Author

This adds support for getting the package name of the current launcher app. (e.g.: https://www.tomsguide.com/round-up/best-android-launchers)

@@ -139,6 +139,14 @@ class DeviceApps {
.catchError((dynamic err) => false);
}

/// Get the current Launcher app's package name
static Future<String?> getCurrentLauncherApp() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename the method to getCurrentDeviceLauncherApp?
Because I find the current name misleading

Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
String packageName = localPackageManager
.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResolveActivity may return null.
Could you handle this case please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants