· 6 years ago · Oct 03, 2019, 11:08 AM
1import UIKit
2import Flutter
3import GoogleMaps
4import Fabric
5import Crashlytics
6import gps_service_plugin
7
8
9@UIApplicationMain
10@objc class AppDelegate: FlutterAppDelegate {
11
12 override func application(
13 _ application: UIApplication,
14 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
15 ) -> Bool {
16 // Register the plugins with the AppDelegate
17 registerPlugins(self)
18
19 // Set registerPlugins as a callback within GeofencingPlugin. This allows
20 // for the Geofencing plugin to register the plugins with the background
21 // FlutterEngine instance created to handle events. If this step is skipped,
22 // other plugins will not work in the geofencing callbacks!
23 SwiftGpsServicePlugin.setPluginRegistrantCallback(registerPlugins)
24
25 // Initialize crashlytics
26 Fabric.with([Crashlytics.self])
27
28 // Sut Google Maps api key
29 GMSServices.provideAPIKey("AIzaSyBCk1oweYbhQb2BqK3vRq1_F0mHl29YLi0")
30 // Override point for customization after application launch.
31 return super.application(application, didFinishLaunchingWithOptions: launchOptions)
32 }
33}
34
35func registerPlugins(_ registry: FlutterPluginRegistry) {
36 GeneratedPluginRegistrant.register(with: registry)
37}