react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Android notification disappears when app in foreground

Open shashanksinghal opened this issue 8 years ago • 8 comments

After upgrading from 0.5.0-alpha.25 to 0.5.0-alpha.27, I noticed that the icon and text in notification (status) bar disappears when app is in foreground. He appears as soon as you hit home button or make app in background

Also appears in https://github.com/kruyvanna/react-native-background-geolocation.git which I am using with gradle 3

Your Environment

  • Plugin version: 0.5.0-alpha.27
  • Platform: Android
  • OS version: 8.1.0
  • Device manufacturer and model: Mi 5
  • React Native version: 0.55.4
  • Plugin configuration options:
  • Link to your project:

Context

Expected Behavior

Notification icon should never disappear as long as location tracking is on

Actual Behavior

Notification icon should disappears when app is in foreground

Possible Fix

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

shashanksinghal avatar May 22 '18 08:05 shashanksinghal

I will update with logs and more details when I am back. Sorry for not filing fully.

shashanksinghal avatar May 22 '18 08:05 shashanksinghal

This is expected behavior starting alpha 26. Notification is only used when app is background.

https://github.com/mauron85/react-native-background-geolocation/blob/master/CHANGES.md

mauron85 avatar May 22 '18 08:05 mauron85

Oh ok, thanks for the update and sorry for missing change log.

Is it possible through some configuration to always show the notification. In my case the target app audience is trained to see the icon when they are on duty. Don't want to re train them.

Regards

shashanksinghal avatar May 22 '18 08:05 shashanksinghal

No problem at all ;)

Interestingly people was asking exactly for opposite :D - how to hide notification.

I think this new approach is the most common among Android apps and all google examples are using it.

So to answer question. There is no way to force notification when app is in foreground and I don't plan to readd it in the future. Sorry for that.

mauron85 avatar May 22 '18 08:05 mauron85

Wow, appreciate the super quick follow up :-) Thanks

I still think it still should be a configuration to support both cases.

Also, I noticed in WhatsApp notification 'Whatsapp Web is connected' shows always irrespective of app state. Can't think of other apps as of now.

To me, its actually confusing when the icon disappears. Can't tell whether I called stop or its just the app in foreground. Also the phone vibrates each time app goes in background now (Not sure how to turn that off). Maybe I am used the older approach.

Regards

shashanksinghal avatar May 22 '18 08:05 shashanksinghal

Ok I ll think about it.

On Tue, 22 May 2018 at 10:55, Shashank Singhal [email protected] wrote:

Wow, appreciate the super quick follow up :-) Thanks

I still think it still should be a configuration to support both cases.

Also, I noticed in WhatsApp notification 'Whatsapp Web is connected' shows always irrespective of app state. Can't think of other apps as of now.

To me, its actually confusing when the icon disappears. Can't tell whether I called stop or its just the app in foreground. Also the phone vibrates each time app goes in background now (Not sure how to turn that off). Maybe I am used the older approach.

Regards

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/mauron85/react-native-background-geolocation/issues/197#issuecomment-390914767, or mute the thread https://github.com/notifications/unsubscribe-auth/AAV8Ggy7bZ3I8NCAF8yfgmPmR4v8sry3ks5t09KMgaJpZM4UIKff .

mauron85 avatar May 22 '18 09:05 mauron85

FYI: Alpha 28 has back option startOnForeground. It has different meaning and default value, but basically set it true and you'll get old behavior. Also read CHANGES.md.

mauron85 avatar May 22 '18 15:05 mauron85

Oh, thanks a lot +1

Will test once kruyvanna merges the changes as I have gradle 3.

Thanks again :-)

shashanksinghal avatar May 23 '18 05:05 shashanksinghal