In facebook chatheads, that are part of the facebook messenger app, I noticed the following behavior: As far as I can see, the chat head itself and the opened chat screen ar
You can monitor (e.g. check every 200 ms) the top running activity, and see if it is your activity or some other activity, and know when it changes. This will also let you handle cases like an incoming call.
ActivityManager am = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
am.getRunningTasks(1).get(0).topActivity...