Skip to main content
Version: v3+

start

Start from API_LEVEL 3.0 . Please refer to API_LEVEL.

Start the specified App service, return the result through the callback function.

info

permission code: device:os.bg_service

Type

function start(option: Option): Result

Parameters

Option

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
filestringY-The App Service js file must be the one configured in the module app-service in app.json3.0
paramstringN-Parameters passed in when the js file is loaded by the backend service3.0
complete_func(callbackOption: CallbackOption) => voidY-Callback function for the completion of the backend service start3.0
reloadbooleanNtrueWhether to persist and automatically restart following system running state changes. System state changes include: system restart, power saving mode entry/exit, system language changes, Mini Program updates, etc.4.0

CallbackOption

PropertyTypeDescriptionAPI_LEVEL
filestringApp service js file, same as start incoming parameters3.0
resultbooleanApp service start result, true means success, false means failure3.0

Result

TypeDescription
booleanIf the return value is 0, it indicates that the device application service has been successfully started; for the meanings of other values, refer to ERROR_CODE

ERROR_CODE

ValueTypeDescriptionAPI_LEVEL
0numberSuccess3.0
1numberParameter error3.0
2numberService Status Error3.0
3numberNo Permission3.0
4numberOut Of Memory3.0
5numberNot Supported3.0
6numberProhibited3.0
7numberThe number of services has reached the system limit3.0
255numberUnknown Error3.0

Example

import { start } from '@zos/app-service'