DVApps class
The apps installed on this device that can be launched, and opening them.
Android only, through JNI: no other platform lets one app see and start the others. Elsewhere isSupported is false and the calls throw UnsupportedError, so an application can show its own message rather than an empty list that looks like a device with no apps.
Seeing other apps needs the <queries> declaration Android 11 requires,
which dartvel.android.launcher: true writes into the manifest.
Constructors
- DVApps()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
homeAppSignals
→ Stream<
DVHomeAppSignal> -
Everything the system tells this home app, as it happens: Home,
Recents, the reason of each close-system-dialogs broadcast, pauses,
stops, focus changes and what the Recents service sees. Phones differ
in what they send for the Recents button; a diagnostics screen that
lists these shows what one phone really does. Empty where the app is
not an Android home app.
no setter
-
homePresses
→ Stream<
void> -
One event each time the person presses Home and lands on this app as
the phone's home app: while it is already in front (where a launcher
closes its drawer and goes back to its first page) and when Home brings
it back from another app.
no setter
-
isNotificationAccessOn
→ Future<
bool> -
Whether the person gave this app notification access (the badge
service). False where there is none.
no setter
-
isRecentsServiceOn
→ Future<
bool> -
Whether the person has turned on this app's Recents service
(
dartvel.android.recentsService: true), the accessibility service that shows the app's own Recents in place of the system's. False where there is none.no setter - isSupported → bool
-
Whether this platform can list and open installed apps.
no setter
-
notificationCounts
→ Stream<
Map< String, int> > -
How many notifications each app is showing, by package, for badges on
its icon: what is showing when listening starts, then each change.
Ongoing ones (music, downloads) and those whose channel turned badges
off are not counted. Needs
dartvel.android.notificationBadges: trueand the person's notification access (isNotificationAccessOn); until then it is one empty map.no setter -
packageChanges
→ Stream<
DVPackageChange> -
One event for each app installed, uninstalled, updated or changed while
this home app runs, as Android broadcasts it: a launcher's drawer
follows at once instead of waiting to be brought back to the front.
Empty where the app is not an Android home app.
no setter
-
recentsPresses
→ Stream<
void> -
One event each time the person presses Recents while this home app is
in front and the system shows nothing over it.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
defaultFor(
DVAppRole role) → Future< String?> -
The app the phone opens for
role, as the person set it: their default browser for a web link, their messaging app for a text. When no default is set, the first app that handles the role; null when none does. A launcher builds its dock from these rather than from a list of package names, which is wrong on every phone where someone chose another app. -
expandNotifications(
) → Future< bool> - Pulls down the phone's notification shade, as a swipe down on a home screen does. False when the phone would not (or nothing answers).
-
icon(
String packageName) → Future< Uint8List?> -
packageName's launcher icon as PNG bytes, or null when it cannot be drawn. One at a time, so a launcher can list names withlist(icons: false)at once and fill icons in after the first frame. -
isDefaultLauncher(
) → Future< bool> -
Whether this app is the phone's home app (what the home button opens).
Needs
dartvel.android.launcher: truein pubspec.yaml to ever be true. -
list(
{bool icons = true}) → Future< List< DVInstalledApp> > -
Every launchable app, sorted by name ignoring case.
iconsfalse skips drawing the icons, which is most of the cost on a phone with many apps. -
lockScreen(
) → Future< bool> -
Locks the screen, as a double tap on a home screen does on most
launchers. Android lets an app lock the screen only through an
accessibility service the person turned on: here the opt-in Recents
service (
dartvel.android.recentsService: true). False while it is off; openRecentsServiceSettings is where the person turns it on. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String packageName) → Future< void> -
Starts the app
packageNamethe way tapping its icon would. -
openNotificationAccessSettings(
) → Future< void> - Opens the system page where the person gives this app notification access. Android lets no app give it to itself.
-
openRecentsServiceSettings(
) → Future< void> - Opens the system's Accessibility settings, where the person turns the Recents service on or off. Android lets no app turn it on itself.
-
openSettings(
String packageName) → Future< void> -
Opens the system's info page for
packageName: storage, permissions, force stop. -
openShortcut(
DVInstalledAppShortcut shortcut) → Future< void> -
Starts
shortcutthe way the app's own launcher entry would. -
openSystemSettings(
[DVSystemSettingsPage page = DVSystemSettingsPage.main]) → Future< void> -
Opens
pageof the phone's own Settings. -
pickWallpaper(
) → Future< void> - Opens the phone's wallpaper picker (its own, or a chooser of the apps that set wallpapers).
-
requestDefaultLauncher(
) → Future< void> - Asks the person to make this app the phone's home app. Android has no permission for it: the system shows its own question (Android 10 and later) or its Home app settings, and the person decides. Check isDefaultLauncher again when the app is resumed.
-
shortcuts(
String packageName) → Future< List< DVInstalledAppShortcut> > -
packageName's own shortcuts (static ones from its manifest and the dynamic ones it publishes), in the app's order, as every launcher shows them on a long press. Android's LauncherApps answers only the phone's home app: anything else gets a StateError that says so. Unsupported where there is no home-app activity to ask (not Android, an older build). -
toString(
) → String -
A string representation of this object.
inherited
-
uninstall(
String packageName) → Future< void> -
Asks the system to uninstall
packageName. The system shows its own confirmation; nothing is removed without it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited