openharmony 鸿蒙 access-datashareextensionability-from-fa

2023-02-03 浏览 (994)

Accessing a DataShareExtensionAbility from the FA Model

Overview

Regardless of the FA model or stage model, the data read/write function consists of the client and server.

If the client uses the FA model whereas the server is upgraded to the stage model, the client cannot access the server.

To resolve this issue, the system provides a solution on the framework side for smooth evolution.

Basic Principles

A compatible method is that DataAbilityHelper determines whether to call the DataShareHelper APIs based on the URI prefix (either DataAbility or DataShare). However, this method requires modification to the URI in the original client code.

Instead of manual modification, the system adopts the following processing:

  1. The system attempts to start the DataAbility based on the URI passed in. If the startup fails, the system converts the URI prefix to DataShare and attempts to start the DataShareExtensionAbility.

  2. If the URI does not map to any DataAbility or DataShareExtensionAbility, the startup fails. Otherwise, either the DataAbility or DataShareExtensionAbility is started.

Constraints

  1. When you switch a DataAbility to a DataShareExtensionAbility, only the URI prefix can be modified.

    FAvsStage-uri

  2. The DataShareHelper class implements only certain APIs of DataAbilityHelper. For details about the APIs, see the table below.

    Table 1 API compatibility when the FA model accesses a DataShareExtensionAbility of the stage model

APIProvided by DataAbilityHelperProvided by DataShareHelperCompatible
onYesYesYes
offYesYesYes
notifyChangeYesYesYes
insertYesYesYes
deleteYesYesYes
queryYesYesYes
updateYesYesYes
batchInsertYesYesYes
getTypeYesNoNo
getFileTypesYesNoNo
normalizeUriYesYesYes
denormalizeUriYesYesYes
openFileYesNoNo
callYesNoNo
executeBatchYesNoNo

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙Obtaining Reasons for Abnormal Application Exits

harmony 鸿蒙UIAbility Backup and Restore

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Introduction to Ability Kit

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Common action and entities Values (Not Recommended)

harmony 鸿蒙API Switching Overview

harmony 鸿蒙Switching of app and deviceConfig

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