How to detect when Facebook messenger is bubble is opend?
Asked Answered
U

2

2

Facebook uses a service to push the messenger bubble on android - something like the follows: http://www.piwai.info/chatheads-basics/

I want to detect when the bubble is opened / closed

I've started investigating the following options -

  • Listen (By pulling) to the running services - I found out there are 4 services when the messenger is shown and 2 when it's killed. I want to know when the messenger bubble is close so it doesn't help me.

  • Listen to the notifications - I know when it's removed completely (when user drags it to the 'X' area) - also didn't help.

I'm looking for a hack to know when does the Facebook bubble is opened and when does it closes.

Uncrowned answered 24/12, 2014 at 7:10 Comment(0)
H
1

By open\closed did you mean that the chat bubble remains on screen and the chat window is opened\closed, or that the bubble is either visible or invisible? In case of the latter:

Inspecting the AndroidManifest.xml we can see the following:

<receiver android:name="com.facebook.orca.chatheads.service.ChatHeadsServiceBroadcastReceiver"
          android:permission="com.facebook.permission.prod.FB_APP_COMMUNICATION">
    <intent-filter android:priority="499">
        <action android:name="com.facebook.orca.chatheads.ACTION_SHOW_CHATHEADS"/>
        <action android:name="com.facebook.orca.chatheads.ACTION_HIDE_CHATHEADS"/>
        <action android:name="com.facebook.orca.chatheads.ACTION_SET_CHATHEADS_POLICY"/>
    </intent-filter>
</receiver>

You could possibly try to intercept these broadcasts inside a service of your own and track the opening\closing of the bubbles somehow.


(Disclosure: I never tried anything like that myself, and would be happy to revise\delete this answer if this suggestion proves impractical)

Hydrothermal answered 5/2, 2015 at 23:36 Comment(3)
This is great. The question is the ACTION_SHOW_CHATHEADS intent is sent as a public broadcasts. hence - does other apps can receive it. will check now.Uncrowned
One way to find out :) בהצלחה ~~ However, considering the official docs on broadcasts: "Receivers used with the Context APIs are by their nature a cross-application facility, so you must consider how other applications may be able to abuse your use of them." - you may be in luck :)Hydrothermal
What seems to be the problem?Hydrothermal
L
0

I am afraid you cannot do that.

To do that Facebook app should use one of the public Android APIs like Broadcasts or even Notifications. But they are not using any of them.

When user close the bubble, it just close internally. You cannot access it.

You may access it using something called xposed framework for rooted devices.

Letitialetizia answered 24/12, 2014 at 8:4 Comment(5)
Well that is why I'm thinking on solving this in the android level. Like listen to one of the services that this process have (For example analytics process) and then I can check when was the last time he was active. and this service gets active everytime the user presses on the bubble. the problem with this solution is that this service also get updated when someone sends a messageUncrowned
Are you trying to do it on non-rooted devices?Letitialetizia
I think you cannot do that. That is the Android ecosystem. You cannot get more from the other app unless it shares more with you. That is there for security.Letitialetizia
I want to believe I can. I understand security on Android. Yet I believe in an os hack or something the app is telling me. a trigger I can use to know that.Uncrowned
I am following this thread to know if you can. I would like to know. If you do it, please post it as an answer. Android is one of the most secure operating systems in the world. Every application has its own user space. It is like 200 users if you 200 apps installed.Letitialetizia

© 2022 - 2024 — McMap. All rights reserved.