tizen_app_manager 0.1.1 tizen_app_manager: ^0.1.1 copied to clipboard
Tizen application manager APIs. Used to get application info and app running context on a Tizen device.
tizen_app_manager #
Tizen application manager API. Used for getting installed app info and getting running context info of specific app.
Usage #
To use this package, add tizen_app_manager
as a dependency in your pubspec.yaml
file.
dependencies:
tizen_app_manager: ^0.1.1
Retrieving current app info #
To retrieve information of the current app, get app ID with currentAppId
and then get AppInfo
with getAppInfo
method.
var appId = await AppManager.currentAppId;
var appInfo = await AppManager.getAppInfo(appId);
Retrieving all apps info #
To retrieve information of all apps installed on a Tizen device, use getInstalledApps
method.
var apps = await AppManager.getInstalledApps();
for (var app in apps) {
// Handle each app's info.
}
Getting app running context #
To get specific app running context, create AppRunningContext
instance.
var appId = await AppManager.currentAppId;
var appContext = AppRunningContext(appId: appId);
Monitoring app events #
You can listen for app state change by subscribing to the stream.
final List<StreamSubscription<AppRunningContext>> _subscriptions =
<StreamSubscription<AppRunningContext>>[];
@override
void initState() {
super.initState();
_subscriptions.add(AppManager.onAppLaunched
.listen((AppRunningContext event) {
// Handle the launched event.
...
event.dispose();
}));
_subscriptions.add(AppManager.onAppTerminated
.listen((AppRunningContext event) {
// Handle the terminated event.
...
event.dispose();
}));
}
@override
void dispose() {
super.dispose();
_subscriptions.forEach((StreamSubscription subscription) => subscription.cancel());
_subscriptions.clear();
}
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.