Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not get sms even when set the highest priority and installed first

My app does not receive SMS when Go SMS is installed. I set the highest priority and have tried installing my app before installing the Go SMS app. However, Go SMS always get SMS before mine. (The first-app-installed concept doesn't work on my phone.)

I am curious what the Go SMS developers do. How can their app always intercept SMS before mine?

My app works fine without the Go SMS. Anyway, here is my manifest. Maybe I've done something wrong.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.ansmsreceiver"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.test.ansmsreceiver.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <receiver android:name="com.test.ansmsreceiver.SMSReceiver" >
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            <action android:name="android.provider.Telephony.NEW_OUTGOING_SMS" />
        </intent-filter>
    </receiver>
</application>

I found other questions related to my issue but still can't find the way to fix it.

Edit: my test project is on Github: https://github.com/entryleveldev/ansmsreceiver.

Edit2: still not sure how android decides which receiver get the intent first. From what I've tested, Go SMS always gets the intent. UID and install order do not matter. But when I tested my app and Handcent SMS, the install order does matter. Maybe Go SMS uses some kind of a hacky way to do this.

Here's the SmsReceiver in Go SMS manifest.

<receiver android:name=".smspopup.SmsReceiver" android:permission="android.permission.BROADCAST_SMS">
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
            <category android:name="android.intent.category.DEFAULT"></category>
        </intent-filter>
        <intent-filter android:priority="2147483647">
            <action android:name="android.provider.Telephony.GSM_SMS_RECEIVED"></action>
            <category android:name="android.intent.category.DEFAULT"></category>
        </intent-filter>
        <intent-filter >
            <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"></action>
            <data android:mimeType="application/vnd.wap.mms-message"></data>
        </intent-filter>
        <intent-filter >
            <action android:name="com.android.mms.transaction.MESSAGE_SENT"></action>
        </intent-filter>
    </receiver>

Their default setting is to disable other message notification (abortBroadcast). This is really bad to me.

like image 504
pt2121 Avatar asked Jun 05 '13 16:06

pt2121


1 Answers

I have faced the same problem.

As per the documentation by Android, Highest priority must be 1000 http://developer.android.com/reference/android/content/IntentFilter.html#SYSTEM_HIGH_PRIORITY

But this application is using a higher priority evading the guidelines.

http://forum.avast.com/offline/forum.theftaware.com/viewtopic5dcd.html

Don't Be Evil You better follow the guidelines.

Cheers

like image 187
siva Avatar answered Jan 02 '23 09:01

siva