Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.flutter.plugins;

import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.geofencing.GeofencingPlugin;
import io.flutter.plugins.geofencing.FlutterGeofencingPlugin;

/**
* Generated file. Do not edit.
Expand All @@ -11,7 +11,7 @@ public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
GeofencingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.geofencing.GeofencingPlugin"));
GeofencingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.geofencing.FlutterGeofencingPlugin"));
}

private static boolean alreadyRegisteredWith(PluginRegistry registry) {
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group 'io.flutter.plugins.geofencing'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.0'
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down Expand Up @@ -41,5 +41,5 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.google.android.gms:play-services-location:16.+"
implementation "com.google.android.gms:play-services-location:17.+"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ import io.flutter.plugin.common.MethodChannel.Result
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.PluginRegistry.Registrar
import org.json.JSONArray
import org.json.JSONObject

class GeofencingPlugin(context: Context, activity: Activity?) : MethodCallHandler {
class FlutterGeofencingPlugin(context: Context, activity: Activity?) : MethodCallHandler {
private val mContext = context
private val mActivity = activity
private val mGeofencingClient = LocationServices.getGeofencingClient(mContext)

companion object {
@JvmStatic
private val TAG = "GeofencingPlugin"
private val TAG = "FlutterGeofencingPlugin"
@JvmStatic
val SHARED_PREFERENCES_KEY = "geofencing_plugin_cache"
@JvmStatic
Expand All @@ -49,7 +48,7 @@ class GeofencingPlugin(context: Context, activity: Activity?) : MethodCallHandle

@JvmStatic
fun registerWith(registrar: Registrar) {
val plugin = GeofencingPlugin(registrar.context(), registrar.activity())
val plugin = FlutterGeofencingPlugin(registrar.context(), registrar.activity())
val channel = MethodChannel(registrar.messenger(), "plugins.flutter.io/geofencing_plugin")
channel.setMethodCallHandler(plugin)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GeofencingRebootBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
Log.e("GEOFENCING REBOOT", "Reregistering geofences!")
GeofencingPlugin.reRegisterAfterReboot(context)
FlutterGeofencingPlugin.reRegisterAfterReboot(context)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package io.flutter.plugins.geofencing

import android.content.Context
import android.content.Intent
import androidx.core.app.JobIntentService
import android.os.Handler
import android.util.Log
import androidx.core.app.JobIntentService
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
Expand Down Expand Up @@ -57,9 +58,9 @@ class GeofencingService : MethodCallHandler, JobIntentService() {
mContext = context
if (sBackgroundFlutterView == null) {
val callbackHandle = context.getSharedPreferences(
GeofencingPlugin.SHARED_PREFERENCES_KEY,
FlutterGeofencingPlugin.SHARED_PREFERENCES_KEY,
Context.MODE_PRIVATE)
.getLong(GeofencingPlugin.CALLBACK_DISPATCHER_HANDLE_KEY, 0)
.getLong(FlutterGeofencingPlugin.CALLBACK_DISPATCHER_HANDLE_KEY, 0)

val callbackInfo = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle)
if (callbackInfo == null) {
Expand Down Expand Up @@ -114,7 +115,7 @@ class GeofencingService : MethodCallHandler, JobIntentService() {
}

override fun onHandleWork(intent: Intent) {
val callbackHandle = intent.getLongExtra(GeofencingPlugin.CALLBACK_HANDLE_KEY, 0)
val callbackHandle = intent.getLongExtra(FlutterGeofencingPlugin.CALLBACK_HANDLE_KEY, 0)
val geofencingEvent = GeofencingEvent.fromIntent(intent)
if (geofencingEvent.hasError()) {
Log.e(TAG, "Geofencing error: ${geofencingEvent.errorCode}")
Expand Down Expand Up @@ -144,7 +145,7 @@ class GeofencingService : MethodCallHandler, JobIntentService() {
queue.add(geofenceUpdateList)
} else {
// Callback method name is intentionally left blank.
mBackgroundChannel.invokeMethod("", geofenceUpdateList)
Handler(mContext.mainLooper).post { mBackgroundChannel.invokeMethod("", geofenceUpdateList) }
}
}
}
Expand Down
70 changes: 67 additions & 3 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,73 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.dart_tool/
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
/build/

build/
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

.flutter-plugins
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
19 changes: 0 additions & 19 deletions example/.idea/libraries/Dart_SDK.xml

This file was deleted.

9 changes: 0 additions & 9 deletions example/.idea/libraries/Flutter_for_Android.xml

This file was deleted.

9 changes: 0 additions & 9 deletions example/.idea/modules.xml

This file was deleted.

6 changes: 4 additions & 2 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 7762e451159823e2c605c8f444f7b4f5b2f3784f
channel: master
revision: cc949a8e8b9cf394b9290a8e80f87af3e207dce5
channel: stable

project_type: app
16 changes: 12 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# geofencing_example
# flutter_geofencing_example

Demonstrates how to use the geofencing plugin.
Demonstrates how to use the flutter_geofencing plugin.

## Getting Started

For help getting started with Flutter, view our online
[documentation](https://flutter.io/).
This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
File renamed without changes.
27 changes: 0 additions & 27 deletions example/geofencing_example_android.iml

This file was deleted.

2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
Expand Down
16 changes: 15 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
# source 'https://cdn.cocoapods.org/'

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
Expand All @@ -27,6 +36,8 @@ def parse_KV_file(file, separator='=')
end

target 'Runner' do
use_frameworks!

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
Expand All @@ -35,7 +46,7 @@ target 'Runner' do
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
Expand All @@ -54,6 +65,9 @@ target 'Runner' do
}
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
Expand Down
26 changes: 10 additions & 16 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
PODS:
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- geofencing (0.0.1):
- flutter_geofencing (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios_debug_sim`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- geofencing (from `.symlinks/plugins/geofencing/ios`)
- Flutter (from `.symlinks/flutter/ios`)
- flutter_geofencing (from `.symlinks/plugins/flutter_geofencing/ios`)

EXTERNAL SOURCES:
Flutter:
:path: ".symlinks/flutter/ios_debug_sim"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
geofencing:
:path: ".symlinks/plugins/geofencing/ios"
:path: ".symlinks/flutter/ios"
flutter_geofencing:
:path: ".symlinks/plugins/flutter_geofencing/ios"

SPEC CHECKSUMS:
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
flutter_local_notifications: 696a74904e0a0ab754e27a5f761da4a7f9153710
geofencing: 03e5e092597a2619fb90fc277d31932752595b00
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_geofencing: cd2342accf22d2b76b3acfdb39ded6bca972d949

PODFILE CHECKSUM: 1e5af4103afd21ca5ead147d7b81d06f494f51a2
PODFILE CHECKSUM: 10ae9c18d12c9ffc2275c9a159a3b1e281990db0

COCOAPODS: 1.5.3
COCOAPODS: 1.7.4
Loading