Android - Monitoring for keyPress on Service - android

I have just integrated services into my android app - I am also using startForeground because it's a critical app.
So, my question is - how do I get it to revert the user to the application when they have done a keyPress on the notification / service in their Notification Panel. I have looked everywhere for this and can't find it anywhere...There isn't much point in using services if they don't get directed back to the app onKeyPress so really need to get this working.
Any help is much appreciated.
Thanks

So, my question is - how do I get it to revert the user to the application when they have done a keyPress on the notification / service in their Notification Panel.
If the user clicks on the entry in the notification panel (via touchscreen or D-pad), the PendingIntent you supplied via setLatestEventInfo() will be executed. Use an appropriate PendingIntent to bring up the activity you seek. Here is a sample application demonstrating this.

Related

Open an app which is not in background using FCM

My project is based on jitsi meet for android. I'm planning to go with react-native and firebase. The requirement is if one person calls the other person they will receive a call screen with ringtone. How can I achieve this if the app is not running in background?
This is a very tricky solution that you're trying to implement, especially it's working will vary a lot when it comes to deploying the application on Chinese OEM apps.
The process that you could instead follow is, Listen for FCM notifications along with that attach a payload to validate what kind of push notification is it. Based on that if it's a push notification for an incoming call, you can launch a foreground service which will allow your app to stay active and at the same time use a custom Broadcast Receiver. The Broadcast Receiver will receiver a trigger from your FCM Service and that will be used to open an activity that has your call screen UI.
Feel free to connect for a any help needed.
Using FCM, if there's a push notification, app automatically opens even if its not in background. But i believe you need to pass url on click of push notification of which triggers Deeplinking to actually trigger that page when the app opens, so directly it would navigate to the jitsi call page.
Check this link rn - deep link
Hope it helps. feel free for doubts

How does Setting Up Notification when user leaves the app work?

I am new to coding. I am using Android Studio with Java. I spent the last 3 hours looking for how to set up a notification display at the top when the user leaves the app so they can always click on the notification when they want to return to the app but I couldn't find anything with that action I need.
The app tracks the users GPS and I want them to be able to always be aware that when the app is running it will continue to track their GPS. So my idea is to have a notification window pop up whenever they leave the app so they can be aware the app is running in the background.
Any help will be much appreciated! I am building this app on my own as a passion project and I am taking the Udacity Google Android course. I finished the course early and working on this app for fun. We didn't learn about Notifications or GPS tracking but I am doing my best to learn new things. Thank you for your patience and help!
My app code is here for easy viewing:
https://github.com/PoetryHorizon/eloteroMan2
Use a foreground Service. For any background logic, you should be using a Service anyway, and in Android Oreo and above, you're required to have it be a foreground Service, meaning it posts a Notification.
You can then add a PendingIntent to that notification set to reopen your app. See Android's Notification documentation on how to set a PendingIntent. You'll want to use PendingIntent.getActivity(), where the Intent you pass is new Intent(someContext, YourActivity.class).

Silent notifications on Android

Hello fellow programmers.
I have a problem and would appreciate any insights.
An app that I'm developing should receive notifications - silent and regular.
When the app is open or in background everything is good, I receive every notification in a "silent" way and if logic requires it I pop a local notification.
The problem is when app is closed (cleared from background), I need to get a silent notification but every notification is handled by the operating system and pops it for the user to see.
What should I do to handle the app closed case?
Thanks.
It's not default behavior but you could achieve this by using a dirty logic. In your receiver/service class [who generates notification], just check any activity of your required application is active or not. If your application is not in active state than don't generate the notification.

How to achieve this in Android?

I am looking at Avast, Lookout for example and I am trying to understand the concept of the implementation. So it is more like asking for direction for me.
Persistent App icon in Notification bar.
Am I correct to say there are function NotificationManager is able to do it?
Scan virus during app installation, I am not interested in virus scanning but the triggering mechanism.
Some kind of Android service bind to the main app?
Main app that can be bring up in the Notification menu.
A main app that remain trigger action to the bind services?
So what do I need to read to understand? NoticationManager, Services and ??
In short, I want to load a icon in the notification bar that can bring up my app. There is a background service that perform specific task for a set interval.
Yep, NotificationManager and Notification can help you with that.
You just need to create the notification with flag FLAG_ONGOING_EVENT (to make it persistent). Even better if your service IS REALLY performing some long-running task, if so, you can start your service via Service.startForeground which needs some 'ongoing' notification for running (notification is required to notify the user that there is some work going now).
For triggering app install event, you can use BroadcastReceiver with filter by Intent.ACTION_PACKAGE_ADDED.

Is there any way I can read the notifcations that appear in my android home screen Notifications tab using java code?

The android home page displays notifications from different applications.
I would like to read those notifications using my program.
I tried to find information on that in forums and in android help but I was not able to find any information.
My actual goal is to read the notifications and if the notification is about an email from a certain person then I want to perform something in my application.(I use touch down for my email)
Any help is appreciated.
Not possible due to security reasons.
If you want to respond to events then you should try listening to them directly with intents.
You need to create an AccessibilityService and set it to listen to TYPE_NOTIFICATION_STATE_CHANGED events. This way, each time any of the application packages specified while configuring the AccessibilityService generates a new notification, the onAccessibilityEvent callback of your service will be called with all the information about the notification.

Categories

Resources