Skip to content
This repository was archived by the owner on Jul 11, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions android/src/main/java/fr/g123k/deviceapps/DeviceAppsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ public void run() {
result.success(openAppSettings(packageName));
}
break;
case "getCurrentLauncherApp":
PackageManager localPackageManager = context.getPackageManager();
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?

.activityInfo
.packageName;
result.success(packageName);
break;
default:
result.notImplemented();
}
Expand Down
Binary file removed example/android/.idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file removed example/android/.idea/caches/gradle_models.ser
Binary file not shown.
113 changes: 0 additions & 113 deletions example/android/.idea/codeStyles/Project.xml

This file was deleted.

5 changes: 1 addition & 4 deletions example/android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 4 additions & 40 deletions example/android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/android/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions example/android/.idea/runConfigurations.xml

This file was deleted.

8 changes: 8 additions & 0 deletions lib/src/plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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

return _methodChannel
.invokeMethod<String?>('getCurrentLauncherApp')
.then((String? value) => value)
.catchError((dynamic err) => null);
}

/// Listen to app changes: installations, uninstallations, updates, enabled or
/// disabled. As it is a [Stream], don't hesite to filter data if the content
/// is too verbose for you
Expand Down