tizen_app_control 0.2.0 tizen_app_control: ^0.2.0 copied to clipboard
Tizen application control APIs. Used for launching and terminating applications on a Tizen device.
tizen_app_control #
Tizen application control APIs. Used for launching and terminating applications on a Tizen device.
Usage #
To use this package, add tizen_app_control
as a dependency in your pubspec.yaml
file.
dependencies:
tizen_app_control: ^0.2.0
Sending a launch request #
To send an explicit launch request, create an AppControl
instance with an application ID as an argument.
import 'package:tizen_app_control/tizen_app_control.dart';
var request = AppControl(appId: 'com.example.app_id');
await request.sendLaunchRequest();
To send an implicit launch request, create an AppControl
instance and specify necessary conditions, such as operation, URI, and MIME type. For example, if you want to open an image file with an image viewer app on your device,
import 'package:tizen_app_control/tizen_app_control.dart';
var request = AppControl(
operation: 'http://tizen.org/appcontrol/operation/view',
uri: 'file:///image_file_path',
mime: 'image/*',
);
await request.sendLaunchRequest();
For detailed information on Tizen application controls, see Tizen Docs: Application Controls. For a list of common operation types and examples, see Tizen Docs: Common Application Controls. Operation and data constants, such as http://tizen.org/appcontrol/operation/view
, are defined in the native API references.
Receiving a launch request #
You can subscribe to incoming application controls using AppControl.onAppControl
.
import 'package:tizen_app_control/tizen_app_control.dart';
var subscription = AppControl.onAppControl.listen((request) async {
if (request.shouldReply) {
var reply = AppControl();
await request.reply(reply, AppControlReplyResult.succeeded);
}
});
...
await subscription.cancel();
Required privileges #
Privileges may be required to perform operations requested by your app. Add required privileges in tizen-manifest.xml
of your application.
<privileges>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>
<!-- The below are optional. -->
<privilege>http://tizen.org/privilege/call</privilege>
<privilege>http://tizen.org/privilege/download</privilege>
</privileges>