harmony 鸿蒙API Model Conversion List

  • 2025-06-12
  • 浏览 (33)

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 Only Substitute API File in Stage Model Substitute 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.ts verifyAccessTokenSync(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.ts requestPermissionsFromUser(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.ts applicationInfo: ApplicationInfo;
getBundleName(callback : AsyncCallback<string>): void;
getBundleName(): Promise<string>;
application\UIAbilityContext.d.ts abilityInfo.bundleName: string;
getDisplayOrientation(callback : AsyncCallback<bundle.DisplayOrientation>): void;
getDisplayOrientation(): Promise<bundle.DisplayOrientation>;
\@ohos.screen.d.ts readonly orientation: Orientation;
setDisplayOrientation(orientation:bundle.DisplayOrientation, callback:AsyncCallback<void>):void;
setDisplayOrientation(orientation:bundle.DisplayOrientation):Promise<void>;
\@ohos.screen.d.ts setOrientation(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.ts setShowOnLockScreen(showOnLockScreen: boolean): void;
setWakeUpScreen(wakeUp:boolean, callback:AsyncCallback<void>):void;
setWakeUpScreen(wakeUp:boolean):Promise<void>;
\@ohos.window.d.ts setWakeUpScreen(wakeUp: boolean): void;
getProcessInfo(callback:AsyncCallback<ProcessInfo>):void;
getProcessInfo():Promise<ProcessInfo>;
\@ohos.app.ability.abilityManager.d.ts getAbilityRunningInfos(callback: AsyncCallback<Array<AbilityRunningInfo>>): void;
getAbilityRunningInfos(): Promise<Array<AbilityRunningInfo>>;
getElementName(callback:AsyncCallback<ElementName>):void;
getElementName():Promise<ElementName>;
application\UIAbilityContext.d.ts abilityInfo.name: string;
abilityInfo.bundleName: string;
getProcessName(callback:AsyncCallback<string>):void;
getProcessName():Promise<string>;
\@ohos.app.ability.abilityManager.d.ts getAbilityRunningInfos(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.ts filesDir: string;
getCacheDir(callback:AsyncCallback<string>):void;
getCacheDir():Promise<string>;
application\Context.d.ts cacheDir: string;
getOrCreateDistributedDir(callback:AsyncCallback<string>):void;
getOrCreateDistributedDir():Promise<string>;
application\Context.d.ts distributedFilesDir: string;
getAppType(callback:AsyncCallback<string>):void;
getAppType():Promise<string>;
application\UIAbilityContext.d.ts The 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.ts currentHapModuleInfo: HapModuleInfo;
getAppVersionInfo(callback:AsyncCallback<AppVersionInfo>):void;
getAppVersionInfo():Promise<AppVersionInfo>;
bundle\bundleInfo.d.ts readonly name: string;
readonly versionCode: number;
readonly versionName: string;
getApplicationContext():Context; application\Context.d.ts getApplicationContext(): ApplicationContext;
getAbilityInfo(callback:AsyncCallback<AbilityInfo>):void;
getAbilityInfo():Promise<AbilityInfo>;
application\UIAbilityContext.d.ts abilityInfo: 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.ts export 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.ts permissions: Array;
authResults: Array; security\PermissionRequestResult.d.ts authResults: Array;
interface PermissionOptions The 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 Only Substitute API File in Stage Model Substitute API in Stage Model
getWant(callback: AsyncCallback<Want>): void;
getWant(): Promise<Want>;
\@ohos.app.ability.UIAbility.d.ts launchWant: Want;
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
startAbility(parameter: StartAbilityParameter): Promise<number>;
application\UIAbilityContext.d.ts startAbility(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.ts context: UIAbilityContext;
startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback<AbilityResult>): void;
startAbilityForResult(parameter: StartAbilityParameter): Promise<AbilityResult>;
application\UIAbilityContext.d.ts startAbilityForResult(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.ts terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
application\UIAbilityContext.d.ts terminateSelf(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.ts on(eventType: ‘windowStageEvent’, callback: Callback<WindowStageEventType>): void;
Checks whether the active window has the focus.
connectAbility(request: Want, options:ConnectOptions ): number; application\UIAbilityContext.d.ts connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
application\UIAbilityContext.d.ts disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
getWindow(callback: AsyncCallback<window.Window>): void;
getWindow(): Promise<window.Window>;
\@ohos.window.d.ts getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void;
getLastWindow(ctx: BaseContext): Promise<Window>;
WINDOW_MODE_UNDEFINED = 0 There is no corresponding API in the stage model. No corresponding API is provided.
WINDOW_MODE_FULLSCREEN = 1 There is no corresponding API in the stage model. No corresponding API is provided.
WINDOW_MODE_SPLIT_PRIMARY = 100 There is no corresponding API in the stage model. No corresponding API is provided.
WINDOW_MODE_SPLIT_SECONDARY = 101 There is no corresponding API in the stage model. No corresponding API is provided.
WINDOW_MODE_FLOATING = 102 There 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.ts windowMode?: number;
DISPLAY_ID_KEY = ‘displayId’ There is no corresponding API in the stage model. No corresponding API is provided.
NO_ERROR = 0 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
INVALID_PARAMETER = -1 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
ABILITY_NOT_FOUND = -2 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
PERMISSION_DENY = -3 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
TYPE_INSERT = 1 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
TYPE_UPDATE = 2 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
TYPE_DELETE = 3 The API is meaningless in the stage model. There is no substitute API. The API call should be deleted.
TYPE_ASSERT = 4 The 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.ts export 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.ts export type ProcessInformation = _ProcessInformation;

particleAbility APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<number>): void;
startAbility(parameter: StartAbilityParameter): Promise<void>;
application\ServiceExtensionContext.d.ts startAbility(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.ts terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
connectAbility(request: Want, options:ConnectOptions ): number; application\ServiceExtensionContext.d.ts connectAbility(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.ts disconnectAbility(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.ts startBackgroundRunning(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.ts stopBackgroundRunning(context: Context, callback: AsyncCallback): void;
stopBackgroundRunning(context: Context): Promise<void>;
INVALID_PARAMETER = -1 The API is meaningless in the stage model. Delete the API call.

LifecycleForm APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
onCreate?(want: Want): formBindingData.FormBindingData; \@ohos.app.form.FormExtensionAbility.d.ts onAddForm(want: Want): formBindingData.FormBindingData;
onCastToNormal?(formId: string): void; \@ohos.app.form.FormExtensionAbility.d.ts onCastToNormalForm(formId: string): void;
onUpdate?(formId: string): void; \@ohos.app.form.FormExtensionAbility.d.ts onUpdateForm(formId: string): void;
onVisibilityChange?(newStatus: Record<string, number>): void; \@ohos.app.form.FormExtensionAbility.d.ts onChangeFormVisibility(newStatus: Record<string, number>): void;
onEvent?(formId: string, message: string): void; \@ohos.app.form.FormExtensionAbility.d.ts onFormEvent(formId: string, message: string): void;
onDestroy?(formId: string): void; \@ohos.app.form.FormExtensionAbility.d.ts onRemoveForm(formId: string): void;
onAcquireFormState?(want: Want): formInfo.FormState; \@ohos.app.form.FormExtensionAbility.d.ts onAcquireFormState?(want: Want): formInfo.FormState;
onShareForm?(formId: string): { [key: string]: any }; \@ohos.app.form.FormExtensionAbility.d.ts onShareForm?(formId: string): Record<string, Object>;

LifecycleApp APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
onShow?(): void; \@ohos.window.d.ts on(eventType: ‘windowStageEvent’, callback: Callback<WindowStageEventType>): void;
Listens for the switching to the foreground.
onHide?(): void; \@ohos.window.d.ts on(eventType: ‘windowStageEvent’, callback: Callback<WindowStageEventType>): void;
Listens for the switching to the background.
onDestroy?(): void; \@ohos.app.ability.UIAbility.d.ts onDestroy(): void;
onCreate?(): void; \@ohos.app.ability.UIAbility.d.ts onCreate(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.ts onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult;
onCompleteContinuation?(result: number): void; application\ContinueCallback.d.ts onContinueDone(result: number): void;
onRestoreData?(data: Object): void; \@ohos.app.ability.UIAbility.d.ts onCreate(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.ts onContinueDone(result: number): void;
onSaveAbilityState?(outState: PacMap): void; \@ohos.app.ability.UIAbility.d.ts onSaveState(reason: AbilityConstant.StateType, wantParam : Record<string, Object>): AbilityConstant.OnSaveResult;
onRestoreAbilityState?(inState: PacMap): void; \@ohos.app.ability.UIAbility.d.ts onCreate(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.ts onBackground(): void;
onActive?(): void; \@ohos.app.ability.UIAbility.d.ts onForeground(): void;
onNewWant?(want: Want): void; \@ohos.app.ability.UIAbility.d.ts onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;
onMemoryLevel?(level: number): void \@ohos.app.ability.UIAbility.d.ts onMemoryLevel(level: AbilityConstant.MemoryLevel): void;

LifecycleService APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
onStart?(): void; \@ohos.app.ability.ServiceExtensionAbility.d.ts onCreate(want: Want): void;
onCommand?(want: Want, startId: number): void; \@ohos.app.ability.ServiceExtensionAbility.d.ts onRequest(want: Want, startId: number): void;
onStop?(): void; \@ohos.app.ability.ServiceExtensionAbility.d.ts onDestroy(): void;
onConnect?(want: Want): rpc.RemoteObject; \@ohos.app.ability.ServiceExtensionAbility.d.ts onConnect(want: Want): rpc.RemoteObject;
onDisconnect?(want: Want): void; \@ohos.app.ability.ServiceExtensionAbility.d.ts onDisconnect(want: Want): void;
onReconnect?(want: Want): void; \@ohos.app.ability.ServiceExtensionAbility.d.ts onReconnect(want: Want): void;

LifecycleData APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void; \@ohos.application.DataShareExtensionAbility.d.ts update?(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.ts query?(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.ts delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void;
normalizeUri?(uri: string, callback: AsyncCallback<string>): void; \@ohos.application.DataShareExtensionAbility.d.ts normalizeUri?(uri: string, callback: AsyncCallback<string>): void;
batchInsert?(uri: string, valueBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void; \@ohos.application.DataShareExtensionAbility.d.ts batchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
denormalizeUri?(uri: string, callback: AsyncCallback<string>): void; \@ohos.application.DataShareExtensionAbility.d.ts denormalizeUri?(uri: string, callback: AsyncCallback<string>): void;
insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void; \@ohos.application.DataShareExtensionAbility.d.ts insert?(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.ts onCreate?(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 Only Substitute API File in Stage Model Substitute API in Stage Model
openFile(uri: string, mode: string, callback: AsyncCallback<number>): void;
openFile(uri: string, mode: string): Promise<number>;
\@ohos.data.fileAccess.d.ts openFile(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.ts on(type: ‘dataChange’, uri: string, callback: AsyncCallback<void>): void;
off(type: ‘dataChange’, uri: string, callback?: AsyncCallback<void>): void; \@ohos.data.dataShare.d.ts off(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.ts normalizeUri(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.ts denormalizeUri(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.ts notifyChange(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.ts insert(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.ts batchInsert(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.ts delete(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.ts update(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.ts query(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 Only Substitute API File in Stage Model Substitute API in Stage Model
getMediaLibrary(): MediaLibrary; \@ohos.file.photoAccessHelper.d.ts getPhotoAccessHelper(context: Context): PhotoAccessHelper;

Request APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
download(config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void;
download(config: DownloadConfig): Promise<DownloadTask>;
\@ohos.request.d.ts downloadFile(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.ts uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void;
uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask>;

resourceManager APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute 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.ts resourceManager: resmgr.ResourceManager;

Window APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
create(id: string, type: WindowType, callback: AsyncCallback<Window>): void;
create(id: string, type: WindowType): Promise<Window>;
\@ohos.window.d.ts createSubWindow(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.ts getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void;
getLastWindow(ctx: BaseContext): Promise<Window>;
TYPE_APP The 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 Only Substitute API File in Stage Model Substitute API in Stage Model
GetStorageOptions There is no corresponding API in the stage model. The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
SetStorageOptions There is no corresponding API in the stage model. The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
ClearStorageOptions There is no corresponding API in the stage model. The stage model uses Prefereces to replace Storage and has redesigned the input parameters.
DeleteStorageOptions There 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.ts get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): void;
get(key: string, defValue: ValueType): Promise<ValueType>;
static set(options: SetStorageOptions): void; \@ohos.data.preferences.d.ts put(key: string, value: ValueType, callback: AsyncCallback<void>): void;
put(key: string, value: ValueType): Promise<void>;
static clear(options?: ClearStorageOptions): void; \@ohos.data.preferences.d.ts clear(callback: AsyncCallback<void>): void;
clear(): Promise<void>;
static delete(options: DeleteStorageOptions): void; \@ohos.data.preferences.d.ts delete(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 Only Substitute API File in Stage Model Substitute 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.ts export type AbilityResult = _AbilityResult;
export type ConnectOptions = _ConnectOptions; \@ohos.app.ability.common.d.ts export 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 Only Substitute API File in Stage Model Substitute 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.ts function 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.ts function 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.ts function 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.ts function setValueSync(context: Context, name: string, value: string): boolean;

dataAbilityOperation APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
uri: string The 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; 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 Only Substitute API File in Stage Model Substitute 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 Only Substitute API File in Stage Model Substitute 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; The API is meaningless in the stage model. Delete the API call.

appVersionInfo APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute API in Stage Model
export interface AppVersionInfo ohos.bundle.bundleManager.d.ts export interface BundleInfo
readonly appName: string; bundleManager\BundleInfo.d.ts readonly name: string;
readonly versionCode: number; bundleManager\BundleInfo.d.ts readonly versionCode: number;
readonly versionName: string; bundleManager\BundleInfo.d.ts readonly versionName: string;

bundleManager APIs

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

abilityInfo APIs

APIs Available in FA Model Only Substitute API File in Stage Model Substitute 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

0  赞