Tizen application manager APIs. Used to get app info and app running context on a Tizen device.
To use this package, add tizen_app_manager
as a dependency in your pubspec.yaml
file.
dependencies:
tizen_app_manager: ^0.2.3
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);
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.
}
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);
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();
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.