Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 2.13 KB

README.md

File metadata and controls

88 lines (64 loc) · 2.13 KB

tizen_app_manager

pub package

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.0

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 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>