Receiving GTalk messages in own app?
Asked Answered
T

2

6

I'm new to Android Development. I'm a big fan of Android's Inbuilt Talk app, but what I hate about it is lack of customizable notification, so I decided to develop an app for it.

My requirement is an app that keeps watch over GTalk, and display pre-customized notifications when a message is received.

Please note that I don't want my app to ask user for GTalk username or password. I'm aware of Asmack library, but it is more useful for an IM Client, my requirement is just to grab the incoming message event. (Something like BroadcastReceiver for SMS?)

Is it possible to retrieve the Gtalk messages like you can retrieve SMS messages with a BroadcastReceiver?

Teucer answered 13/4, 2013 at 16:8 Comment(2)
I don't want my app to ask user for GTalk username or password please clear what do you mean by this?Succulent
He probably means that he doesn't want to create a whole new im appSecure
K
3

There are no documented and supported means of doing this, and I sincerely hope that Google didn't leave in some undocumented, unsupported, and unsecured means of doing this.

Koster answered 13/4, 2013 at 16:20 Comment(2)
Maybe there's no proper documentation, but the implementation is possible, Gtalk's super notifier app does that, It produces custom Vibrations and/or ringtones when a messages is received in GTalk, and most importantly, it doesn't ask for username and password when you install it... so I wanna know how to do that.Teucer
@CommonsWare, ah, but they did! It's "secure" in the sense that it's behind an extra permission but it's (as far as I can tell) undocumented and unsupported (though what's the use of exposing protectionLevel="dangerous" permissions if they're unsupported?).Bortz
B
2

While it's not documented, the Google Services Framework exposes permissions that give you access to the Google Talk content provider (GTalk Super Notifier uses one of those to do its magic). I couldn't find any documentation on that content provider, though, so you would have to reverse engineer it.

Here are the relevant permissions:

+ group:android.permission-group.MESSAGES
  + permission:com.google.android.providers.talk.permission.READ_ONLY
    package:com.google.android.gsf
    label:read instant messages
    description:Allows apps to read data from the Google Talk content provider.
    protectionLevel:dangerous
  + permission:com.google.android.providers.talk.permission.WRITE_ONLY
    package:com.google.android.gsf
    label:write instant messages
    description:Allows apps to write data to the Google Talk content provider.
    protectionLevel:dangerous

As an aside, it's a bizarre that Google would expose permissions with protectionLevel="dangerous" and not document their use.

Bortz answered 24/4, 2013 at 14:20 Comment(3)
Thanks! This lead me down the right track and therefor the bounty was awarded. I will probably create a demo app at some point in case someone else needs this.Dayna
@Dayna Did you ever figure out if it's possible to query Google Hangout? I'm trying to get an unread count and so far I can only get unread SMS count by observing Telephony.Sms. I've come accross permission com.google.android.gm.permission.READ_CONTENT_PROVIDER but I'm not sure of a Uri to query.Syntax
@GaBo, No I didn't. I never did figure it out so I gave up. If you happen to find a solution I would love to know. Thanks.Dayna

© 2022 - 2024 — McMap. All rights reserved.