Search code examples
androidhuawei-developers

How to allow SMS by code on android EMUI?


I developped an app that send SMS remainder by code at specified time. The B4A code Is very simple as below. I've done test on different device of different brands, and I've the iusse ONLY on recent Huawei (EMUI). Basically the SMS are not sent but not error or exception appear.

I done some debug and putted also a notification after the code for sms sending, the result is that SMS are not sended, but notification is show. No exception or error reported. Runtime permissions to sms are checked and allowed. It seam to me that something in the s.o. is preventing the execution of this code.

`

    Dim PhoneNumber as String ="XXXXXXXXXXXXXXX"
    Dim SMS As PhoneSms
    Dim Message As String = "Water level is .... "
    SMS.Send(PhoneNumber,Message)`

Is there any special setting on EMUI to allow SMS sending?


Solution

  • After some testing seem that this device won't allow this type of permission(SMS) if the app is installed by apk and not from store or b4a bridge. This don't cause an exception, but simple the code has no effect.