Foreground service android wear - android

I didn't find any documentation about that. Is it possible to create a foreground service on android wear? Usually the foreground state is related with an ongoing notification but it's not possible on wear so I'm a bit confused. Is there anyone has a foreground service on wear?

As per documentation:
"The system enforces a timeout period. If you are displaying an activity and user's don't interact with it, the device sleeps. When it wakes back up, the Wear home screen is displayed instead of your activity. If you need to show something persistent, create a notification in the context stream instead."
So, i believe it's possible to have a persistent UI (may be not an ongoing foreground notification but a card or a stack instead).
Hope it helps.

Related

Foreground service notification invisible (System app)

I am developing a system app. I am having foreground service which has a persistent notification showing on.
I want to hide that notification. as a System app can we do that?
If not as a system app can we have other options or can we make background service not killable when clearing the memory?
suggest the best replacement.
Thanks

Start foreground camera recording service in background

I'm developing app for enterprise which will be used in custom hardware setup without a display and Android 11. Now I'm debugging an app on a smartphone with a display (smartphone will be used as a platform in future but without a display). Android has a restriction (https://developer.android.com/guide/components/foreground-services#access-restrictions) for starting foreground services which are using camera or microphone in background, so I'm stuck here.
Is there any way to start this service without any user interaction? Maybe Device Policy Controller provides a way to remove this limitations?
Thank you.
P.S. App provides life safety features, user knows about filming and accepts it directly, also app informs user with text-to-speech announcement, so ethic side is ok here.
Is there any way to start this service without any user interaction? Maybe Device Policy Controller provides a way to remove this limitations?
Yes. You can start your foreground service without user interaction. You can schedule your foreground service to start at a certain time using AlarmManager or periodic time using WorkManager or start it remotely for example using FCM or even start it based on some events using BroadCastReceiver.
To start a foreground service in android O and above you must start showing a notification and specify foreground service types in manifest and at runtime. for example, in work manager, it will be like this.
To record video from foreground service, you can use Camera or Camera2 depending on your target android version. There is also CameraX which I did not use in the foreground service.
To start your app when startup you can use BOOT_COMPLETED broadCastReceiver. I hope this be helpful🙂.

Get Notification from Android OS at a specific time even if application is killed

I want to get a notification at a specific time, say at 8am and 8pm even if my application is not running.
Application must receive notification even if OS kill my application from background due to low memory.
I don't want to use Push Notification as it will require a dedicated server which I don't have.
Is there any functionality like iOS has, where OS send notification or Silent message to application irrespective if application is in memory or it is closed/Forced stop by OS/user.
You can use AlarmManager. It has these characteristics:
... operate outside of your application, so you can use them to trigger events or actions even when your app is not running, and even if the device itself is asleep. Link to documentation

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.

How do you ship/enable a separate service in android?

Is it possible to launch a service whenever a phone is booted up?
My question is that, say, I want to have a background service running in the background when the phone is booted up, once it receives a notification, say, a stock price is now above a certain price, then the user will get notified and in the notification center it will launch the actual app if a user chooses to click on it.
My question is, where do I put the tag? In my application manifest? but again, I only want the service to run automatically without user launching my app.
I see here two possibilities for you:
Is the same approach that was proposed by #triad. You can have a broadcast receiver that will start your service.
You can use push notifications. As I understand from the question it is possible in your case. I guess using push notifications will be cheaper (in the context of power) in your case.

Categories

Resources