README.md
1# ServiceAbility
2
3### Introduction
4
5This sample shows how to create and use a Service ability in eTS.
6
7### Usage
8
91. After the sample app is started, touch **Connect service**. When the Service ability is connected, a message is displayed.
10
112. Enter a string in the text box on the screen and touch **Sort string**. The string is sent to the Service ability. The Service ability sorts the string and returns the string after sorting, which is then displayed in the text box
12
133. Click **Disconnect service**. After the Service ability is disconnected, a message is displayed.
14
15### Constraints
16
17This sample can only be run on standard-system devices.
18
README_zh.md
1# ServiceAbility的创建与使用
2
3### 简介
4
5本示例展示了ServiceAbility的创建与使用。效果图如下:
6
7
8
9### 相关概念
10
11ServiceAbility:基于Service模板的Ability(以下简称“Service”)主要用于后台运行任务(如执行音乐播放、文件下载等),但不提供用户交互界面。Service可由其他应用或Ability启动。即使用户切换到其他应用,Service仍将在后台继续运行。
12
13### 相关权限
14
15不涉及。
16
17### 使用说明
18
191.启动应用后,点击**连接服务**,连接Service成功后会弹出提示。
20
212.连接服务成功后,在界面上输入框中输入一个字符串,点击**字符串排序**会将字符串发送到Service中,Service对字符串做排序处理后返回给当前应用界面并显示在文本框中。
22
233.点击**断开服务**,断开Service后会弹出提示。
24
25### 约束与限制
26
271.本示例仅支持标准系统上运行。
28
292.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
30