1e41f4b71Sopenharmony_ci# DataAbility Lifecycle 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciYou can implement lifecycle callbacks (as described in the table below) in **data.js** or **data.ets**. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci**Table 1** DataAbility lifecycle APIs 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci| API| Description| 10e41f4b71Sopenharmony_ci| -------- | -------- | 11e41f4b71Sopenharmony_ci| onInitialized?(info: AbilityInfo): void | Called during ability initialization to initialize the relational database (RDB).| 12e41f4b71Sopenharmony_ci| update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void | Updates data in the database.| 13e41f4b71Sopenharmony_ci| query?(uri: string, columns: Array<string>, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<ResultSet>): void | Queries data in the database.| 14e41f4b71Sopenharmony_ci| delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback<number>): void | Deletes one or more data records from the database.| 15e41f4b71Sopenharmony_ci| normalizeUri?(uri: string, callback: AsyncCallback<string>): void | Normalizes the URI. A normalized URI applies to cross-device use, persistence, backup, and restore. When the context changes, it ensures that the same data item can be referenced.| 16e41f4b71Sopenharmony_ci| batchInsert?(uri: string, valueBuckets: Array<rdb.ValuesBucket>, callback: AsyncCallback<number>): void | Inserts multiple data records into the database.| 17e41f4b71Sopenharmony_ci| denormalizeUri?(uri: string, callback: AsyncCallback<string>): void | Converts a normalized URI generated by **normalizeUri** into a denormalized URI.| 18e41f4b71Sopenharmony_ci| insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback<number>): void | Inserts a data record into the database.| 19e41f4b71Sopenharmony_ci| openFile?(uri: string, mode: string, callback: AsyncCallback<number>): void | Opens a file.| 20e41f4b71Sopenharmony_ci| getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void | Obtains the MIME type of a file.| 21e41f4b71Sopenharmony_ci| getType?(uri: string, callback: AsyncCallback<string>): void | Obtains the MIME type matching the data specified by the URI.| 22e41f4b71Sopenharmony_ci| executeBatch?(ops: Array<DataAbilityOperation>, callback: AsyncCallback<Array<DataAbilityResult>>): void | Operates data in the database in batches.| 23e41f4b71Sopenharmony_ci| call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback<PacMap>): void | Calls a custom API.| 24