From ddea263550ca847583415ae10be0444de6211127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=9B=BD=E5=86=9B?= Date: Tue, 12 Aug 2025 17:40:08 +0800 Subject: [PATCH] add OH_AbilityRuntime_ApplicationContextGetVersionCode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 任国军 --- AbilityKit/ability_runtime/application_context.h | 13 +++++++++++++ .../ability_runtime/libability_runtime.ndk.json | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index ed62cf40293..00c5d579d45 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -294,6 +294,19 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbility(AbilityBase_Want * AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbilityWithStartOptions(AbilityBase_Want *want, AbilityRuntime_StartOptions *options); + /** + * @brief Obtain the version code of the application. + * + * @param versionCode The version code of the application. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the versionCode is null. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * {@link ABILITY_RUNTIME_ERROR_CODE_GET_APPLICATION_INFO_FAILED} if the application info does not exist. + * @since 21 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetVersionCode(int64_t* versionCode); + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 6790d7d683b..f7939128e40 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -178,5 +178,9 @@ { "first_introduced": "20", "name": "OH_AbilityRuntime_ApplicationContextGetResourceDir" + }, + { + "first_introduced": "21", + "name": "OH_AbilityRuntime_ApplicationContextGetVersionCode" } ] \ No newline at end of file -- Gitee