文件最后提交记录最后更新时间
!911 新增 observer * add sample observer 3 年前
!1111 修改应用bug * update sample 3 年前
!929 翻译已完成#I5CXTV及I5DVFX * update docs * update docs * Merge branch 'master' of gitee.com:shawn-he/app_samples * update doc 3 年前
!929 翻译已完成#I5CXTV及I5DVFX * update docs * update docs * Merge branch 'master' of gitee.com:shawn-he/app_samples * update doc 3 年前
!1069 根目录readme更新 * update README_zh.md 3 年前
!911 新增 observer * add sample observer 3 年前
!911 新增 observer * add sample observer 3 年前
!911 新增 observer * add sample observer 3 年前
README.md

Observer

Overview

This sample demonstrates how to use observer APIs to subscribe to events of network status, signal status, call status, cellular data, and SIM card status changes.

Concepts

@ohos.telephony.observer

A module that allows you to register observers to subscribe to events of mobile network, signal, call, and SIM card status changes.

Required Permissions

The following permission must be declared in the module.json5 file:

ohos.permission.GET_NETWORK_INFO: Obtains the network status.

ohos.permission.READ_CALL_LOG: Obtains the call status.

How to Use

  1. Open the application and enable all event subscription switches.

  2. Enable or disable the mobile network once to trigger a network status change.

  3. Make a call to trigger a call status change.

  4. Remove and insert the SIM card to trigger a SIM card status and signal status change.

  5. Touch the Details button. A page is displayed, showing the related status change events.

Constraints

  1. This sample can only be run on standard-system devices.

  2. This sample demonstrates the stage model, which supports only API version 9.

  3. DevEco Studio 3.0 Beta3 (Build Version: 3.0.0.901, built on May 30, 2022) must be used.