androidsmshuawei-mobile-serviceshuawei-developershuawei-account

Huawei. Automatically Reading an SMS Verification Code


I'm using "ReadSmsManager.StartConsentAsync" and it works fine. But i have a question: Official documetation says: "Enables the service of reading SMS messages until the SMS messages that meet the rules are obtained or the service times out (the timeout duration is 5 minutes)". Can i stop this service programmatically?


Solution

    1. The ReadSmsManager class does not provide the API for proactively stopping the SM reading service.
    2. ReadSmsManager.start(this) This method is used to enable the SM reading service in the HMS Core Apk.
    3. When there is an SMS message that meets the rule, HMS Core Apk broadcasts the SMS message to your app.

    Based on the preceding three points, if your app does not want to receive SMS broadcasts from HMS Core apk, you can deregister the broadcast receiver or use code to implement that the app does not perform any processing even if it receives the broadcast.