Tizen application manager API. Used for getting installed app info and getting running context info of specific app.
To use this package, add tizen_app_manager
as a dependency in your pubspec.yaml
file.
dependencies:
tizen_app_manager: ^0.1.0
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);
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.
}
To get specific app running context, create AppRunningContext
instance.
var appId = await AppManager.currentAppId;
var appContext = AppRunningContext(appId: appId);
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();
}
The following privilege is required to invoke AppRunningContext.resume()
. Add required privileges in tizen-manifest.xml
of your application.
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
</privileges>