Added iOS location plugin to showcase background execution APIs (#656) * Added a plugin which handles location events on a background isolate on iOS.
diff --git a/packages/location_background/LICENSE b/packages/location_background/LICENSE new file mode 100644 index 0000000..f7480f2 --- /dev/null +++ b/packages/location_background/LICENSE
@@ -0,0 +1,27 @@ +Copyright 2018 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/location_background/README.md b/packages/location_background/README.md new file mode 100644 index 0000000..1135ecf --- /dev/null +++ b/packages/location_background/README.md
@@ -0,0 +1,10 @@ +# Flutter Background Execution Sample - LocationBackgroundPlugin + +A example Flutter plugin that showcases background execution using iOS location services. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/). + +For help on editing plugin code, view the [documentation](https://flutter.io/platform-plugins/#edit-code).
diff --git a/packages/location_background/android/.gitignore b/packages/location_background/android/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/packages/location_background/android/.gitignore
@@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures
diff --git a/packages/location_background/android/build.gradle b/packages/location_background/android/build.gradle new file mode 100644 index 0000000..f635fda --- /dev/null +++ b/packages/location_background/android/build.gradle
@@ -0,0 +1,34 @@ +group 'com.flutter.example.locationbackgroundplugin' +version '1.0-SNAPSHOT' + +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +rootProject.allprojects { + repositories { + google() + jcenter() + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 27 + + defaultConfig { + minSdkVersion 16 + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + lintOptions { + disable 'InvalidPackage' + } +}
diff --git a/packages/location_background/android/gradle.properties b/packages/location_background/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/packages/location_background/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/packages/location_background/android/settings.gradle b/packages/location_background/android/settings.gradle new file mode 100644 index 0000000..9de328a --- /dev/null +++ b/packages/location_background/android/settings.gradle
@@ -0,0 +1 @@ +rootProject.name = 'location_background_plugin'
diff --git a/packages/location_background/android/src/main/AndroidManifest.xml b/packages/location_background/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..63ea5ef --- /dev/null +++ b/packages/location_background/android/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.flutter.example.locationbackgroundplugin"> +</manifest>
diff --git a/packages/location_background/android/src/main/java/com/flutter/example/locationbackgroundplugin/LocationBackgroundPlugin.java b/packages/location_background/android/src/main/java/com/flutter/example/locationbackgroundplugin/LocationBackgroundPlugin.java new file mode 100644 index 0000000..015bec3 --- /dev/null +++ b/packages/location_background/android/src/main/java/com/flutter/example/locationbackgroundplugin/LocationBackgroundPlugin.java
@@ -0,0 +1,27 @@ +package com.flutter.example.locationbackgroundplugin; + +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import io.flutter.plugin.common.PluginRegistry.Registrar; + +// TODO(bkonyi): add Android implementation. +// This would likely involve something along the lines of: +// - Create a LocationBackgroundPluginService which extends Service +// - Use requestLocationUpdates with minDistance parameter set to 500m to match +// iOS behaviour. See https://developer.android.com/reference/android/location/LocationManager +// - Similar plugin structure to `android_alarm_manager` found here: +// https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager +public class LocationBackgroundPlugin implements MethodCallHandler { + public static void registerWith(Registrar registrar) { + final MethodChannel channel = + new MethodChannel(registrar.messenger(), "location_background_plugin"); + channel.setMethodCallHandler(new LocationBackgroundPlugin()); + } + + @Override + public void onMethodCall(MethodCall call, Result result) { + result.notImplemented(); + } +}
diff --git a/packages/location_background/example/.gitignore b/packages/location_background/example/.gitignore new file mode 100644 index 0000000..af17aaf --- /dev/null +++ b/packages/location_background/example/.gitignore
@@ -0,0 +1,11 @@ +.DS_Store +.atom/ +.dart_tool/ +.idea +.vscode/ +.packages +.pub/ +build/ +ios/.generated/ +packages +.flutter-plugins
diff --git a/packages/location_background/example/.metadata b/packages/location_background/example/.metadata new file mode 100644 index 0000000..2937c45 --- /dev/null +++ b/packages/location_background/example/.metadata
@@ -0,0 +1,8 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: d6d874474b21b512aac03f1dcd0d3b88835cdcdd + channel: master
diff --git a/packages/location_background/example/README.md b/packages/location_background/example/README.md new file mode 100644 index 0000000..dc994c5 --- /dev/null +++ b/packages/location_background/example/README.md
@@ -0,0 +1,8 @@ +# Flutter Background Plugin Example for iOS. + +Demonstrates how to use the LocationBackgroundPlugin, a sample plugin showcasing Flutter background execution on iOS. + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](https://flutter.io/).
diff --git a/packages/location_background/example/android/.gitignore b/packages/location_background/example/android/.gitignore new file mode 100644 index 0000000..65b7315 --- /dev/null +++ b/packages/location_background/example/android/.gitignore
@@ -0,0 +1,10 @@ +*.iml +*.class +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +GeneratedPluginRegistrant.java
diff --git a/packages/location_background/example/android/app/build.gradle b/packages/location_background/example/android/app/build.gradle new file mode 100644 index 0000000..435c5cb --- /dev/null +++ b/packages/location_background/example/android/app/build.gradle
@@ -0,0 +1,51 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 27 + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.flutter.example.locationbackgroundpluginexample" + minSdkVersion 16 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' +}
diff --git a/packages/location_background/example/android/app/src/main/AndroidManifest.xml b/packages/location_background/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a59dc3e --- /dev/null +++ b/packages/location_background/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,39 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.flutter.example.locationbackgroundpluginexample"> + + <!-- The INTERNET permission is required for development. Specifically, + flutter needs it to communicate with the running application + to allow setting breakpoints, to provide hot reload, etc. + --> + <uses-permission android:name="android.permission.INTERNET"/> + + <!-- io.flutter.app.FlutterApplication is an android.app.Application that + calls FlutterMain.startInitialization(this); in its onCreate method. + In most cases you can leave this as-is, but you if you want to provide + additional functionality it is fine to subclass or reimplement + FlutterApplication and put your custom class here. --> + <application + android:name="io.flutter.app.FlutterApplication" + android:label="location_background_plugin_example" + android:icon="@mipmap/ic_launcher"> + <activity + android:name=".MainActivity" + android:launchMode="singleTop" + android:theme="@style/LaunchTheme" + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density" + android:hardwareAccelerated="true" + android:windowSoftInputMode="adjustResize"> + <!-- This keeps the window background of the activity showing + until Flutter renders its first frame. It can be removed if + there is no splash screen (such as the default splash screen + defined in @style/LaunchTheme). --> + <meta-data + android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" + android:value="true" /> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> +</manifest>
diff --git a/packages/location_background/example/android/app/src/main/java/com/flutter/example/locationbackgroundpluginexample/MainActivity.java b/packages/location_background/example/android/app/src/main/java/com/flutter/example/locationbackgroundpluginexample/MainActivity.java new file mode 100644 index 0000000..6dc54e7 --- /dev/null +++ b/packages/location_background/example/android/app/src/main/java/com/flutter/example/locationbackgroundpluginexample/MainActivity.java
@@ -0,0 +1,13 @@ +package com.flutter.example.locationbackgroundpluginexample; + +import android.os.Bundle; +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } +}
diff --git a/packages/location_background/example/android/app/src/main/res/drawable/launch_background.xml b/packages/location_background/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Modify this file to customize your launch splash screen --> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@android:color/white" /> + + <!-- You can insert your own image assets here --> + <!-- <item> + <bitmap + android:gravity="center" + android:src="@mipmap/launch_image" /> + </item> --> +</layer-list>
diff --git a/packages/location_background/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/packages/location_background/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ
diff --git a/packages/location_background/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/packages/location_background/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ
diff --git a/packages/location_background/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/packages/location_background/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ
diff --git a/packages/location_background/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/packages/location_background/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ
diff --git a/packages/location_background/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/packages/location_background/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ
diff --git a/packages/location_background/example/android/app/src/main/res/values/styles.xml b/packages/location_background/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..00fa441 --- /dev/null +++ b/packages/location_background/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> + <!-- Show a splash screen on the activity. Automatically removed when + Flutter draws its first frame --> + <item name="android:windowBackground">@drawable/launch_background</item> + </style> +</resources>
diff --git a/packages/location_background/example/android/build.gradle b/packages/location_background/example/android/build.gradle new file mode 100644 index 0000000..4476887 --- /dev/null +++ b/packages/location_background/example/android/build.gradle
@@ -0,0 +1,29 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +}
diff --git a/packages/location_background/example/android/gradle.properties b/packages/location_background/example/android/gradle.properties new file mode 100644 index 0000000..8bd86f6 --- /dev/null +++ b/packages/location_background/example/android/gradle.properties
@@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M
diff --git a/packages/location_background/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/location_background/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..aa901e1 --- /dev/null +++ b/packages/location_background/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/packages/location_background/example/android/settings.gradle b/packages/location_background/example/android/settings.gradle new file mode 100644 index 0000000..5a2f14f --- /dev/null +++ b/packages/location_background/example/android/settings.gradle
@@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +}
diff --git a/packages/location_background/example/ios/.gitignore b/packages/location_background/example/ios/.gitignore new file mode 100644 index 0000000..1e1aafd --- /dev/null +++ b/packages/location_background/example/ios/.gitignore
@@ -0,0 +1,42 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/flutter_assets/ +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/
diff --git a/packages/location_background/example/ios/Flutter/AppFrameworkInfo.plist b/packages/location_background/example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..6c2de80 --- /dev/null +++ b/packages/location_background/example/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>App</string> + <key>CFBundleIdentifier</key> + <string>io.flutter.flutter.app</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>App</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>arm64</string> + </array> + <key>MinimumOSVersion</key> + <string>8.0</string> +</dict> +</plist>
diff --git a/packages/location_background/example/ios/Flutter/Debug.xcconfig b/packages/location_background/example/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..e8efba1 --- /dev/null +++ b/packages/location_background/example/ios/Flutter/Debug.xcconfig
@@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig"
diff --git a/packages/location_background/example/ios/Flutter/Release.xcconfig b/packages/location_background/example/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..399e934 --- /dev/null +++ b/packages/location_background/example/ios/Flutter/Release.xcconfig
@@ -0,0 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig"
diff --git a/packages/location_background/example/ios/Runner.xcodeproj/project.pbxproj b/packages/location_background/example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c60c8d5 --- /dev/null +++ b/packages/location_background/example/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,506 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 6F4EF35D20C87745003EB65D /* ios in Resources */ = {isa = PBXBuildFile; fileRef = 6F4EF35C20C87745003EB65D /* ios */; }; + 6F4EF35F20CEE77B003EB65D /* (null) in Resources */ = {isa = PBXBuildFile; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A3F65306835CE59B322AC687 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A34E313CEC116C1DD761CAB8 /* libPods-Runner.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; + 6F4EF35C20C87745003EB65D /* ios */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ios; path = ../../ios; sourceTree = "<group>"; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + A34E313CEC116C1DD761CAB8 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + A3F65306835CE59B322AC687 /* libPods-Runner.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0A21A2A450A05E43A5F34456 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + name = Pods; + sourceTree = "<group>"; + }; + 338C65C4CFC9350F63D48DBD /* Frameworks */ = { + isa = PBXGroup; + children = ( + A34E313CEC116C1DD761CAB8 /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = "<group>"; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 6F4EF35C20C87745003EB65D /* ios */, + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 0A21A2A450A05E43A5F34456 /* Pods */, + 338C65C4CFC9350F63D48DBD /* Frameworks */, + ); + sourceTree = "<group>"; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = "<group>"; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 474F0BE029A66AFB612AF012 /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 9F1ECFBAB8123D3164715BB1 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = U8PR3Q5466; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 6F4EF35F20CEE77B003EB65D /* (null) in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, + 6F4EF35D20C87745003EB65D /* ios in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 474F0BE029A66AFB612AF012 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; + 9F1ECFBAB8123D3164715BB1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${PODS_ROOT}/../.symlinks/flutter/ios_debug_sim_unopt/Flutter.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = "<group>"; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PR3Q5466; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.flutter.example.locationBackgroundPluginExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = U8PR3Q5466; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.flutter.example.locationBackgroundPluginExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +}
diff --git a/packages/location_background/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/packages/location_background/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/packages/location_background/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "group:Runner.xcodeproj"> + </FileRef> +</Workspace>
diff --git a/packages/location_background/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/location_background/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..f5a8db1 --- /dev/null +++ b/packages/location_background/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "0910" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + </Testables> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <BuildableProductRunnable + runnableDebuggingMode = "0"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "97C146ED1CF9000F007C117D" + BuildableName = "Runner.app" + BlueprintName = "Runner" + ReferencedContainer = "container:Runner.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme>
diff --git a/packages/location_background/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/packages/location_background/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/packages/location_background/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "group:Runner.xcodeproj"> + </FileRef> + <FileRef + location = "group:Pods/Pods.xcodeproj"> + </FileRef> +</Workspace>
diff --git a/packages/location_background/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/location_background/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/packages/location_background/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist>
diff --git a/packages/location_background/example/ios/Runner/AppDelegate.h b/packages/location_background/example/ios/Runner/AppDelegate.h new file mode 100644 index 0000000..36e21bb --- /dev/null +++ b/packages/location_background/example/ios/Runner/AppDelegate.h
@@ -0,0 +1,6 @@ +#import <Flutter/Flutter.h> +#import <UIKit/UIKit.h> + +@interface AppDelegate : FlutterAppDelegate + +@end
diff --git a/packages/location_background/example/ios/Runner/AppDelegate.m b/packages/location_background/example/ios/Runner/AppDelegate.m new file mode 100644 index 0000000..59a72e9 --- /dev/null +++ b/packages/location_background/example/ios/Runner/AppDelegate.m
@@ -0,0 +1,13 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..3d43d11 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..28c6bf0 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..2ccbfd9 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..f091b6b --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cde121 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..d0ef06e --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..dcdc230 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..2ccbfd9 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..c8f9ed8 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..a6d6b86 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..a6d6b86 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..75b2d16 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..c4df70d --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..6a84f41 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..d0e1f58 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png Binary files differ
diff --git a/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file
diff --git a/packages/location_background/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/packages/location_background/example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/packages/location_background/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> + <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> + </imageView> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> + </constraints> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> + <resources> + <image name="LaunchImage" width="168" height="185"/> + </resources> +</document>
diff --git a/packages/location_background/example/ios/Runner/Base.lproj/Main.storyboard b/packages/location_background/example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..996dae9 --- /dev/null +++ b/packages/location_background/example/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> + <device id="retina5_9" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Flutter View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> + <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="375" height="812"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + </scene> + </scenes> +</document>
diff --git a/packages/location_background/example/ios/Runner/Info.plist b/packages/location_background/example/ios/Runner/Info.plist new file mode 100644 index 0000000..a6231bd --- /dev/null +++ b/packages/location_background/example/ios/Runner/Info.plist
@@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> + <string>This is the plist item for NSLocationWhenInUseUsageDescription</string> + <key>NSLocationWhenInUseUsageDescription</key> + <string>This is the plist item for NSLocationAlwaysUsageDescription</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>location_background_plugin_example</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + <key>UIMainStoryboardFile</key> + <string>Main</string> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>location-services</string> + <string>gps</string> + <string>armv7</string> + </array> + <key>UIBackgroundModes</key> + <array> + <string>location</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>LSApplicationCategoryType</key> + <string></string> + <key>UIViewControllerBasedStatusBarAppearance</key> + <false/> +</dict> +</plist>
diff --git a/packages/location_background/example/ios/Runner/main.m b/packages/location_background/example/ios/Runner/main.m new file mode 100644 index 0000000..f012886 --- /dev/null +++ b/packages/location_background/example/ios/Runner/main.m
@@ -0,0 +1,10 @@ +#import <Flutter/Flutter.h> +#import <UIKit/UIKit.h> +#import "AppDelegate.h" +#import "LocationBackgroundPlugin.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +}
diff --git a/packages/location_background/example/lib/background.dart b/packages/location_background/example/lib/background.dart new file mode 100644 index 0000000..95ee633 --- /dev/null +++ b/packages/location_background/example/lib/background.dart
@@ -0,0 +1,24 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file + +import 'dart:isolate'; +import 'dart:ui'; +import 'package:location_background_plugin/location_background_plugin.dart'; + +const String kLocationPluginPortName = 'location_plugin_port'; + +/// This is an example of a callback for LocationBackgroundPlugin's +/// `startMonitoringLocation`. A callback can be defined anywhere in an +/// application's code, but cannot be from another program. +class LocationMonitor { + static void locationCallback(Location location) { + print('Background Location: $location'); + // We use isolate ports to communicate between the main isolate and spawned + // isolates since they do not share memory. The port lookup will return + // null if the UI isolate has explicitly removed the mapping on shutdown. + final SendPort uiSendPort = + IsolateNameServer.lookupPortByName(kLocationPluginPortName); + uiSendPort?.send(location.toJson()); + } +}
diff --git a/packages/location_background/example/lib/main.dart b/packages/location_background/example/lib/main.dart new file mode 100644 index 0000000..1eb52eb --- /dev/null +++ b/packages/location_background/example/lib/main.dart
@@ -0,0 +1,130 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file + +import 'dart:isolate'; +import 'dart:ui' hide TextStyle; + +import 'package:flutter/material.dart'; +import 'package:location_background_plugin/location_background_plugin.dart'; + +import 'background.dart'; + +void main() { + runApp(new MyApp()); +} + +class MyApp extends StatefulWidget { + @override + _MyAppState createState() { + return new _MyAppState(); + } +} + +class _MyAppState extends State<MyApp> { + ReceivePort _foregroundPort = new ReceivePort(); + LocationBackgroundPlugin _locationPlugin; + Location _lastLocation; + bool _isTracking = false; + + @override + void initState() { + _lastLocation = new Location(-1.0, 0.0, 0.0, -1.0, -1.0); + super.initState(); + initPlatformState(); + } + + void initPlatformState() { + // The IsolateNameServer allows for us to create a mapping between a String + // and a SendPort that is managed by the Flutter engine. A SendPort can + // then be looked up elsewhere, like a background callback, to establish + // communication channels between isolates that were not spawned by one + // another. + if (!IsolateNameServer.registerPortWithName( + _foregroundPort.sendPort, kLocationPluginPortName)) { + throw 'Unable to register port!'; + } + + // Listen on the port for location updates from our background callback. + _foregroundPort.listen((dynamic message) { + final Location location = Location.fromJson(message); + print('UI Location: $location'); + setState(() { + _lastLocation = location; + }); + }, onDone: () { + // Remove the port mapping just in case the UI is shutting down but + // background isolate is continuing to run. + IsolateNameServer.removePortNameMapping(kLocationPluginPortName); + }); + _locationPlugin ??= LocationBackgroundPlugin(); + } + + String _padZero2(int i) => i.toString().padLeft(2, '0'); + + String _formatTime(DateTime t) { + t = t.toLocal(); + final int hour = t.hour; + final String minute = _padZero2(t.minute); + final String second = _padZero2(t.second); + final int year = t.year; + return '$hour:$minute:$second $year'; + } + + @override + Widget build(BuildContext context) { + const TextStyle boldText = TextStyle(fontWeight: FontWeight.bold); + return new MaterialApp( + home: new Scaffold( + appBar: new AppBar( + title: const Text('Background Plugin Demo'), + ), + body: new Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: <Widget>[ + const Center( + child: Text( + 'Update Time:', + style: boldText, + )), + Center(child: Text('${_formatTime(_lastLocation.time)}')), + const Center( + child: Text( + 'Location:', + style: boldText, + )), + Center( + child: Text( + '(${_lastLocation.latitude}, ${_lastLocation.longitude})')), + const Center( + child: Text( + 'Altitude:', + style: boldText, + )), + Center(child: Text('${_lastLocation.altitude} m')), + const Center( + child: Text( + 'Speed (meters per second)', + style: boldText, + )), + Center(child: Text('${_lastLocation.speed} m/s')), + Center( + child: RaisedButton( + child: + Text(_isTracking ? 'Stop Tracking' : 'Start Tracking'), + onPressed: () async { + if (!_isTracking) { + await _locationPlugin.monitorSignificantLocationChanges( + LocationMonitor.locationCallback); + } else { + await _locationPlugin.cancelLocationUpdates(); + } + setState(() { + _isTracking = !_isTracking; + }); + }, + )) + ]))); + } +}
diff --git a/packages/location_background/example/pubspec.yaml b/packages/location_background/example/pubspec.yaml new file mode 100644 index 0000000..bdcb7da --- /dev/null +++ b/packages/location_background/example/pubspec.yaml
@@ -0,0 +1,59 @@ +name: location_background_plugin_example +description: Demonstrates how to use the location_background_plugin plugin. + +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^0.1.0 + + location_background_plugin: + path: ../ + +dev_dependencies: + flutter_test: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.io/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.io/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.io/custom-fonts/#from-packages
diff --git a/packages/location_background/ios/.gitignore b/packages/location_background/ios/.gitignore new file mode 100644 index 0000000..956c87f --- /dev/null +++ b/packages/location_background/ios/.gitignore
@@ -0,0 +1,31 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* +
diff --git a/packages/location_background/ios/Assets/.gitkeep b/packages/location_background/ios/Assets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/packages/location_background/ios/Assets/.gitkeep
diff --git a/packages/location_background/ios/Classes/LocationBackgroundPlugin.h b/packages/location_background/ios/Classes/LocationBackgroundPlugin.h new file mode 100644 index 0000000..90a9d9d --- /dev/null +++ b/packages/location_background/ios/Classes/LocationBackgroundPlugin.h
@@ -0,0 +1,12 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <Flutter/Flutter.h> + +#import <CoreLocation/CoreLocation.h> + +@interface LocationBackgroundPlugin + : NSObject<FlutterPlugin, CLLocationManagerDelegate> { +} +@end
diff --git a/packages/location_background/ios/Classes/LocationBackgroundPlugin.m b/packages/location_background/ios/Classes/LocationBackgroundPlugin.m new file mode 100644 index 0000000..b0ca3ac --- /dev/null +++ b/packages/location_background/ios/Classes/LocationBackgroundPlugin.m
@@ -0,0 +1,222 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "LocationBackgroundPlugin.h" + +#import <CoreLocation/CoreLocation.h> + +@implementation LocationBackgroundPlugin { + CLLocationManager *_locationManager; + FlutterHeadlessDartRunner *_headlessRunner; + FlutterMethodChannel *_callbackChannel; + FlutterMethodChannel *_mainChannel; + NSObject<FlutterPluginRegistrar> *_registrar; + NSUserDefaults *_persistentState; + int64_t _onLocationUpdateHandle; +} + +static LocationBackgroundPlugin *instance = nil; + +#pragma mark FlutterPlugin Methods + ++ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { + @synchronized(self) { + if (instance == nil) { + instance = [[LocationBackgroundPlugin alloc] init:registrar]; + [registrar addApplicationDelegate:instance]; + } + } +} + +// When iOS relaunches us due to a significant location change, we need to +// reinitialize our plugin state. This includes relaunching the headless +// service, retrieving our cached callback handles and location manager +// settings, and restarting the location manager to actually receive the +// location event. +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Check to see if we're being launched due to a location event. + if (launchOptions[UIApplicationLaunchOptionsLocationKey] != nil) { + // Restart the headless service. + [self startHeadlessService:[self getCallbackDispatcherHandle]]; + // Grab our callback handles and location manager state. + _onLocationUpdateHandle = [self getLocationCallbackHandle]; + _locationManager.pausesLocationUpdatesAutomatically = + [self getPausesLocationUpdatesAutomatically]; + if (@available(iOS 11.0, *)) { + _locationManager.showsBackgroundLocationIndicator = + [self getShowsBackgroundLocationIndicator]; + } + _locationManager.allowsBackgroundLocationUpdates = YES; + // Finally, restart monitoring for location changes to get our location. + [self->_locationManager startMonitoringSignificantLocationChanges]; + } + + // Note: if we return NO, this vetos the launch of the application. + return YES; +} + +- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result { + NSArray *arguments = call.arguments; + if ([@"monitorLocationChanges" isEqualToString:call.method]) { + NSAssert(arguments.count == 4, @"Invalid argument count for 'monitorLocationChanges'"); + [self monitorLocationChanges:arguments]; + result(@(YES)); + } else if ([@"startHeadlessService" isEqualToString:call.method]) { + NSAssert(arguments.count == 1, @"Invalid argument count for 'startHeadlessService'"); + [self startHeadlessService:[arguments[0] longValue]]; + } else if ([@"cancelLocationUpdates" isEqualToString:call.method]) { + NSAssert(arguments.count == 0, @"Invalid argument count for 'cancelLocationUpdates'"); + [self stopUpdatingLocation]; + result(nil); + } else { + NSLog(@"Unknown method: %@\n", call.method); + result(FlutterMethodNotImplemented); + } +} + +#pragma mark LocationManagerDelegate Methods + +// Location events come in here from our LocationManager and are forwarded to +// onLocationEvent. +- (void)locationManager:(CLLocationManager *)manager + didUpdateLocations:(NSArray<CLLocation *> *)locations { + for (CLLocation *location in locations) { + [self onLocationEvent:location]; + } +} + +#pragma mark LocationBackgroundPlugin Methods + +- (instancetype)init:(NSObject<FlutterPluginRegistrar> *)registrar { + self = [super init]; + NSAssert(self, @"super init cannot be nil"); + _persistentState = [NSUserDefaults standardUserDefaults]; + _locationManager = [[CLLocationManager alloc] init]; + [_locationManager setDelegate:self]; + [_locationManager requestAlwaysAuthorization]; + + _headlessRunner = [[FlutterHeadlessDartRunner alloc] init]; + _registrar = registrar; + + // This is the method channel used to communicate with the UI Isolate. + _mainChannel = + [FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/ios_background_location" + binaryMessenger:[registrar messenger]]; + [registrar addMethodCallDelegate:self channel:_mainChannel]; + + // This is the method channel used to communicate with + // `_backgroundCallbackDispatcher` defined in the Dart portion of our plugin. + // Note: we don't add a MethodCallDelegate for this channel now since our + // BinaryMessenger needs to be initialized first, which is done in + // `startHeadlessService` below. + _callbackChannel = [FlutterMethodChannel + methodChannelWithName:@"plugins.flutter.io/ios_background_location_callback" + binaryMessenger:_headlessRunner]; + return self; +} + +- (int64_t)getCallbackDispatcherHandle { + id handle = [_persistentState objectForKey:@"callback_dispatcher_handle"]; + if (handle == nil) { + return 0; + } + return [handle longLongValue]; +} + +- (void)setCallbackDispatcherHandle:(int64_t)handle { + [_persistentState setObject:[NSNumber numberWithLongLong:handle] + forKey:@"callback_dispatcher_handle"]; +} + +- (int64_t)getLocationCallbackHandle { + id handle = [_persistentState objectForKey:@"location_callback_handle"]; + if (handle == nil) { + return 0; + } + return [handle longLongValue]; +} + +- (void)setLocationCallbackHandle:(int64_t)handle { + [_persistentState setObject:[NSNumber numberWithLongLong:handle] + forKey:@"location_callback_handle"]; +} + +- (BOOL)getPausesLocationUpdatesAutomatically { + return [_persistentState boolForKey:@"pauses_location_updates_automatically"]; +} + +- (void)setPausesLocationUpdatesAutomatically:(BOOL)pause { + [_persistentState setBool:pause forKey:@"pauses_location_updates_automatically"]; +} + +- (BOOL)getShowsBackgroundLocationIndicator { + return [_persistentState boolForKey:@"shows_background_location_indicator"]; +} + +- (void)setShowsBackgroundLocationIndicator:(BOOL)pause { + [_persistentState setBool:pause forKey:@"shows_background_location_indicator"]; +} + +// Initializes and starts the background isolate which will process location +// events. `handle` is the handle to the callback dispatcher which we specified +// in the Dart portion of the plugin. +- (void)startHeadlessService:(int64_t)handle { + [self setCallbackDispatcherHandle:handle]; + + // Lookup the information for our callback dispatcher from the callback cache. + // This cache is populated when `PluginUtilities.getCallbackHandle` is called + // and the resulting handle maps to a `FlutterCallbackInformation` object. + // This object contains information needed by the engine to start a headless + // runner, which includes the callback name as well as the path to the file + // containing the callback. + FlutterCallbackInformation *info = [FlutterCallbackCache lookupCallbackInformation:handle]; + NSAssert(info != nil, @"failed to find callback"); + NSString *entrypoint = info.callbackName; + NSString *uri = info.callbackLibraryPath; + + // Here we actually launch the background isolate to start executing our + // callback dispatcher, `_backgroundCallbackDispatcher`, in Dart. + [_headlessRunner runWithEntrypointAndCallback:entrypoint libraryUri:uri completion:nil]; + + // The headless runner needs to be initialized before we can register it as a + // MethodCallDelegate or else we get an illegal memory access. If we don't + // want to make calls from `_backgroundCallDispatcher` back to native code, + // we don't need to add a MethodCallDelegate for this channel. + [_registrar addMethodCallDelegate:self channel:_callbackChannel]; +} + +// Start receiving location updates. +- (void)monitorLocationChanges:(NSArray *)arguments { + _onLocationUpdateHandle = [arguments[0] longLongValue]; + [self setLocationCallbackHandle:_onLocationUpdateHandle]; + _locationManager.pausesLocationUpdatesAutomatically = arguments[1]; + if (@available(iOS 11.0, *)) { + _locationManager.showsBackgroundLocationIndicator = arguments[2]; + } + _locationManager.activityType = [arguments[3] integerValue]; + _locationManager.allowsBackgroundLocationUpdates = YES; + + [self setPausesLocationUpdatesAutomatically:_locationManager.pausesLocationUpdatesAutomatically]; + [self setShowsBackgroundLocationIndicator:_locationManager.showsBackgroundLocationIndicator]; + [self->_locationManager startMonitoringSignificantLocationChanges]; +} + +// Stop the location updates. +- (void)stopUpdatingLocation { + [self->_locationManager stopUpdatingLocation]; +} + +// Sends location events to our `_backgroundCallDispatcher` in Dart code via +// the MethodChannel we established earlier. +- (void)onLocationEvent:(CLLocation *)location { + [_callbackChannel invokeMethod:@"onLocationEvent" + arguments:@[ + @(_onLocationUpdateHandle), @(location.timestamp.timeIntervalSince1970), + @(location.coordinate.latitude), @(location.coordinate.longitude), + @(location.horizontalAccuracy), @(location.speed) + ]]; +} + +@end
diff --git a/packages/location_background/ios/location_background_plugin.podspec b/packages/location_background/ios/location_background_plugin.podspec new file mode 100644 index 0000000..8e629e1 --- /dev/null +++ b/packages/location_background/ios/location_background_plugin.podspec
@@ -0,0 +1,23 @@ + + +# +# NOTE: This podspec is NOT to be published. It is only used as a local source! +# + +Pod::Spec.new do |s| +s.name = 'location_background_plugin' +s.version = '0.0.1' +s.summary = 'High-performance, high-fidelity mobile apps.' +s.description = <<-DESC +Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS. +DESC +s.homepage = 'https://flutter.io' +s.license = { :type => 'MIT' } +s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } +s.source = { :path => '.'} +s.source_files = 'Classes/**/*' +s.public_header_files = 'Classes/**/*.h' +s.dependency 'Flutter' +s.ios.deployment_target = '8.0' +# s.vendored_frameworks = 'Flutter.framework' +end
diff --git a/packages/location_background/lib/location_background_plugin.dart b/packages/location_background/lib/location_background_plugin.dart new file mode 100644 index 0000000..4822a05 --- /dev/null +++ b/packages/location_background/lib/location_background_plugin.dart
@@ -0,0 +1,159 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +// Required for PluginUtilities. +import 'dart:ui'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +/// Types of location activities for iOS. +/// +/// See https://developer.apple.com/documentation/corelocation/clactivitytype +enum LocationActivityType { + other, + automotiveNavigation, + fitness, + otherNavigation, +} + +/// A representation of a location update. +class Location { + final double _time; + final double latitude; + final double longitude; + final double altitude; + final double speed; + + Location( + this._time, this.latitude, this.longitude, this.altitude, this.speed); + + factory Location.fromJson(String jsonLocation) { + final Map<String, dynamic> location = json.decode(jsonLocation); + return new Location(location['time'], location['latitude'], + location['longitude'], location['altitude'], location['speed']); + } + + DateTime get time => + new DateTime.fromMillisecondsSinceEpoch((_time * 1000).round(), + isUtc: true); + + @override + String toString() => + '[$time] ($latitude, $longitude) altitude: $altitude m/s: $speed'; + + String toJson() { + final Map<String, double> location = <String, double>{ + 'time': _time, + 'latitude': latitude, + 'longitude': longitude, + 'altitude': altitude, + 'speed': speed, + }; + return json.encode(location); + } +} + +// When we start the background service isolate, we only ever enter it once. +// To communicate between the native plugin and this entrypoint, we'll use +// MethodChannels to open a persistent communication channel to trigger +// callbacks. +void _backgroundCallbackDispatcher() { + const String kOnLocationEvent = 'onLocationEvent'; + const MethodChannel _channel = + MethodChannel('plugins.flutter.io/ios_background_location_callback'); + + // Setup Flutter state needed for MethodChannels. + WidgetsFlutterBinding.ensureInitialized(); + + // Reference to the onLocationEvent callback. + Function onLocationEvent; + + // This is where the magic happens and we handle background events from the + // native portion of the plugin. Here we massage the location data into a + // `Location` object which we then pass to the provided callback. + _channel.setMethodCallHandler((MethodCall call) async { + final dynamic args = call.arguments; + + Function _performCallbackLookup() { + final CallbackHandle handle = + CallbackHandle.fromRawHandle(call.arguments[0]); + + // PluginUtilities.getCallbackFromHandle performs a lookup based on the + // handle we retrieved earlier. + final Function closure = PluginUtilities.getCallbackFromHandle(handle); + + if (closure == null) { + print('Fatal Error: Callback lookup failed!'); + exit(-1); + } + return closure; + } + + if (call.method == kOnLocationEvent) { + onLocationEvent ??= _performCallbackLookup(); + final Location location = + new Location(args[1], args[2], args[3], args[4], args[5]); + onLocationEvent(location); + } else { + assert(false, "No handler defined for method type: '${call.method}'"); + } + }); +} + +class LocationBackgroundPlugin { + // The method channel we'll use to communicate with the native portion of our + // plugin. + static const MethodChannel _channel = + MethodChannel('plugins.flutter.io/ios_background_location'); + + static const String _kCancelLocationUpdates = 'cancelLocationUpdates'; + static const String _kMonitorLocationChanges = 'monitorLocationChanges'; + static const String _kStartHeadlessService = 'startHeadlessService'; + + bool pauseLocationUpdatesAutomatically; + bool showsBackgroundLocationIndicator; + LocationActivityType activityType; + + LocationBackgroundPlugin( + {this.pauseLocationUpdatesAutomatically = false, + this.showsBackgroundLocationIndicator = true, + this.activityType = LocationActivityType.other}) { + // Start the headless location service. The parameter here is a handle to + // a callback managed by the Flutter engine, which allows for us to pass + // references to our callbacks between isolates. + print("Starting LocationBackgroundPlugin service"); + final CallbackHandle handle = + PluginUtilities.getCallbackHandle(_backgroundCallbackDispatcher); + assert(handle != null, 'Unable to lookup callback.'); + _channel + .invokeMethod(_kStartHeadlessService, <dynamic>[handle.toRawHandle()]); + } + + /// Start getting significant location updates through `callback`. + /// + /// `callback` is invoked on a background isolate and will not have direct + /// access to the state held by the main isolate (or any other isolate). + Future<bool> monitorSignificantLocationChanges( + void Function(Location location) callback) { + if (callback == null) { + throw ArgumentError.notNull('callback'); + } + final CallbackHandle handle = PluginUtilities.getCallbackHandle(callback); + return _channel.invokeMethod(_kMonitorLocationChanges, <dynamic>[ + handle.toRawHandle(), + pauseLocationUpdatesAutomatically, + showsBackgroundLocationIndicator, + activityType.index + ]).then<bool>((dynamic result) => result); + } + + /// Stop all location updates. + Future<void> cancelLocationUpdates() => + _channel.invokeMethod(_kCancelLocationUpdates); +}
diff --git a/packages/location_background/pubspec.yaml b/packages/location_background/pubspec.yaml new file mode 100644 index 0000000..f579f37 --- /dev/null +++ b/packages/location_background/pubspec.yaml
@@ -0,0 +1,49 @@ +name: location_background_plugin +description: A new flutter plugin project. +version: 0.0.1 +author: +homepage: + +dependencies: + flutter: + sdk: flutter + +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + plugin: + androidPackage: com.flutter.example.locationbackgroundplugin + pluginClass: LocationBackgroundPlugin + + # To add assets to your plugin package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.io/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.io/assets-and-images/#resolution-aware. + + # To add custom fonts to your plugin package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.io/custom-fonts/#from-packages