How does Facebook Chat heads detect a home/menu press? - java

I've been trying to implement a service that displays UI similar to how facebook chatheads work. I noticed that I can detect a backpress inside of the View but I am unable to detect home presses.
I played around with the facebook chat head and I noticed that they're able to handle home presses and recent activity button presses seemlessly.
I've read this post: Detect 'home button pressed' event in android service displaying a UI (similar to facebook chatheads)
but it does not seem to help
How do you detect it?

Hi have you tried registering a BroadcastReceiver to listen to this particular intent Intent.ACTION_CLOSE_SYSTEM_DIALOGS. This will be called whenever android needs to remove temporary dialogs from the screen when home or recent apps key is pressed you can register a receiver with this intent to detect Home and Recent Apps key

Related

Go to Homescreen on Homebutton press inside my launcher-app

Im coding an app that should replace the oem launcher on my Android-HeadUnit.
Now I want to detect inside my App if the Home-Button is pressed, in order to go to the homescreen of my launcher. This should only happen if the launcher is already in the foreground.
For instance, when I'm browsing in the app-drawer, and I press the home button instead of the back-button, it should still get me to the homescreen.
I've already tried some things with Key-Detection, but it seems that this method is depreciated since lolipop.
My app should run on Api 23 and above.
Foreground app is unable detect and intercept Home button click. Because this is the only guaranteed way for user to close this app and return to home screen. Same for recent apps button
When you press Home button intent with category android.intent.category.HOME is sended to system. That way you know what activity will receive that intent, because this launcher is yours app. I've never developed launcher app but I suppose you may catch this intent is onNewIntent if your activity launchMode != standard

Disabling or hiding the home and recents buttons in android navigation

My goal is to disable or hide the home and recents buttons hence forcing the user to press the back button to quit the app. Attached is a screenshot (edited via Photoshop) to show my desired user interface.
Is there anyway to do it?
My app won't be published to the Google Play Store.
I don't mind requesting specific permissions for this to be feasible.
Screenshot below:-

What accessibility event is triggered when a notification is clicked?

So I have created a chat locking application for Whatsapp such that when user clicks on the locked contact, he/she cannot access the chat without the password or fingerprint. But on clicking the notification of that particular contact's chat, they can access the chat. So to block it, I need to know the accessibility events that get triggered on clicking the notification. I tried getting the events using AccessibilityEvent.TYPES_ALL_MASK , but none of those events have a source and and I cannot get the nodes. Do anyone know any approach to solve this problem?
Thank you.
The behavior may differ on different Android versions.
But when I tried clicking on a notification in the notification tray on a Galaxy S7 running Android 7.0 I got either AccessibilityEvent.TYPE_VIEW_CLICKED or AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED, with package name "com.android.systemui". And if I dumped the view hierarchy starting at the event source I got a FrameLayout containing 3 TextViews.

Launch a radio app as my alarm for android

First time posting.
I want to make an alarm app that launches a radio app at the set alarm time.
The app works fine when the phone is awake, the radio app launches and the radio plays at the time specified by the alarm, my issue is when the phone is locked/asleep, the radio app I want to launch will launch but not attempt to connect to the radio stream until I unlock the phone. When I unlock the phone the app is open and starts to buffer then works.
How do I get the app to connect to the radio stream while the phone is asleep?
I have tried WakeLocks (Partial WakeLocks) thinking that keeping the CPU alive would allow the app to connect to its radio stream but this did not work.
Would appreciate any input here.
EDIT: I have downloaded an app that does what i want and it seems the radio plays within the notification.
Would this be the correct direction to investigate?
Well, I figured it out after eventually.
using media player and connecting to the correct steam sorted it for me.
For anyone struggling:
Main activity you want to create all the actions for the button clicks, build an Intent and get the time from the time picker.
Alarm receiver to handle the pending Intent
Radio service class to play radio stream using Media player.
It actually was very simple in the end.
one of the things that was holding me up was the incorrect use of the stream source I was using:
I was trying: http://www.lbc.co.uk/london/radio/player/
I needed: http://www.lbc.co.uk/london/radio/player/
I obtain the correct streaming link from FAQs on the radio website.
I will post a finished sample code once I have done cleaning the app.

In Android how do I prevent the user from holding the home button to display recently launched apps?

In Android how do I prevent the user from holding the home button to display recently launched apps?
I'm assuming I need to override the onKeyDown method or have an intent filter in the Android Manifest?
This is a duplicate of Home button disable
These two questions achieved what I needed:
Home button disable
I had to do this as well Disable Lock Screen

Categories

Resources