11

Go SMS recently updated with a new feature "Disable other message notification". The feature causes other applications listening to the incoming SMS broadcast to not fire. For example my application, Shady SMS, listens to the incoming SMS broadcast to send notifications and to actually extract and save the SMS message.

When this new feature in Go SMS is enabled, Shady does not send a notification or save the message ultimately not responding at all to the incoming SMS broadcast.

Go SMS must somehow be unregistering my application's broadcast receiver because the incoming SMS broadcast cannot be aborted. My intent filter is set to android:priority="0".

Any thoughts?

Jim
  • 10,172
  • 1
  • 27
  • 36
Noah Seidman
  • 4,359
  • 5
  • 26
  • 28

5 Answers5

21

GoSMS does have the priority set to 2147483647, but that is not "maximal" (it is the largest integer) - it is too high. Android documentation for SYSTEM_HIGH_PRIORITY is 1000 (http://developer.android.com/reference/android/content/IntentFilter.html#SYSTEM_HIGH_PRIORITY) and app priority levels should be below this - it is not a system app.

This will create unpredictable behavior. (GoSMS does not always dismiss other app notifications - the abortBroadcast only works when they get it first, usually based on installation order, but not always.) System level apps will execute, then Android will try to sort out non-system apps. If you look at the source code, the order of execution is based on priority level, but the calls to select the order of apps is not consistent for apps over 999 or for apps with the same priority level. It might be in order of installation, but system changes can result in other orders of execution (which I have seen many times with testing this).

This should really be fixed by GoSMS (and many other apps that have it wrong). Just because "priority" is an integer it does not mean that the highest value of integer makes for the highest priority level. (Just like a web URL is a string, but not all string values are valid.) Also, GoSMS should know that other apps may want to process SMS messages that are not visible to the user. If they capture it and display it to the user, that is pointless.

Jim
  • 10,172
  • 1
  • 27
  • 36
  • 12
    I HATE Go SMS for doing this. It's one of the most invasive things you can do in an app on a users phone. They need to let the broadcast pass through! – Camille Sévigny Aug 25 '11 at 19:39
  • 2
    I think it's ok to abort the broadcast, and in their case users wants it by selecting the proper option regarding this.. What is unfair is that they are using the absolute maximum priority.. I've sent them an email about it and am hoping that it will get fixed soon – Tolga E Jan 14 '12 at 19:16
  • @Jim GO SMS should know, but it tries not to know – Mohsen Afshin Nov 08 '12 at 16:27
  • 1
    This is old, but I wanted to comment that first - I've told them. Second, I've told others. And third, it seems to me that it violates Google Policy since the setting actually interferes with the proper behavior of other apps. However, Android needs a way for a user to "order" apps that request priority 999 (the proper maximum); but communicating it to a user would be extremely difficult. Maybe supplement the new JellyBean feature where users have the ability to turn permissions on and off at the app level after install? Add a priority sort order to ordered broadcasts – Jim Sep 26 '13 at 22:42
13

My intent filter is set to android:priority="0".

This is the lowest possible priority. All other applications will get their chance first before it comes to you. Quoting the documentation:

It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it's ignored for asynchronous messages.)

So, they are simply calling abortBroadcast(). They probably have their priority jacked to the roof.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I think they are doing something funny. In Go SMS you can disable the feature. When disabled Shady sends its notification, and then Go SMS sends its. So with the feature disabled Shady responds to the incoming sms broadcast first, inferring that Go SMS isn't receiving the broadcast first for it to be aborted in turn for Shady not to see it. – Noah Seidman Jul 06 '11 at 17:30
  • I tried settings the priority to 2147483647 and aborting the broadcast after I fire my thread in the receiver. Go SMS still bypasses my receiver. The priority takes an int and even with the max values it is still overridden. – Noah Seidman Jul 06 '11 at 17:44
  • 2
    I just checked their apk and they do indeed set the priority of the intent filter to 2147483647. Based on SDK rules it seems like there is no way to prevent their application from preventing other apps from receiving the incoming sms broadcast. Their priority is the max possible. Also I think the incoming sms broadcast is asynchronous so I'm not quite sure how they are aborting it. – Noah Seidman Jul 06 '11 at 18:21
  • 1
    @Noah Seidman: No, the SMS broadcast is definitely ordered. I do not know the tie-breaker for priorities, so I do not know what happens with N apps all at the same priority level. – CommonsWare Jul 06 '11 at 20:27
  • What about this thread from '08 http://groups.google.com/group/android-developers/browse_thread/thread/78fecbc156f4a1ea – Noah Seidman Jul 06 '11 at 22:41
  • @Noah Seidman: That is from 2008. This is 2011. It is an ordered broadcast. You can tell this from [looking at the source code](http://www.google.com/codesearch#cZwlSNS7aEw/frameworks/base/telephony/java/com/android/internal/telephony/SMSDispatcher.java&exact_package=android&q=SMS_RECEIVED&l=672) or by [actually writing code to abort the broadcast](https://github.com/commonsguy/cw-advandroid/tree/master/SMS) – CommonsWare Jul 06 '11 at 23:35
  • After some playing around you can set the priority to max int, and then abort the incoming sms broadcast. This works fine for the stock sms messager which has no priority set in the manifest. Go SMS has a max int priority. I tried to abort the broadcast with the new Go SMS feature unchecked, and everything worked as expected. I then checked the new feature and then my receiver no longer fires. It's almost like Go SMS is able to set a priority higher than max int. – Noah Seidman Jul 06 '11 at 23:41
  • 1
    @Noah Seidman: Or it's first-app-installed wins, and you have been leaving Go SMS alone. Or some other tie-breaker. – CommonsWare Jul 06 '11 at 23:47
  • 1
    I'll check the first app installed concept. The docs don't want priorities higher than 1000: http://developer.android.com/reference/android/content/IntentFilter.html#SYSTEM_HIGH_PRIORITY and Go SMS uses max int, what a pain in the neck. – Noah Seidman Jul 06 '11 at 23:48
  • Your absolutely right. The tie breaker is first app installed. Excellent analysis, thank you for your assistance. – Noah Seidman Jul 07 '11 at 00:02
  • Did you do any found any solution ? – ahmed_khan_89 Apr 11 '14 at 12:31
3

I think we did a fix for that and It worked :) We start the Broadcast Receiver via code

IntentFilter filter = new IntentFilter();
    filter.addAction("android.provider.Telephony.SMS_RECEIVED");
    filter.setPriority(2147483647);
    receiver = new SmsAnalizer();
    ac.registerReceiver(receiver, filter);

This worked and we get the job done.

Arunoda Susiripala
  • 2,516
  • 1
  • 25
  • 30
2

Download apktool http://code.google.com/p/android-apktool/

download Auto-sign Created By Dave Da illest 1 http://www.mediafire.com/?j9n7o6ub9urkfwy

in folder have extracted apktool and NICEBUTWRONGLYWRITTEN.APK run cmd in cmd apktool d -d NICEBUTWRONGLYWRITTEN.APK modif1 wait go into dir modif1 find first visible XML file, find inside this value V=2147483647 (search for number 2147483647) replace it with 1 close file saving. run in cmd window apktool b -d modif1/ newsmsapp.apk wait until build complete

take builded newsmsapp.apk into directory with signapk, paste it there run cmd cd to directory with signapk type: sign newsmsapp.apk

install on your phone newsmsapp.apk

done.

NotXTAM
  • 21
  • 1
  • I followed your instructions to a t, apk got rebuilt and signed with no errors, but when i went to install it, i got application not installed error .... Also another questions, there are 3 instances of that value in the manifest xml file, do i change all of them to 1 or just the first one? Assuming the not installing issue can be resolved... Appreciate any help on this –  Oct 07 '11 at 01:15
0

Go SMS Pro's priority is maximal 2147483647 (2^31-1). You can set this value too. If priorities are the same Android OS will serve "older" app, the one you have installed first. I say this from my experience I don't have google's say on the matter.

Nemanja Kovacevic
  • 3,510
  • 2
  • 30
  • 45
  • I can confirm that this theory of oldest-app-wins is not true. Neither is newest-app-wins. Maybe its package name. Wish Google would tell. – PVS Apr 10 '12 at 20:39
  • i check that package name does not prioritize app to receive intent – Asim Habib Oct 13 '14 at 11:26