I have created a service for calculating Steps. Obviously it will be running in background always . So I used startForground(1, notification) method. But I don't want to show notification as it is very irritating for users as they are keep telling. I want to remove it. I tried link to achieve it, but no gain. Is there any trick ??
Asked
Active
Viewed 226 times
1
-
The link you have posted says clearly "As a security feature of the Android platform, you cannot, under any circumstance, have a foregrounded service without also having a notification" – B001ᛦ Jul 16 '18 at 10:13
-
fortunately you cannot do it: i wouldn't like dozens of foreground services running without my knowledge... – pskink Jul 16 '18 at 10:43
-
1It might be possible to reduce the annoyance by providing a better notification? For example, my media player notification doesn't annoy me because it shows the album art, current track, play/pause buttons and forward/rewind buttons. It is useful and informative... – Elletlar Jul 16 '18 at 11:07
1 Answers
1
As per the documentation and link you have shared yourself, you cannot achieve this due to obvious security reasons.
And as you mentioned you are creating service for calculating Steps, You may need to use Location Service in background as well, So as per Android Location Limits,
The system distinguishes between foreground and background apps. An app is considered to be in the foreground if any of the following is true: It has a visible activity, whether the activity is started or paused. It has a foreground service.
You have to use Foreground Service with Notification as to tell user your app is receiving location updates.
So in nutshell Foreground Service without notification cannot be achieved

adityakamble49
- 1,971
- 18
- 27