SMS binary data not accepted on emulator

I am trying to send and receive sms binary data from my application (sdk 2.1-update 1), with no luck

I installed the following receivers in the manifest:

<receiver android:name=".MainReceiver"> <intent-filter android:priority="10"> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> <receiver android:name=".MainReceiver"> <intent-filter android:priority="10"> <action android:name="android.intent.action.DATA_SMS_RECEIVED" /> </intent-filter> </receiver> 

I tried with and without data tags for the DATA_SMS_RECEIVED action:

 <data android:scheme="sms"/> <data android:host="localhost"/> <data android:port="16001"/> 

I indicated all the permissions that I could related to sending / receiving / reading SMS or MMS, etc., to make sure that this is not a permission problem.

I am sending sms and sms data from the emulator to port 5556 to the emulator to port 5554.

The 5554 emulator receives regular sms without problems, but it does not receive sms data , and nothing appears in the inbox ..

it may never be sent, this is an example of the code that sends sms:

 SmsManager mgr = SmsManager.getDefault(); mgr.sendTextMessage("5554", null, "message", null, null); mgr.sendDataMessage("5554", null, (short) 16001, "message".getBytes(), null, null); 

The broadcast receiver simply displays a Toast message when it receives something.

I spent 5 hours trying every possible combination of receivers, data tags, port numbers , absolutely nothing was received as SMS data ..

In fact, I have no ideas.

+4
source share
1 answer

Emulators do not seem to work with sms data .. they do not throw any exceptions, but they do not send data messages. For this reason, sendDataMessage () seems to work fine, because it does not cause any errors, but the truth is that it does not send anything!

Using the device, everything works well!

+1
source

Source: https://habr.com/ru/post/1345547/


All Articles