openharmony 鸿蒙 api-model-switch

2025-06-12 浏览 (1)

API Model Conversion List

Certain APIs are available only in the FA model. To switch to the stage model, an adaptation is required. This topic lists these APIs and their substitutes in the stage model.

Context APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
getOrCreateLocalDir(callback:AsyncCallback<string>):void;
getOrCreateLocalDir():Promise<string>;
There is no corresponding API in the stage model.Applications developed on the stage model do not have the operation permission in the application root directory. Therefore, no corresponding API is provided.
verifyPermission(permission:string,options:PermissionOptions,callback:AsyncCallback<number>):void;
verifyPermission(permission:string,callback:AsyncCallback<number>):void;
verifyPermission(permission:string,options?:PermissionOptions):Promise<number>;
@ohos.abilityAccessCtrl.d.tsverifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<GrantStatus>;
requestPermissionsFromUser(permissions:Array<string>,requestCode:number,resultCallback:AsyncCallback<PermissionRequestResult>):void;
requestPermissionsFromUser(permissions:Array<string>,requestCode:number):Promise<PermissionRequestResult>;
@ohos.abilityAccessCtrl.d.tsrequestPermissionsFromUser(context: Context, permissionList: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void;
requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>) : Promise<PermissionRequestResult>;
getApplicationInfo(callback:AsyncCallback<ApplicationInfo>):void;
getApplicationInfo():Promise<ApplicationInfo>;
application\Context.d.tsapplicationInfo: ApplicationInfo;
getBundleName(callback : AsyncCallback<string>): void;
getBundleName(): Promise<string>;
application\UIAbilityContext.d.tsabilityInfo.bundleName: string;
getDisplayOrientation(callback : AsyncCallback<bundle.DisplayOrientation>): void;
getDisplayOrientation(): Promise<bundle.DisplayOrientation>;
@ohos.screen.d.tsreadonly orientation: Orientation;
setDisplayOrientation(orientation:bundle.DisplayOrientation, callback:AsyncCallback<void>):void;
setDisplayOrientation(orientation:bundle.DisplayOrientation):Promise<void>;
@ohos.screen.d.tssetOrientation(orientation: Orientation, callback: AsyncCallback<void>): void;
setOrientation(orientation: Orientation): Promise<void>;
setShowOnLockScreen(show:boolean, callback:AsyncCallback<void>):void;
setShowOnLockScreen(show:boolean):Promise<void>;
@ohos.window.d.tssetShowOnLockScreen(showOnLockScreen: boolean): void;
setWakeUpScreen(wakeUp:boolean, callback:AsyncCallback<void>):void;
setWakeUpScreen(wakeUp:boolean):Promise<void>;
@ohos.window.d.tssetWakeUpScreen(wakeUp: boolean): void;
getProcessInfo(callback:AsyncCallback<ProcessInfo>):void;
getProcessInfo():Promise<ProcessInfo>;
@ohos.app.ability.abilityManager.d.tsgetAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
getElementName(callback:AsyncCallback<ElementName>):void;
getElementName():Promise<ElementName>;
application\UIAbilityContext.d.tsabilityInfo.name: string;
abilityInfo.bundleName: string;
getProcessName(callback:AsyncCallback<string>):void;
getProcessName():Promise<string>;
@ohos.app.ability.abilityManager.d.tsgetAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
getCallingBundle(callback:AsyncCallback<string>):void;
getCallingBundle():Promise<string>;
There is no corresponding API in the stage model.Applications developed on the stage model can use the ohos.aafwk.param.callerUid parameter of Want.parameters to obtain the application information of the caller.
getFilesDir(callback:AsyncCallback<string>):void;
getFilesDir():Promise<string>;
application\Context.d.tsfilesDir: string;
getCacheDir(callback:AsyncCallback<string>):void;
getCacheDir():Promise<string>;
application\Context.d.tscacheDir: string;
getOrCreateDistributedDir(callback:AsyncCallback<string>):void;
getOrCreateDistributedDir():Promise<string>;
application\Context.d.tsdistributedFilesDir: string;
getAppType(callback:AsyncCallback<string>):void;
getAppType():Promise<string>;
application\UIAbilityContext.d.tsThe stage model obtains the application type through the type attribute of the abilityInfo field.
abilityInfo.type: bundleManager.AbilityType;
getHapModuleInfo(callback:AsyncCallback<HapModuleInfo>):void;
getHapModuleInfo():Promise<HapModuleInfo>;
application\UIAbilityContext.d.tscurrentHapModuleInfo: HapModuleInfo;
getAppVersionInfo(callback:AsyncCallback<AppVersionInfo>):void;
getAppVersionInfo():Promise<AppVersionInfo>;
bundle\bundleInfo.d.tsreadonly name: string;
readonly versionCode: number;
readonly versionName: string;
getApplicationContext():Context;application\Context.d.tsgetApplicationContext(): ApplicationContext;
getAbilityInfo(callback:AsyncCallback<AbilityInfo>):void;
getAbilityInfo():Promise<AbilityInfo>;
application\UIAbilityContext.d.tsabilityInfo: AbilityInfo;
isUpdatingConfigurations(callback:AsyncCallback<boolean>):void;
isUpdatingConfigurations():Promise<boolean>;
There is no corresponding API in the stage model.Applications do not restart when the system environment changes. The onConfigurationUpdated callback is invoked to notify the applications of the changes. This API provides an empty implementation in the FA model, and the stage model does not provide a corresponding API.
printDrawnCompleted(callback:AsyncCallback<void>):void;
printDrawnCompleted():Promise<void>;
There is no corresponding API in the stage model.This API provides an empty implementation in the FA model. The stage model does not provide a corresponding API.
interface PermissionRequestResult@ohos.abilityAccessCtrl.d.tsexport type PermissionRequestResult = _PermissionRequestResult;
requestCode: number;The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
permissions: Array;security\PermissionRequestResult.d.tspermissions: Array;
authResults: Array;security\PermissionRequestResult.d.tsauthResults: Array;
interface PermissionOptionsThe API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
pid?: number;The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
uid?: number;The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.

featureAbility APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
getWant(callback: AsyncCallback<Want>): void;
getWant(): Promise<Want>;
@ohos.app.ability.UIAbility.d.tslaunchWant: Want;
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
startAbility(parameter: StartAbilityParameter): Promise<number>;
application\UIAbilityContext.d.tsstartAbility(want: Want, callback: AsyncCallback<void>): void;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
startAbility(want: Want, options?: StartOptions): Promise<void>;
getContext(): Context;@ohos.app.ability.UIAbility.d.tscontext: UIAbilityContext;
startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
application\UIAbilityContext.d.tsstartAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
application\UIAbilityContext.d.tsterminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
application\UIAbilityContext.d.tsterminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
acquireDataAbilityHelper(uri: string): DataAbilityHelper;@ohos.data.dataShare.d.ts
@ohos.data.fileAccess.d.ts
createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void;
createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>;
createFileAccessHelper(context: Context): FileAccessHelper;
createFileAccessHelper(context: Context, wants: Array<Want>): FileAccessHelper;
hasWindowFocus(callback: AsyncCallback<boolean>): void;
hasWindowFocus(): Promise<boolean>;
@ohos.window.d.tson(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void;
Checks whether the active window has the focus.
connectAbility(request: Want, options:ConnectOptions ): number;application\UIAbilityContext.d.tsconnectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
application\UIAbilityContext.d.tsdisconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
getWindow(callback: AsyncCallback<window.Window>): void;
getWindow(): Promise<window.Window>;
@ohos.window.d.tsgetLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void;
getLastWindow(ctx: BaseContext): Promise<Window>;
WINDOW_MODE_UNDEFINED = 0There is no corresponding API in the stage model.No corresponding API is provided.
WINDOW_MODE_FULLSCREEN = 1There is no corresponding API in the stage model.No corresponding API is provided.
WINDOW_MODE_SPLIT_PRIMARY = 100There is no corresponding API in the stage model.No corresponding API is provided.
WINDOW_MODE_SPLIT_SECONDARY = 101There is no corresponding API in the stage model.No corresponding API is provided.
WINDOW_MODE_FLOATING = 102There is no corresponding API in the stage model.No corresponding API is provided.
BOUNDS_KEY = 'abilityBounds'There is no corresponding API in the stage model.No corresponding API is provided.
WINDOW_MODE_KEY = 'windowMode'@ohos.app.ability.StartOptions.d.tswindowMode?: number;
DISPLAY_ID_KEY = 'displayId'There is no corresponding API in the stage model.No corresponding API is provided.
NO_ERROR = 0The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
INVALID_PARAMETER = -1The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
ABILITY_NOT_FOUND = -2The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
PERMISSION_DENY = -3The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
TYPE_INSERT = 1The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
TYPE_UPDATE = 2The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
TYPE_DELETE = 3The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
TYPE_ASSERT = 4The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
export type Context = _Context;@ohos.app.ability.common.d.tsexport type Context = _Context.default;
export type AppVersionInfo = _AppVersionInfo;The API is meaningless in the stage model.There is no substitute API. The API call should be deleted.
export type ProcessInfo = _ProcessInfo;@ohos.app.ability.appManager.d.tsexport type ProcessInformation = _ProcessInformation;

particleAbility APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
startAbility(parameter: StartAbilityParameter): Promise<void>;
application\ServiceExtensionContext.d.tsstartAbility(want: Want, callback: AsyncCallback<void>): void;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
startAbility(want: Want, options?: StartOptions): Promise<void>;
startServiceExtensionAbility(want: Want, callback: AsyncCallback<void>): void;
startServiceExtensionAbility(want: Want): Promise<void>;
terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
application\ServiceExtensionContext.d.tsterminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
connectAbility(request: Want, options:ConnectOptions ): number;application\ServiceExtensionContext.d.tsconnectAbility(want: Want, options: ConnectOptions): number;
connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
application\ServiceExtensionContext.d.tsdisconnectAbility(connection: number, callback:AsyncCallback<void>): void; 
disconnectAbility(connection: number): Promise<void>;
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
disconnectServiceExtensionAbility(connection: number): Promise<void>;
acquireDataAbilityHelper(uri: string): DataAbilityHelper;@ohos.data.dataShare.d.ts
[@ohos.data.fileAccess.d.ts
createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void;
createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>;
createFileAccessHelper(context: Context): FileAccessHelper;
createFileAccessHelper(context: Context, wants: Array<Want>): FileAccessHelper;
startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback<void>): void;
startBackgroundRunning(id: number, request: NotificationRequest): Promise<void>;
@ohos.resourceschedule.backgroundTaskManager.d.tsstartBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void;
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;
cancelBackgroundRunning(callback: AsyncCallback<void>): void;
cancelBackgroundRunning(): Promise<void>;
@ohos.resourceschedule.backgroundTaskManager.d.tsstopBackgroundRunning(context: Context, callback: AsyncCallback): void;
stopBackgroundRunning(context: Context): Promise<void>;
INVALID_PARAMETER = -1The API is meaningless in the stage model.Delete the API call.

LifecycleForm APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
onCreate?(want: Want): formBindingData.FormBindingData;@ohos.app.form.FormExtensionAbility.d.tsonAddForm(want: Want): formBindingData.FormBindingData;
onCastToNormal?(formId: string): void;@ohos.app.form.FormExtensionAbility.d.tsonCastToNormalForm(formId: string): void;
onUpdate?(formId: string): void;@ohos.app.form.FormExtensionAbility.d.tsonUpdateForm(formId: string): void;
onVisibilityChange?(newStatus: Record<string, number>): void;@ohos.app.form.FormExtensionAbility.d.tsonChangeFormVisibility(newStatus: Record<string, number>): void;
onEvent?(formId: string, message: string): void;@ohos.app.form.FormExtensionAbility.d.tsonFormEvent(formId: string, message: string): void;
onDestroy?(formId: string): void;@ohos.app.form.FormExtensionAbility.d.tsonRemoveForm(formId: string): void;
onAcquireFormState?(want: Want): formInfo.FormState;@ohos.app.form.FormExtensionAbility.d.tsonAcquireFormState?(want: Want): formInfo.FormState;
onShareForm?(formId: string): { [key: string]: any };@ohos.app.form.FormExtensionAbility.d.tsonShareForm?(formId: string): Record<string, Object>;

LifecycleApp APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
onShow?(): void;@ohos.window.d.tson(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void;
Listens for the switching to the foreground.
onHide?(): void;@ohos.window.d.tson(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void;
Listens for the switching to the background.
onDestroy?(): void;@ohos.app.ability.UIAbility.d.tsonDestroy(): void;
onCreate?(): void;@ohos.app.ability.UIAbility.d.tsonCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;
onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void;There is no corresponding API in the stage model.No corresponding API is provided.
onStartContinuation?(): boolean;There is no corresponding API in the stage model.In the stage model, an application does not need to detect whether the continuation is successful (detected when the application initiates the continuation request). Therefore, the onStartContinuation() callback is deprecated.
onSaveData?(data: Object): boolean;@ohos.app.ability.UIAbility.d.tsonContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult;
onCompleteContinuation?(result: number): void;application\ContinueCallback.d.tsonContinueDone(result: number): void;
onRestoreData?(data: Object): void;@ohos.app.ability.UIAbility.d.tsonCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;
In multiton or singleton mode, the target ability completes data restoration in the onCreate() callback. In the callback, launchParam.launchReason is used to determine whether it is a continuation-based launch scenario. If it is, the data saved before continuation can be obtained from the want parameter.
onRemoteTerminated?(): void;application\ContinueCallback.d.tsonContinueDone(result: number): void;
onSaveAbilityState?(outState: PacMap): void;@ohos.app.ability.UIAbility.d.tsonSaveState(reason: AbilityConstant.StateType, wantParam : Record<string, Object>): AbilityConstant.OnSaveResult;
onRestoreAbilityState?(inState: PacMap): void;@ohos.app.ability.UIAbility.d.tsonCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;
After an application is restarted, the onCreate() callback is triggered. In the callback, launchParam.launchReason is used to determine whether it is a self-recovery scenario. If it is, the data saved before the restart can be obtained from the want parameter.
onInactive?(): void;@ohos.app.ability.UIAbility.d.tsonBackground(): void;
onActive?(): void;@ohos.app.ability.UIAbility.d.tsonForeground(): void;
onNewWant?(want: Want): void;@ohos.app.ability.UIAbility.d.tsonNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;
onMemoryLevel?(level: number): void@ohos.app.ability.UIAbility.d.tsonMemoryLevel(level: AbilityConstant.MemoryLevel): void;

LifecycleService APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
onStart?(): void;@ohos.app.ability.ServiceExtensionAbility.d.tsonCreate(want: Want): void;
onCommand?(want: Want, startId: number): void;@ohos.app.ability.ServiceExtensionAbility.d.tsonRequest(want: Want, startId: number): void;
onStop?(): void;@ohos.app.ability.ServiceExtensionAbility.d.tsonDestroy(): void;
onConnect?(want: Want): rpc.RemoteObject;@ohos.app.ability.ServiceExtensionAbility.d.tsonConnect(want: Want): rpc.RemoteObject;
onDisconnect?(want: Want): void;@ohos.app.ability.ServiceExtensionAbility.d.tsonDisconnect(want: Want): void;
onReconnect?(want: Want): void;@ohos.app.ability.ServiceExtensionAbility.d.tsonReconnect(want: Want): void;

LifecycleData APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void;@ohos.application.DataShareExtensionAbility.d.tsupdate?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void;
query?(uri: string, columns: Array<string>, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void;@ohos.application.DataShareExtensionAbility.d.tsquery?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<Object>): void;
delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void;@ohos.application.DataShareExtensionAbility.d.tsdelete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void;
normalizeUri?(uri: string, callback: AsyncCallback<string>): void;@ohos.application.DataShareExtensionAbility.d.tsnormalizeUri?(uri: string, callback: AsyncCallback<string>): void;
batchInsert?(uri: string, valueBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void;@ohos.application.DataShareExtensionAbility.d.tsbatchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
denormalizeUri?(uri: string, callback: AsyncCallback<string>): void;@ohos.application.DataShareExtensionAbility.d.tsdenormalizeUri?(uri: string, callback: AsyncCallback<string>): void;
insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void;@ohos.application.DataShareExtensionAbility.d.tsinsert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void;
openFile?(uri: string, mode: string, callback: AsyncCallback<number>): void;There is no corresponding API in the stage model.The stage model does not support cross-process URI access. You are advised to use the want parameter to carry the file descriptor and file information for cross-process file access.
getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void;There is no corresponding API in the stage model.The stage model does not support cross-process URI access. You are advised to use the want parameter to carry the file descriptor and file information for cross-process file access.
onInitialized?(info: AbilityInfo): void;@ohos.application.DataShareExtensionAbility.d.tsonCreate?(want: Want, callback: AsyncCallback<void>): void;
getType?(uri: string, callback: AsyncCallback<string>): void;There is no corresponding API in the stage model.The stage model does not support cross-process URI access. You are advised to use the want parameter to carry the file descriptor and file information for cross-process file access.
executeBatch?(ops: Array<DataAbilityOperation>, callback: AsyncCallback<Array<DataAbilityResult>>): void;There is no corresponding API in the stage model.No corresponding API is provided.
call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback<PacMap>): void;There is no corresponding API in the stage model.No corresponding API is provided.

DataAbilityHelper APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
openFile(uri: string, mode: string, callback: AsyncCallback<number>): void;
openFile(uri: string, mode: string): Promise<number>;
@ohos.data.fileAccess.d.tsopenFile(uri: string, flags: OPENFLAGS) : Promise<number>;
openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback<number>) : void;
on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void;@ohos.data.dataShare.d.tson(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void;
off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void;@ohos.data.dataShare.d.tsoff(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void;
getType(uri: string, callback: AsyncCallback<string>): void;
getType(uri: string): Promise<string>;
There is no corresponding API in the stage model.The stage model does not support cross-process URI access. You are advised to use the want parameter to carry the file descriptor and file information for cross-process file access.
getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void;
getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string>>;
There is no corresponding API in the stage model.The stage model does not support cross-process URI access. You are advised to use the want parameter to carry the file descriptor and file information for cross-process file access.
normalizeUri(uri: string, callback: AsyncCallback<string>): void;
normalizeUri(uri: string): Promise<string>;
@ohos.data.dataShare.d.tsnormalizeUri(uri: string, callback: AsyncCallback<string>): void;
normalizeUri(uri: string): Promise<string>;
denormalizeUri(uri: string, callback: AsyncCallback<string>): void;
denormalizeUri(uri: string): Promise<string>;
@ohos.data.dataShare.d.tsdenormalizeUri(uri: string, callback: AsyncCallback<string>): void;
denormalizeUri(uri: string): Promise<string>;
notifyChange(uri: string, callback: AsyncCallback<void>): void;
notifyChange(uri: string): Promise<void>;
@ohos.data.dataShare.d.tsnotifyChange(uri: string, callback: AsyncCallback<void>): void;
notifyChange(uri: string): Promise<void>;
insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void;
insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise<number>;
@ohos.data.dataShare.d.tsinsert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void;
insert(uri: string, value: ValuesBucket): Promise<number>;
batchInsert(uri: string, valuesBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void;
batchInsert(uri: string, valuesBuckets: Array<rdb.ValuesBucket>): Promise<number>;
@ohos.data.dataShare.d.tsbatchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>;
delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void;
delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise<number>;
delete(uri: string, callback: AsyncCallback<number>): void;
@ohos.data.dataShare.d.tsdelete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void;
delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>;
update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void;
update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise<number>;
update(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void;
@ohos.data.dataShare.d.tsupdate(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void;
update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>;
query(uri: string, columns: Array<string>, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void;
query(uri: string, callback: AsyncCallback<ResultSet>): void;
query(uri: string, columns: Array<string>, callback: AsyncCallback<ResultSet>): void;
query(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void;
query(uri: string, columns?: Array<string>, predicates?: dataAbility.DataAbilityPredicates): Promise<ResultSet>;
@ohos.data.dataShare.d.tsquery(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void;
query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>): Promise<DataShareResultSet>;
call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback<PacMap>): void;
call(uri: string, method: string, arg: string, extras: PacMap): Promise<PacMap>;
There is no corresponding API in the stage model.No corresponding API is provided.
executeBatch(uri: string, operations: Array<DataAbilityOperation>, callback: AsyncCallback<Array<DataAbilityResult>>): void;
executeBatch(uri: string, operations: Array<DataAbilityOperation>): Promise<Array<DataAbilityResult>>;
There is no corresponding API in the stage model.No corresponding API is provided.

mediaLibrary APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
getMediaLibrary(): MediaLibrary;@ohos.file.photoAccessHelper.d.tsgetPhotoAccessHelper(context: Context): PhotoAccessHelper;

Request APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
download(config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
download(config: DownloadConfig): Promise<DownloadTask>;
@ohos.request.d.tsdownloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask>;
upload(config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
upload(config: UploadConfig): Promise<UploadTask>;
@ohos.request.d.tsuploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>;

resourceManager APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
getResourceManager(callback: AsyncCallback<ResourceManager>): void;
getResourceManager(bundleName: string, callback: AsyncCallback<ResourceManager>): void;
getResourceManager(): Promise<ResourceManager>;
getResourceManager(bundleName: string): Promise<ResourceManager>;
application\Context.d.tsresourceManager: resmgr.ResourceManager;

Window APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
create(id: string, type: WindowType, callback: AsyncCallback<Window>): void;
create(id: string, type: WindowType): Promise<Window>;
@ohos.window.d.tscreateSubWindow(name: string, callback: AsyncCallback<Window>): void;
createSubWindow(name: string): Promise;
An application developed on the FA model uses window.create(id, WindowType.TYPE_APP) to create a subwindow, whereas an application developed on the stage model uses WindowStage.CreateSubWindow() to create a subwindow.
getTopWindow(callback: AsyncCallback<Window>): void;
getTopWindow(): Promise<Window>;
@ohos.window.d.tsgetLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void;
getLastWindow(ctx: BaseContext): Promise<Window>;
TYPE_APPThe API is meaningless in the stage model.An application developed on the FA model uses window.create(id, WindowType.TYPE_APP) to create a subwindow, whereas an application developed on the stage model uses WindowStage.CreateSubWindow() to create a subwindow.

Storage APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
GetStorageOptionsThere is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
SetStorageOptionsThere is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
ClearStorageOptionsThere is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
DeleteStorageOptionsThere is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
static get(options: GetStorageOptions): void;@ohos.data.preferences.d.tsget(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): void;
get(key: string, defValue: ValueType): Promise<ValueType>;
static set(options: SetStorageOptions): void;@ohos.data.preferences.d.tsput(key: string, value: ValueType, callback: AsyncCallback<void>): void;
put(key: string, value: ValueType): Promise<void>;
static clear(options?: ClearStorageOptions): void;@ohos.data.preferences.d.tsclear(callback: AsyncCallback<void>): void;
clear(): Promise<void>;
static delete(options: DeleteStorageOptions): void;@ohos.data.preferences.d.tsdelete(key: string, callback: AsyncCallback<void>): void;
delete(key: string): Promise<void>;
key: string;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
default?: string;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
success?: (data: any) => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
fail?: (data: string, code: number) => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
complete?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
key: string;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
value: string;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
success?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
fail?: (data: string, code: number) => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
complete?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
success?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
fail?: (data: string, code: number) => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
complete?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
key: string;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
success?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
fail?: (data: string, code: number) => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
complete?: () => void;There is no corresponding API in the stage model.The stage model uses Prefereces to replace Storage and has redesigned the input parameters.

ability APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
export type DataAbilityOperation = _DataAbilityOperation;There is no corresponding API in the stage model.No corresponding API is provided.
export type DataAbilityResult = _DataAbilityResult;There is no corresponding API in the stage model.No corresponding API is provided.
export type AbilityResult = _AbilityResult;@ohos.app.ability.common.d.tsexport type AbilityResult = _AbilityResult;
export type ConnectOptions = _ConnectOptions;@ohos.app.ability.common.d.tsexport type ConnectOptions = _ConnectOptions;
export type StartAbilityParameter = _StartAbilityParameter;There is no corresponding API in the stage model.No corresponding API is provided.

settings APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void;
function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise;
function getValue(context: Context, name: string, callback: AsyncCallback): void;
function getValue(context: Context, name: string): Promise;
function getValue(context: Context, name: string, domainName: string): Promise;
@ohos.settings.d.tsfunction getValue(context: Context, name: string, callback: AsyncCallback): void;
function getValue(context: Context, name: string): Promise;
function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void;
function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise;
function setValue(context: Context, name: string, value: string, callback: AsyncCallback): void;
function setValue(context: Context, name: string, value: string): Promise;
function setValue(context: Context, name: string, value: string, domainName: string): Promise;
@ohos.settings.d.tsfunction setValue(context: Context, name: string, value: string, callback: AsyncCallback): void;
function setValue(context: Context, name: string, value: string): Promise;
function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;
function getValueSync(context: Context, name: string, defValue: string): string;
function getValueSync(context: Context, name: string, defValue: string, domainName: string): string;
@ohos.settings.d.tsfunction getValueSync(context: Context, name: string, defValue: string): string;
function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
function setValueSync(context: Context, name: string, value: string): boolean;
function setValueSync(context: Context, name: string, value: string, domainName: string): boolean;
@ohos.settings.d.tsfunction setValueSync(context: Context, name: string, value: string): boolean;

dataAbilityOperation APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
uri: stringThe API is meaningless in the stage model.Delete the API call.
type: featureAbility.DataAbilityOperationType;The API is meaningless in the stage model.Delete the API call.
valuesBucket?: rdb.ValuesBucket;The API is meaningless in the stage model.Delete the API call.
valueBackReferences?: rdb.ValuesBucket;The API is meaningless in the stage model.Delete the API call.
predicates?: dataAbility.DataAbilityPredicates;The API is meaningless in the stage model.Delete the API call.
predicatesBackReferences?: Map<number, number>;The API is meaningless in the stage model.Delete the API call.
interrupted?: boolean;The API is meaningless in the stage model.Delete the API call.
expectedCount?: number;The API is meaningless in the stage model.Delete the API call.

dataAbilityResult APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
uri?: string;The API is meaningless in the stage model.Delete the API call.
count?: number;The API is meaningless in the stage model.Delete the API call.

startAbilityParameter APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
want: Want;The API is meaningless in the stage model.Delete the API call.
abilityStartSetting?: { [key: string]: any };The API is meaningless in the stage model.Delete the API call.
abilityStartSettings?: Record<string, Object>;The API is meaningless in the stage model.Delete the API call.

appVersionInfo APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
export interface AppVersionInfoohos.bundle.bundleManager.d.tsexport interface BundleInfo
readonly appName: string;bundleManager\BundleInfo.d.tsreadonly name: string;
readonly versionCode: number;bundleManager\BundleInfo.d.tsreadonly versionCode: number;
readonly versionName: string;bundleManager\BundleInfo.d.tsreadonly versionName: string;

bundleManager APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
PAGE = 1The API is meaningless in the stage model.Delete the API call.
SERVICE = 2The API is meaningless in the stage model.Delete the API call.
DATA = 3The API is meaningless in the stage model.Delete the API call.

abilityInfo APIs

APIs Available in FA Model OnlySubstitute API File in Stage ModelSubstitute API in Stage Model
readonly targetAbility: string;The API is meaningless in the stage model.Delete the API call.
readonly backgroundModes: number;The API is meaningless in the stage model.Delete the API call.
readonly formEnabled: boolean;The API is meaningless in the stage model.Delete the API call.
readonly type: bundle.AbilityType;The API is meaningless in the stage model.Delete the API call.
readonly subType: bundle.AbilitySubType;The API is meaningless in the stage model.Delete the API call.
readonly readPermission: string;The API is meaningless in the stage model.Delete the API call.
readonly writePermission: string;The API is meaningless in the stage model.Delete the API call.
readonly uri: string;The API is meaningless in the stage model.Delete the API call.
readonly type: bundleManager.AbilityType;The API is meaningless in the stage model.Delete the API call.
readonly readPermission: string;The API is meaningless in the stage model.Delete the API call.
readonly writePermission: string;The API is meaningless in the stage model.Delete the API call.
readonly uri: string;The API is meaningless in the stage model.Delete the API call.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙cl.arkui.1 Specification Change for RichEditor Menu Visibility When Scrolling After Popup

harmony 鸿蒙Bundle Manager Subsystem Changelog

harmony 鸿蒙Media Subsystem Changelog

harmony 鸿蒙SDK Subsystem Changelog

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/6AOVBH