From fcd1294acd93a234e722183208c448122dbc1fa0 Mon Sep 17 00:00:00 2001 From: wangsen1994 Date: Tue, 8 Oct 2024 10:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E9=80=9A=E7=9F=A5=E6=96=B0?= =?UTF-8?q?=E5=A2=9Ec=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangsen1994 --- NotificationKit/BUILD.gn | 28 +++++++++++ NotificationKit/libohnotification.ndk.json | 6 +++ NotificationKit/notification.h | 58 ++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 NotificationKit/BUILD.gn create mode 100644 NotificationKit/libohnotification.ndk.json create mode 100644 NotificationKit/notification.h diff --git a/NotificationKit/BUILD.gn b/NotificationKit/BUILD.gn new file mode 100644 index 000000000..eff7eea6e --- /dev/null +++ b/NotificationKit/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +ohos_ndk_headers("ohnotification_header") { + dest_dir = "$ndk_headers_out_dir/NotificationKit/" + sources = [ "./notification.h" ] +} + +ohos_ndk_library("libnotification_ndk") { + output_name = "ohnotification" + output_extension = "so" + ndk_description_file = "./libohnotification.ndk.json" + min_compact_version = "13" + system_capability = "SystemCapability.Notification.Notification" + system_capability_headers = [ "NotificationKit/notification.h" ] +} diff --git a/NotificationKit/libohnotification.ndk.json b/NotificationKit/libohnotification.ndk.json new file mode 100644 index 000000000..24b56b30a --- /dev/null +++ b/NotificationKit/libohnotification.ndk.json @@ -0,0 +1,6 @@ +[ + { + "first_introduced": "13", + "name": "OH_Notification_IsNotificationEnabled" + } +] diff --git a/NotificationKit/notification.h b/NotificationKit/notification.h new file mode 100644 index 000000000..d7a31be18 --- /dev/null +++ b/NotificationKit/notification.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup NOTIFICATION + * @{ + * + * @brief Provides the definition of the C interface for the notification service. + * + * @since 13 + */ +/** + * @file notification.h + * + * @brief Declares the APIs of notification service. + * + * @library libohnotification.so + * @kit NotificationKit + * @syscap SystemCapability.Notification.Notification + * @since 13 + */ + +#ifndef OH_NOTIFICATION_H +#define OH_NOTIFICATION_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Checks whether this application is allowed to publish notifications. + * + * @return true - This application is allowed to publish notifications. + * false - This application is not allowed to publish notifications. + * @since 13 + */ +bool OH_Notification_IsNotificationEnabled(void); + +#ifdef __cplusplus +} +#endif +#endif // OH_NOTIFICATION_H +/** @} */ -- Gitee