Comments (4)
There seems to be a feature conflict when using the singleton object UNUserNotificationCenter.current()
concurrently on the iOS platform. This can be temporarily resolved as follows. I'll let you know when the problem is resolved.
@override
Widget build(BuildContext context) {
Widget child = Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Container(),
);
if (Platform.isAndroid) {
child = 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.LOW,
priority: NotificationPriority.LOW,
isSticky: false,
),
// iosNotificationOptions: const IOSNotificationOptions(),
notificationTitle: 'Geofence Service is running',
notificationText: 'Tap to return to the app',
child: child,
);
}
return MaterialApp(home: child);
}
from geofence_service.
Unfortunately the temporary solution isn't quite fitting for the project my team is working on as the geofence service is more or less an essential part of the app, along with the notifications.
So I would like to ask, is this an issue you would be looking to resolve in the short term? (and if so, would it be possible to know the estimated time? )
from geofence_service.
In version 3.4.6
, this issues has been fixed.
- Upgrade dependencies.
dependencies:
geofence_service: ^3.4.6
- To display a notification when your app enters the background, you need to open the
ios/Runner/AppDelegate
file and set the following:
Objective-C:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// here
if (@available(iOS 10.0, *)) {
[UNUserNotificationCenter currentNotificationCenter].delegate = (id<UNUserNotificationCenterDelegate>) self;
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
Swift:
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// here
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
from geofence_service.
If the problem persists despite upgrading the plugin, please create a new issue.
from geofence_service.
Related Issues (20)
- WillStartForegroundTask blocks WillPopScope HOT 1
- Updating the data on iOS HOT 1
- Not working when app is removed HOT 4
- Unable to kill app from Paused state in Android HOT 2
- Notification when DWELL HOT 2
- Remove Notification HOT 7
- Multiple _geofenceServices HOT 1
- send text between devices HOT 4
- unable to get any notification HOT 1
- java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient, HOT 3
- Issue with shared_preferences package HOT 2
- fl_location version needs to be updated
- not working in the background
- Geofence is not working on background state HOT 1
- I want to run Geofence_Service in the background HOT 2
- How can I trigger a notfication for the app to open a view
- GeoFence runs in Background
- onGeofenceStatusChanged does not work in release HOT 1
- ForegroundServiceDidNotStartInTimeException - Context.startForegroundService() did not then call Service.startForeground()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geofence_service.