8

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.

Community
  • 1
  • 1
pt2121
  • 11,720
  • 8
  • 52
  • 69
  • Did you try to copy their intent filters and see if it made a difference? – Darwind Sep 16 '13 at 14:40
  • Hmm ok - I actually have the same issue myself in an app of mine, but I'm just living with it ;-) You also added the permission tag on the receiver as they've done? If it's not possible to override their priority, they must be using some kind of hack to make this work. – Darwind Sep 16 '13 at 14:44
  • yeah, I really wanna know how they do this. – pt2121 Sep 16 '13 at 14:48
  • Take a look at this pastebin from my logcat, when trying to receive an SMS from my app: http://pastebin.com/eExvPwSa I don't exactly know what Go SMS is doing there, but this doesn't seem right. This log comes every time I receive an SMS. Seems like a bit of a hack to me. – Darwind Sep 16 '13 at 14:55
  • That doesn't look right to me too. pretty messy also. – pt2121 Sep 16 '13 at 14:59
  • Have you tried adding category with your intent filter as DEFAULT like the GoSMS `` ... Try that.!! – MKJParekh Sep 18 '13 at 06:52
  • @MKJParekh Thanks. Tried it. Didn't work. – pt2121 Sep 18 '13 at 16:17
  • GO SMS uses `android:priority="2147483647"` Try to use greater values than this. – Ahmed Nawaz Sep 23 '13 at 11:32
  • @AhmedNawaz I think that's the max value. – pt2121 Sep 23 '13 at 14:00
  • @EntryLevelDev then I think contact with GO SMS developers for lowering there priority value. Or on install check that if GO SMS is installed prompt user to unstall that if they want to use your application. – Ahmed Nawaz Sep 24 '13 at 04:47
  • @AhmedNawaz Yes, thanks. I might end up ask users to disable the GO SMS feature. – pt2121 Sep 24 '13 at 13:47
  • I've reached out to developers of Handcent SMS, GO SMS, and VZW Messages. They all found some way to take highest priority. I haven't tested who wins when these three apps go at it.. Just the above code versus any of them loses. – gauglerb Jan 01 '14 at 21:35

2 Answers2

3

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

siva
  • 1,429
  • 3
  • 26
  • 47
0

As the question you are linking to explains, once the GO SMS app's receiver gets called, they can call abortBroadcast(). Assuming they are using the highest priority possible (=2147483647), I would assume that the following snippet from the docs would apply:

The order receivers run in can be controlled with the android:priority attribute of the matching intent-filter; receivers with the same priority will be run in an arbitrary order.

However, since they always happen to intercept SMS before your app, I would assume that the magic is somewhere else. Among their permissions, they have the following:

  • "android.permission.PERSISTENT_ACTIVITY"
  • "android.permission.WRITE_SMS"
  • "android.permission.READ_SMS"

Do you mind trying a combination of these, to see if it affects the ordering of intent resolution?

verybadalloc
  • 5,768
  • 2
  • 33
  • 49