GithubHelp home page GithubHelp logo

Comments (7)

Dev-hwang avatar Dev-hwang commented on July 19, 2024

A foreground service is required to track background location on the Android platform. The notification serves to notify the user that the foreground service has started.

So, if you want to remove the notification, you don't need to use the WillStartForegroundTask widget. However, it may not be able to track your location in the background.

from geofence_service.

hrtzzz11 avatar hrtzzz11 commented on July 19, 2024

Alright, understand. And what about those two notifications? The upper one is created with an other plugin. The one below is the one from WillStartForegroundTask() (see code below). Is this lower one even visible when the user got the app on a real device (because that's how I want it)?

home: WillStartForegroundTask(
onWillStart: () async {
// You can add a foreground task start condition.
return _geofenceService.isRunningService;
},
androidNotificationOptions: const AndroidNotificationOptions(
channelId: 'geofence_service_notification_channel',
channelName: 'Geofence Service Notification',
channelDescription:
'This notification appears when the geofence service is running in the background.',
channelImportance: NotificationChannelImportance.NONE,
priority: NotificationPriority.MIN,
isSticky: false,
visibility: NotificationVisibility.VISIBILITY_SECRET,
showWhen: false,
),
iosNotificationOptions:
const IOSNotificationOptions(showNotification: false),
notificationTitle: 'xxx',
notificationText: 'yyy',
child: Scaffold(.........

sc

from geofence_service.

Dev-hwang avatar Dev-hwang commented on July 19, 2024

A notification must be created to start a foreground service. A foreground service is also called a service that is visible to the user. So, just because a channel is of low importance cannot hide a notification.

from geofence_service.

Dev-hwang avatar Dev-hwang commented on July 19, 2024

I don't speak English well, so I didn't understand what the question was. It would be helpful to answer if you could explain a little more.

from geofence_service.

hrtzzz11 avatar hrtzzz11 commented on July 19, 2024

Yes, no problem, thank you for taking your time :-)

I don’t want the user to get notifications when the foreground task (method willStartForegroundTask)
() ) is called. Therefore, i set (for iOS) iosNotificationOptions:
const IOSNotificationOptions(showNotification: false) and now the notification of this method isn’t shown on iOS

For Android, i want to do the same but there isn’t a similar boolean like „showNotification“ and i can’t set androidNotificationOptions: null because then the app crashes. That’s why i set IMPORTANCE_NONE, but the notification is still there (see the picture, it it the lower notification with grey icon), and somehow you can’t delete this notification on the simulator.

So two questions:

  1. Is it possible to not show the Android notification (like the iOS notification with the boolean showNotification)?
  2. Will the notification on a real device be shown, when it’s set IMPORTANCE_NONE?

from geofence_service.

Dev-hwang avatar Dev-hwang commented on July 19, 2024
  1. No. The notification could not be removed. To start the foreground service according to the Android platform's policy, must create a notification.

  2. For the same reason as above, the notification appears even if the notification importance is set to 'NONE' or 'LOW'. Also, users cannot remove notifications.

from geofence_service.

hrtzzz11 avatar hrtzzz11 commented on July 19, 2024

Aight thank u! :)

from geofence_service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.