tizen_app_manager 0.2.3 tizen_app_manager: ^0.2.3 copied to clipboard
Tizen application manager APIs. Used to get app info and app running context on a Tizen device.
tizen_app_manager #
Tizen application manager APIs. Used to get app info and app running context on a Tizen device.
Usage #
To use this package, add tizen_app_manager
as a dependency in your pubspec.yaml
file.
dependencies:
tizen_app_manager: ^0.2.3
Retrieving current app info #
To retrieve information of the current app, get app ID with AppManager.currentAppId
and then get AppInfo
with AppManager.getAppInfo
.
import 'package:tizen_app_manager/tizen_app_manager.dart';
String appId = await AppManager.currentAppId;
AppInfo appInfo = await AppManager.getAppInfo(appId);
Retrieving all apps info #
To retrieve information of all installed apps, use AppManager.getInstalledApps
.
List<AppInfo> apps = await AppManager.getInstalledApps();
for (AppInfo app in apps) {
// Handle each app's info.
}
Getting app running context #
To get a specific app's running context, create an AppRunningContext
instance with the target app ID.
String appId = await AppManager.currentAppId;
AppRunningContext appContext = AppRunningContext(appId: appId);
Monitoring app events #
You can listen for app state changes by subscribing to AppManager.onAppLaunched
and AppManager.onAppTerminated
.
var subscription = AppManager.onAppLaunched.listen((AppRunningContext context) {
String appId = context.appId;
});
...
subscription.cancel();
Required privileges #
The following privileges may be required to use this plugin. Add required privileges to tizen-manifest.xml
of your application.
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
<privilege>http://tizen.org/privilege/appmanager.kill.bgapp</privilege>
<privilege>http://tizen.org/privilege/appmanager.kill</privilege>
</privileges>
- The
http://tizen.org/privilege/appmanager.launch
privilege is required byAppRunningContext.resume()
. - The
http://tizen.org/privilege/appmanager.kill.bgapp
privilege is required byAppRunningContext.terminate(background: true)
. - The
http://tizen.org/privilege/appmanager.kill
privilege is required byAppRunningContext.terminate(background: false)
. Note that this is a platform level privilege and cannot be granted to third-party applications.