Android ICS not receiving data sms

北战南征 提交于 2019-12-13 04:19:48

问题


My application has a static broadcast receiver that listens to specific data sms on port 50011 to wake up the application and run.

I tested the app on a wide range of android devices (android 2.1 -> android 2.3.4) and it is working perfectly. However, I am trying it now on Samsung Galaxy Nexus running Android 4.0.2 and it is failing to receive the binary sms. The OS doesn't seem to consume that SMS as it is not showing any relevant messages in logcat.

Is anyone familiar with that issue?

Here is the receiver part that I wrote in the manifest.

    <receiver 
        android:name=".SmsListener">
        <intent-filter android:priority="10" >
            <action android:name="android.intent.action.DATA_SMS_RECEIVED" />
            <data android:scheme="sms" />
            <data android:host="localhost" />
            <data android:port="50011" />
        </intent-filter>
    </receiver>

回答1:


It turned out that the application will not register its broadcast receivers until one of it's activities was launched by the user.

In my case the app didn't contain any Activity.

I added an activity and it is working again. :D

Thanks everyone for your help.




回答2:


did you define android.permission.RECEIVE_SMS permission in your app Manfest?



来源:https://stackoverflow.com/questions/9992291/android-ics-not-receiving-data-sms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!