coder9042 / gtalksms

Automatically exported from code.google.com/p/gtalksms
0 stars 0 forks source link

gtalkSMS message notifications from hangouts (replaced gTalk) on handset #326

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Now that google have replaced the gTalk app with Hangouts, I get a hangout 
notification on my phone (from gTalkSMS) every time I receive an SMS. This 
didn't happen with the gTalk app, so I can only assume that gtalkSMS was 
suppressing them.

I'm using gTalkSMS 4.3.

What steps will reproduce the problem?
1. Receive an SMS message on phone
2.
3.

What is the expected output?
1. Other gTalk / hangouts sessions will receive a notification from gTalkSMS 
with the content of the SMS
2. No other visible notification or indication on phone (as the SMS app will 
have already given its own notification)

What do you see instead?
1. Other hangouts / gTalk sessions get notified as expected
2. I get a 'Hangouts' notification on the phone of a new message (with content 
of the SMS)

Additional informations:
Phone model: LG Nexus 4

Original issue reported on code.google.com by t...@gettheitguy.com on 19 May 2013 at 9:45

GoogleCodeExporter commented 9 years ago
I have the same issue. 

I've noticed that the "resource" portion of the XMPP JID for my Hangouts 
(Android) connection seems to start with "Messaging", followed by what looks 
like a hexadecimal ID.  This is as opposed to the old Talk (Android) 
connection, which has a resource of "android_talk", followed by some other 
identifier. Gmail (pre-hangouts), for example, uses a resource of "gmail." 
followed by an identifier.

Original comment by clo...@gmail.com on 22 May 2013 at 12:08

GoogleCodeExporter commented 9 years ago
Ah I think the issue is probably in the code below where it tries to ignore 
XMPP presences starting with "android", which will no longer work with Hangouts.

I wonder if Hangouts actually has a distinct resource on Android vs elsewhere.  
I'll see if I can figure that out.

https://code.google.com/p/gtalksms/source/browse/src/com/googlecode/gtalksms/Xmp
pManager.java#669

                        // Don't send messages to GTalk Android devices
                        // It would be nice if there was a better way to detect 
                        // an Android gTalk XMPP client, but currently there is none
                        if (toResource != null && !toResource.equals("") && (false || !toResource.startsWith("android"))) {
                            toList.add(toPresence);
                        }

Original comment by clo...@gmail.com on 22 May 2013 at 12:22

GoogleCodeExporter commented 9 years ago
You are correct that GTalkSMS tries to not send notifications to the device 
where GTalkSMS runs. If one could configure the resource part of a Hangout 
installation, GTalkSMS could use this information to suppress the message to 
that particular full JID. But since this is not possible, we filter out 
resources that start with 'android'. My guess is that the new Hangouts app 
follows a similar approach. If some people could confirm this and tell us the 
stable resource part, we could filter it as well.

Original comment by fschm...@gmail.com on 23 May 2013 at 4:59

GoogleCodeExporter commented 9 years ago
I have observed the following (exact casing!):
 - Android device starts with "MessagingA"
 - iOS device starts with "MessagingB"
 - Google+ chat: starts with "messaging-TalkGadget"
 - Old chat in Gmail: starts with "gmail"
 - New hangouts chat in Gmail: starts with "messaging-smgmail"

I hope it's useful :)

Original comment by mel...@gmail.com on 2 Jun 2013 at 6:38

GoogleCodeExporter commented 9 years ago
If you're not aware of it, there's a work-around to at least not get the 
statusbar notifications and ringtone; 

Option A: Long-press on the conversation item and click the bell icon on the 
action bar.
Option B: Open the conversation, press menu and select People & Options. 
Disable notifications.

Original comment by paal.nil...@gmail.com on 13 Jun 2013 at 12:38

GoogleCodeExporter commented 9 years ago
I just tried the workaround above. However, that disables notifications to ALL 
devices/clients, so isn't much use. I.e., the notification no longer pops-up in 
gmail chat, which defeats the main purpose!

I have uninstalled hangouts again for now (rolled-back to google talk).

Is there any update on progress for a real fix? It looks as though the info in 
comment #4 should provide the necessary info, but I don't have the necessary 
tools to compile and test myself.

If there is a beta version with a fix in then I'll be happy to test it.
Thanks,
Toby

Original comment by t...@gettheitguy.com on 14 Jun 2013 at 10:34

GoogleCodeExporter commented 9 years ago

Original comment by Florent....@gmail.com on 1 Oct 2013 at 9:38

GoogleCodeExporter commented 9 years ago
This issue was closed by revision db3d469cd0eb.

Original comment by yako...@gmail.com on 6 Oct 2013 at 4:47

GoogleCodeExporter commented 9 years ago
4.4.2 Beta 2 available in the Download section

Original comment by Florent....@gmail.com on 18 Oct 2013 at 10:14

GoogleCodeExporter commented 9 years ago
Final version 4.4.2 available in the Download section

Original comment by Florent....@gmail.com on 20 Oct 2013 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by Florent....@gmail.com on 26 Oct 2013 at 1:07

GoogleCodeExporter commented 9 years ago
Doesn't seem to work for me with 4.4.2.  I checked and my XMPP resource for my 
phone does start with "MessagingA".  In the app in the Connection Settings, the 
"Blocked resources..." was set to "android|MessagingA" but I changed it to a 
newline instead of a pipe ("|") separator, although that did not seem to fix it.

My install history is that I had the app installed from the Market, and a month 
or so ago updated (from the Market) to 4.4 and ran into issue 336, so I 
manually downgraded my APK to 4.3.  Then I later updated (from the Market) to 
4.4.1 and then 2 days ago to 4.4.2.

Original comment by clo...@gmail.com on 28 Oct 2013 at 11:43

GoogleCodeExporter commented 9 years ago
Ok thanks for the feedback.
I probably had a regression during my refactoring of the settings by putting a 
"|" instead of "\n"

Can you try to let only MessagingA?

Original comment by Florent....@gmail.com on 28 Oct 2013 at 11:55

GoogleCodeExporter commented 9 years ago
If I set the "Blocked resources..." setting in the preferences to just 
"MessagingA", it still does not work.  I'm not sure if it takes effect 
immediately or if I have to reconnect or quit the app entirely, but I tried all 
of those.  Hangouts on my phone still receives the message and displays it to 
me.

Original comment by clo...@gmail.com on 29 Oct 2013 at 12:01

GoogleCodeExporter commented 9 years ago
Here is a debug log.  The log would imply that it is trying to do the right 
thing.

D/gtalksms(26218): Message not sent to XXXXXXXX@gmail.com/MessagingAXXXXXXXX 
because resource is blacklisted
D/gtalksms(26218): Sending message to XXXXXXXX@gmail.com/gmail.XXXXXXXX
D/gtalksms(26218): MainActivity: onStop()
W/System.err(26218): feature-not-implemented(501)
W/System.err(26218):    at 
org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryMa
nager.java:604)
W/System.err(26218):    at 
org.jivesoftware.smackx.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryMa
nager.java:570)
W/System.err(26218):    at 
org.jivesoftware.smackx.MultipleRecipientManager.getMultipleRecipienServiceAddre
ss(MultipleRecipientManager.java:301)
W/System.err(26218):    at 
org.jivesoftware.smackx.MultipleRecipientManager.send(MultipleRecipientManager.j
ava:100)
W/System.err(26218):    at 
org.jivesoftware.smackx.MultipleRecipientManager.send(MultipleRecipientManager.j
ava:72)
W/System.err(26218):    at 
com.googlecode.gtalksms.XmppManager.send(XmppManager.java:746)
W/System.err(26218):    at 
com.googlecode.gtalksms.MainService.onHandleIntent(MainService.java:276)
W/System.err(26218):    at 
com.googlecode.gtalksms.MainService$ServiceHandler.handleMessage(MainService.jav
a:151)
W/System.err(26218):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(26218):    at android.os.Looper.loop(Looper.java:137)
W/System.err(26218):    at android.os.HandlerThread.run(HandlerThread.java:61)

Original comment by clo...@gmail.com on 29 Oct 2013 at 12:21

GoogleCodeExporter commented 9 years ago
Regarding the logs, even if the MultipleRecipientManager.send fails, the 
message is sent only to the not blacklisted resources.

Are you using the same account on your phone and for the notified address ? 
(ie. the address used to send commands)
If it's not the case, I think that google might dispatch itself the message to 
all the connected devices (even if we don't send the message directly to them)

BTW there is a issue on the default value which was using | instead of \n

Original comment by Florent....@gmail.com on 30 Oct 2013 at 9:32

GoogleCodeExporter commented 9 years ago
Regarding the logs, even if the MultipleRecipientManager.send fails, the 
message is sent only to the not blacklisted resources.

Are you using the same account on your phone and for the notified address ? 
(ie. the address used to send commands)
If it's not the case, I think that google might dispatch itself the message to 
all the connected devices (even if we don't send the message directly to them)

BTW there is a issue on the default value which was using | instead of \n

Original comment by Florent....@gmail.com on 30 Oct 2013 at 9:32

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 03086fbda82f.

Original comment by yako...@gmail.com on 30 Oct 2013 at 9:42

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 2c00c6fb1064.

Original comment by yako...@gmail.com on 30 Oct 2013 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by Florent....@gmail.com on 30 Oct 2013 at 9:47

GoogleCodeExporter commented 9 years ago
No, I am using 2 different accounts.  One for gtalksms as the sender, and a 
separate one for the recipient of notifications.  Yes I suspect that you are 
right and that google has  changed their back end to send messages to every 
XMPP resources even if those messages are designated only for a subset of 
resources for that user. 

Original comment by clo...@gmail.com on 30 Oct 2013 at 11:30

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 0f3e6740aee7.

Original comment by yako...@gmail.com on 10 Nov 2013 at 6:29

GoogleCodeExporter commented 9 years ago
I've added some modification in 4.4.4.75 available on the beta program of 
google Play.
Can you provide me some feedback ?

Thanks

Original comment by Florent....@gmail.com on 10 Nov 2013 at 6:30

GoogleCodeExporter commented 9 years ago
4.4.4.75 deployed in production

Original comment by Florent....@gmail.com on 20 Nov 2013 at 4:48

GoogleCodeExporter commented 9 years ago
This doesn't seem to be working anymore. I don't really use Hangouts myself, 
but can't use it due to this issue. I've tried to turn others onto Gtalksms but 
can't due to this issue.

Original comment by catlvr...@gmail.com on 26 Dec 2013 at 8:53