Coder Social home page Coder Social logo

baseflow / flutter-geolocator Goto Github PK

View Code? Open in Web Editor NEW
1.2K 33.0 613.0 1.84 MB

Android and iOS Geolocation plugin for Flutter

Home Page: https://baseflow.com/

License: MIT License

Dart 87.72% Ruby 1.27% HTML 0.46% CMake 4.25% C++ 6.31%
flutter flutter-plugin android ios geolocation geo geolocator location dart geolocator-plugin

flutter-geolocator's People

Contributors

akora-ingdkb avatar audkar avatar bangfalse avatar danielroek avatar dependabot[bot] avatar ened avatar florissmit1 avatar ikicodedev avatar jeroenweener avatar josh-burton avatar lootwig avatar mabels avatar martijn00 avatar maxammann avatar mduccc avatar mvanbeusekom avatar owersbrett avatar pablojimpas avatar pparadox11 avatar raphicci avatar renefloor avatar sempakonka avatar sestegra avatar sjoerd0301 avatar spockfish avatar stijnwoerkom avatar stsc3000 avatar timhoogstrate avatar wackymax avatar wendler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-geolocator's Issues

Get gps status

Would be great if we can check if the device has the gps enabled/disabled or if the user declined the location permission :)

i get a number in placemarks.name other than a name

πŸ› Bug Report

i seem to be getting a number instead of a name when i use

Expected behavior

I/flutter (27801): 8

Reproduction steps

List placemarks = await Geolocator()
.placemarkFromCoordinates(5.6098949, -0.225339);

Configuration

Version: 1.x

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Crash after allowing permission

Flutter 0.9.4

Calling _geolocator.getPositionStream().listen(...);
Followed immediately by await _geolocator.getLastKnownPosition();
Same when doing the reverse.

Crashes after allowing permission.

I/Timeline(26084): Timeline: Activity_launch_request time:146739940 intent:Intent { act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.packageinstaller (has extras) }
W/Activity(26084): Can reqeust only one set of permissions at a time
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): Failed to handle method call
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:194)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.processResult(PermissionHandlerPlugin.kt:286)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.handlePermissionsRequest(PermissionHandlerPlugin.kt:278)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.access$handlePermissionsRequest(PermissionHandlerPlugin.kt:27)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin$Companion$registerWith$1.onRequestPermissionsResult(PermissionHandlerPlugin.kt:45)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:191)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:125)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:133)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.app.Activity.requestPermissions(Activity.java:4290)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.support.v4.app.ActivityCompat.requestPermissions(ActivityCompat.java:507)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.requestPermissions(PermissionHandlerPlugin.kt:235)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.onMethodCall(PermissionHandlerPlugin.kt:114)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at android.app.ActivityThread.main(ActivityThread.java:6383)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/MethodChannel#flutter.baseflow.com/permissions/methods(26084): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
E/FlutterNativeView(26084): Uncaught exception in binary message listener
E/FlutterNativeView(26084): java.lang.IllegalStateException: Reply already submitted
E/FlutterNativeView(26084): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/FlutterNativeView(26084): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:209)
E/FlutterNativeView(26084): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/FlutterNativeView(26084): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/FlutterNativeView(26084): 	at android.os.MessageQueue.next(MessageQueue.java:323)
E/FlutterNativeView(26084): 	at android.os.Looper.loop(Looper.java:142)
E/FlutterNativeView(26084): 	at android.app.ActivityThread.main(ActivityThread.java:6383)
E/FlutterNativeView(26084): 	at java.lang.reflect.Method.invoke(Native Method)
E/FlutterNativeView(26084): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/FlutterNativeView(26084): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
D/AndroidRuntime(26084): Shutting down VM
E/AndroidRuntime(26084): FATAL EXCEPTION: main
E/AndroidRuntime(26084): Process: app.infmarketplace, PID: 26084
E/AndroidRuntime(26084): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=25, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {app.infmarketplace/app.infmarketplace.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(26084): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4221)
E/AndroidRuntime(26084): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4264)
E/AndroidRuntime(26084): 	at android.app.ActivityThread.-wrap20(ActivityThread.java)
E/AndroidRuntime(26084): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
E/AndroidRuntime(26084): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(26084): 	at android.os.Looper.loop(Looper.java:163)
E/AndroidRuntime(26084): 	at android.app.ActivityThread.main(ActivityThread.java:6383)
E/AndroidRuntime(26084): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(26084): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
E/AndroidRuntime(26084): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
E/AndroidRuntime(26084): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(26084): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/AndroidRuntime(26084): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:194)
E/AndroidRuntime(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.processResult(PermissionHandlerPlugin.kt:286)
E/AndroidRuntime(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.handlePermissionsRequest(PermissionHandlerPlugin.kt:278)
E/AndroidRuntime(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin.access$handlePermissionsRequest(PermissionHandlerPlugin.kt:27)
E/AndroidRuntime(26084): 	at com.baseflow.permissionhandler.PermissionHandlerPlugin$Companion$registerWith$1.onRequestPermissionsResult(PermissionHandlerPlugin.kt:45)
E/AndroidRuntime(26084): 	at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:191)
E/AndroidRuntime(26084): 	at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:125)
E/AndroidRuntime(26084): 	at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:133)
E/AndroidRuntime(26084): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7277)
E/AndroidRuntime(26084): 	at android.app.Activity.dispatchActivityResult(Activity.java:7129)
E/AndroidRuntime(26084): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4217)
E/AndroidRuntime(26084): 	... 9 more
I/Process (26084): Sending signal. PID: 26084 SIG: 9
Lost connection to device.
Exited (sigterm)

A problem occurred configuring project ':google_api_availability'.

πŸ› Bug Report

Including the plugin I get the following error during the compilation time.

  • Error running Gradle:
    Exit code 1 from: myapplication/android/gradlew app:properties:

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':google_api_availability'.

Failed to notify project evaluation listener.
java.lang.AbstractMethodError (no error message)

Version: 2.1.0

Gradle error configuring project ':google_api_availability'

πŸ”™ Regression

Hello,
After upgrading to latest flutter beta (0.9.4) I cannot run my app which depends on this plugin.
Here is the error occurred when running gradle

           FAILURE: Build failed with an exception.
           
           * What went wrong:
           A problem occurred configuring project ':google_api_availability'.
           > Failed to notify project evaluation listener.
              > java.lang.AbstractMethodError (no error message)

Old (and correct) behavior

No error when running gradle

Current behavior

Error running gradle

Reproduction steps

Update to latest flutter beta (0.9.4), run app that depends on this plugin.

Configuration

Flutter doctor output

[√] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.17763.55], locale en-US)
    β€’ Flutter version 0.9.4 at D:\Devs\Flutter\flutter
    β€’ Framework revision f37c235c32 (2 weeks ago), 2018-09-25 17:45:40 -0400
    β€’ Engine revision 74625aed32
    β€’ Dart version 2.1.0-dev.5.0.flutter-a2eb050044

[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
    β€’ Android SDK at D:\AndroidSDK
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-28, build-tools 28.0.2
    β€’ ANDROID_HOME = D:\AndroidSDK
    β€’ Java binary at: D:\AndroidStudio\jre\bin\java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    β€’ All Android licenses accepted.

[√] Android Studio (version 3.1)
    β€’ Android Studio at D:\AndroidStudio
    β€’ Flutter plugin version 27.1.1
    β€’ Dart plugin version 173.4700
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.27.2)
    β€’ VS Code at C:\Program Files\Microsoft VS Code
    β€’ Flutter extension version 2.19.0

[√] Connected devices (1 available)
    β€’ Redmi 3S β€’ c37ae0927d63 β€’ android-arm64 β€’ Android 6.0.1 (API 23)

β€’ No issues found!

Version: 2.0.1

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Location not found on Android

On Android, I am able to find only the last location in memory. If I don't use Google maps or similar to find the coordinates, geolocator return a generic error "Location not found"

Platform Exception locale = null

πŸ› Bug Report

E/flutter (17224): PlatformException(error, locale == null, null)
E/flutter (17224): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551)
E/flutter (17224): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279)
E/flutter (17224):
E/flutter (17224): #2 Geolocator.placemarkFromCoordinates (package:geolocator/geolocator.dart:228)

Expected behavior

It should be grabbing the locale from my phone if a locale isn't specified.

Reproduction steps

Using placemarkFromCoordinates without passing a locale. Working perfectly if a locale is specified.

Configuration

Version: 1.6.4
Flutter: 0.7.5

Platform:

  • πŸ“± iOS
  • πŸ€– Android

android build fails after adding plugin.

Steps to reproduce πŸ“œ

  1. create new project

  2. add geolocator to pubspec.yaml

  3. flutter run

Expected behavior πŸ€”

Tell us what should happen

compile and launch successfully.

Actual behavior πŸ›

Tell us what happens instead

build crashes with this massage

Launching lib\main.dart on Nexus 6P in debug mode...
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\dev\flutter\geo_example\build\geolocator\intermediates\intermediate-jars\debug\classes.jar
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
	at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
	at java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)
	at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:235)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\dev\flutter\geo_example\build\geolocator\intermediates\intermediate-jars\debug\classes.jar
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:550)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$1(DexArchiveBuilderTransform.java:488)
	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/baseflow/flutter/plugin/geolocator/tasks/LocationTask.class
The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}
See https://developer.android.com/studio/write/java8-support.html for details. Alternatively, increase the minSdkVersion to 26 or above.

	at com.android.builder.dexing.DxDexArchiveBuilder.getExceptionToRethrow(DxDexArchiveBuilder.java:143)
	at com.android.builder.dexing.DxDexArchiveBuilder.convert(DxDexArchiveBuilder.java:89)
	at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:545)
	... 6 more
Caused by: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
	at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:711)
	at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:781)
	at com.android.dx.cf.code.Simulator.simulate(Simulator.java:103)
	at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:790)
	at com.android.dx.cf.code.Ropper.doit(Ropper.java:745)
	at com.android.dx.cf.code.Ropper.convert(Ropper.java:350)
	at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:309)
	at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:150)
	at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:102)
	at com.android.builder.dexing.DxDexArchiveBuilder.dex(DxDexArchiveBuilder.java:107)
	at com.android.builder.dexing.DxDexArchiveBuilder.convert(DxDexArchiveBuilder.java:86)
	... 7 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\dev\flutter\geo_example\build\geolocator\intermediates\intermediate-jars\debug\classes.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 34s
Gradle build failed: 1
Exited (sigterm)

Configuration πŸ”§

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.17134.112], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[√] Android Studio (version 3.1)
    X Flutter plugin not installed; this adds Flutter specific functionality.
[!] VS Code, 64-bit edition (version 1.25.0)
[√] Connected devices (1 available)

! Doctor found issues in 1 category.

Version: 1.0.0

Platform:

  • πŸ“± iOS
  • πŸ€– Android

other
i do see that the example app in this repo has modifications to build.gradle, but no reference in ReadMe file to add those modifications. or an explanation why it might be needed.

getPositionStream() should return Stream without wrapping it into Feature

πŸ— Enhancement Proposal

Geolocator.getPositionStream() should return Stream without wrapping it into Feature.

This would revert breaking API change which was introduced in 1.5.0. So breaking API after breaking API πŸ€”

Pitch

I am very new to Dart but I think it is possible to make single stream without wrapping it into async. This could be achieved by converting Feature to Stream and then chaining latestResult to new Stream with StreamTranformation.

If using RxDart class:

Stream<SomeValue> stream = someFeature.asStream().transform(SwitchMapStreamTransformer(otherStreamMapper)))

So RxDart dependency can be introduced or just SwitchMap logic copied to project.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

Compass feature request

πŸš€ Feature Requests

A function that gives us the direction we need to head to get from one place to another. An example being if I enter in coordinates/address for the Louvre museum and I'm standing at the Eiffel Tower, it will give me 266 degrees bearing. So the function itself will just return a double containing the bearing.

Contextualize the feature

I think it could be included in the calculating distance function as it can give the distance and the direction which can be used in navigation in a straight line.

Here is a picture of a website that shows the general idea of what I'm looking for.
Compass

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

NPE when using geolocator with android_alarm_manager

πŸ› Bug Report

When using android_alarm_manager example plus geolocator plugin (see code below), I got following exception.

void printHelloMessage(String msg) {
    Geolocator().getLastKnownPosition(LocationAccuracy.high).then((position) {
      print(new HelloMessage(
        new DateTime.now(),
        msg,
        Isolate.current.hashCode,
        null,
        position.toString(),
      ));
    });
}
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437): Failed to handle method call
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.ContextWrapper.getApplicationContext()' on a null object reference
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at com.baseflow.flutter.plugin.geolocator.tasks.LocationUsingLocationManagerTask.getLocationManager(LocationUsingLocationManagerTask.java:31)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at com.baseflow.flutter.plugin.geolocator.tasks.LastKnownLocationUsingLocationManagerTask.startTask(LastKnownLocationUsingLocationManagerTask.java:17)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at com.baseflow.flutter.plugin.geolocator.GeolocatorPlugin.onMethodCall(GeolocatorPlugin.java:54)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:165)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at android.os.MessageQueue.next(MessageQueue.java:328)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at android.os.Looper.loop(Looper.java:148)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at android.app.ActivityThread.main(ActivityThread.java:6251)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
E/MethodChannel#flutter.baseflow.com/geolocator/methods(25437):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Expected behavior

No exception

Reproduction steps

flutter run with above code snippet

Configuration

Version: 1.6.2

Platform:
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel dev, v0.5.8, on Mac OS X 10.13.6 17G65, locale en-GB)
[βœ“] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[βœ“] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[βœ“] Android Studio (version 3.0)
[βœ“] Connected devices (1 available)

Add CI/CD support

Setup a continuous integration/ continuous deployment pipeline for the plugin. Detailed instructions can be found here.

GeolocationStatus.disabled isn't returned if Location is turned off

Hi,

while testing I found that if the location service is disabled a call to geCurrentLocation just won't return until the service is switched on.

Calling checkGeolocationPermissionStatus doesn't help either because it will just return granted if the permissions are right and seems not to check id the service is available.

Cheers
Thomas

PositionStream won't notify when the Location service stops sending current position

Steps to reproduce πŸ“œ

  1. Build basic app containing a PositionStream subscription like the example in the package's page on pub.dartlang.org.

  2. Run the app while Location services are on and permitted.

  3. Turn off Location (or alternatively revoke permissions) while the app is running.

  4. Wait a few seconds/minutes

  5. Turn Location back on (or enable permissions)

Expected behavior πŸ€”

I should get some indication that the Position stopped streaming once the Location is off, and when it turns back on the Position should start streaming again on its own.

Actual behavior πŸ›

The Position stream works well and i get the Position updates as expected, when i turn Location off the last Position will stay until i manually request a new one using the getPosition method, only then i will get a null Position.

That way if someone had a working location but lost it for any reason there's no way to notify him, and the last position will stay "forever".

In the GIF below you can see this behavior, i'm iterating a GPX file and when i turn off Location there is no indication for that anywhere, until i press the "Refresh" button that has the following code:

void initPlatformState() async {
    Position position;
     try {
      position = await _geolocator.getPosition(LocationAccuracy.high);
    } on PlatformException catch (e) {
      print(e.message);
      position = null;
    }

    if (!mounted) return;

    setState(() {
      _position = position;

      if (_position == null) {
        print('NO LOCATION!');
      }
    });
  }

demo

Is there something i'm doing wrong or that's a flutter's framework constraint?

Configuration πŸ”§

Version: 1.2.1

Platform:

  • πŸ“± iOS
  • πŸ€– Android

getCurrentPosition does not work with gps only

πŸ› Bug Report

getCurrentPosition only works when GPS ist set manually to energysafing/highAccuracy Mode on Android. If the Location Mode is set To GPS only, getCurrentPosition doesnt respond and the Code Stops waiting for a signal without any reply

Expected behavior

working with GPS data Mode "Only Smartphone"

Reproduction steps

You Will never get the Response print "print(position)" in this example, if gps isnt set to energysaving or high accuracy manually

Geolocator geolocator = Geolocator()..forceAndroidLocationManager = true; GeolocationStatus geolocationStatus = await Geolocator().checkGeolocationPermissionStatus(); print(geolocationStatus); Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest); print(position);

Configuration

Version: 1.x

Platform:

  • πŸ“± iOS
  • [ x ] πŸ€– Android

Both Android Fine and Coarse Location Permissions Requested?

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Just wondered why both of these permissions are requested. I think you only need to request Fine.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

error after update

Unable to find source java class: '/home/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.3.0/android/src/main/java/com/baseflow/flutter/plugin/geolocator/tasks/OneTimeLocationTask.java' because it does not belong to any of the source dirs: '[/home/hitanshu/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.4.0/android/src/main/java, /home/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.4.0/android/src/debug/java, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/r/debug, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/buildConfig/debug, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/aidl/debug, /homeAndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/rs/debug]'
error after update

FAILURE: Build failed with an exception

πŸ› Bug Report

FAILURE: Build failed with an exception.

From Flutter Project

What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.android.gms:play-services-location:15.+.
  Required by:
      project :app > project :geolocator
      project :app > project :google_api_availability

Tools > Flutter > Open Android module in Android Studio

Unable to resolve dependency for ':geolocator@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@release/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@release/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@release/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@release/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':geolocator@releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debug/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71.
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugAndroidTest/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71.
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugAndroidTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugUnitTest/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71.
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@release/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71.
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@release/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@release/compileClasspath': Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Open File
Show Details


Unable to resolve dependency for ':google_api_availability@release/compileClasspath': Could not resolve com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0).
Open File

Expected behavior

Reproduction steps

  1. Create new Flutter project from Android Studio
  2. Add flutter-geolocator into dependencies
dependencies:
  geolocator: ^2.0.1

  1. Compile and run

Configuration

flutter doctor -v

[βœ“] Flutter (Channel beta, v0.8.2, on Mac OS X 10.14 18A391, locale en-ID)
    β€’ Flutter version 0.8.2 at /Users/Maulana/Development/flutter
    β€’ Framework revision 5ab9e70727 (4 weeks ago), 2018-09-07 12:33:05 -0700
    β€’ Engine revision 58a1894a1c
    β€’ Dart version 2.1.0-dev.3.1.flutter-760a9690c2

[βœ“] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    β€’ Android SDK at /Users/Maulana/Development/AndroidSDK
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-28, build-tools 28.0.3
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    β€’ All Android licenses accepted.

[βœ“] iOS toolchain - develop for iOS devices (Xcode 10.0)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 10.0, Build version 10A255
    β€’ ios-deploy 2.0.0
    β€’ CocoaPods version 1.5.3

[βœ“] Android Studio (version 3.2)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin version 29.0.2
    β€’ Dart plugin version 181.5616
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[βœ“] VS Code (version 1.27.2)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 2.18.0

[βœ“] Connected devices (1 available)
    β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 8.1.0 (API 27) (emulator)

β€’ No issues found!

Version: 2.0.1

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Customizing Location Request Alert Timing

πŸš€ Feature Requests

Can the plugin be changed so that the location sharing request occurs when the user confirms location sharing through a button tap, for example, rather than requesting location sharing as soon as the app starts?

Contextualize the feature

Basic Permission requesting - makes it more likely that the user will accept location sharing since they are asked before the alert appears.

Describe the feature

Usually a button or some other interaction will cause an alert to appear with location sharing requested. Allow the user to accept location sharing with the tap of a button.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

Android - Appears slow to report first location.

πŸ› Bug Report

Android - Appears slow to report first location, compared to a native Android app. It does not appear to use the Android fused location provider? I have not tested getlastknown I only using get current and also registering for updates.
On Apple a location is return instantly.

Expected

My native Java apps using the fused location provider will generally return a location (of some sort) almost instantly.

Reproduction steps

Followed example code. Seems particularly slow if no wifi/cell connection available and it has to rely on GPS. Have had some reports of no location being returned at all

Configuration

Version:
Latest version of geoLocator

Platform:

  • πŸ“± iOS
  • [x ] πŸ€– Android

Please include the function to check if the location service is on or off on the device

πŸš€ Feature Requests

Please add a function to check if location service is on or off on device.

Describe the feature

Android :

public static boolean isLocationEnabled(Context context) {
    int locationMode = 0;
    String locationProviders;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
        try {
            locationMode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE);
        } catch (SettingNotFoundException e) {
            e.printStackTrace();
            return false;
        }
        return locationMode != Settings.Secure.LOCATION_MODE_OFF;
    }else{
        locationProviders = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
        return !TextUtils.isEmpty(locationProviders);
    }
} 

Refference : https://stackoverflow.com/a/22980843

iOS:


Platforms affected (mark all that apply)

  • [βœ–] πŸ“± iOS
  • [βœ”] πŸ€– Android

Get city name ID

Hi guys,

I'm sorry if this is not the place to put my question, feel free to delete it.

I want to get a city name with your plugin.
My issue is that I need an ID for a city but if my phone language settings are in english the placemark.first.locality give me Venice, when they are in italian I get Venezia.

Do you have any suggestion for solving this?

Thank you for your work.

Android - Api to check if Google Play Services are available

πŸš€ Feature Requests

The current version of the plug-in supports using the Location Services from Google Play Services to acquire location updates. When the Google Play Services are not available the plug-in automatically falls back to the LocationManager.

In certain situations it is possible for the user of the device to take certain steps that would make the Google Play Services available and thus improving the quality of the location updates. To allow app developers to inform the user of the device it would be useful if the developer can request the current status of the Google Play Services.

See also the "Ensure Devices Have the Google Play services APK" of the Set Up Google Play Service

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

GPS Timestamp in Position

πŸš€ Feature Requests

Would love to see the DateTimestamp included in the Position object to assist with determining age of record.

Contextualize the feature

GPS co-ordinates generally includes this value, and hence we believe it is relevant and useful.

Describe the feature

Hopefully it is a matter of including it when the 'position' object is created as part of the call to the device to generate the 'current location'

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

Nice plugin btw ;)

Add update rate to getPositionStream()

Thanks for this plugin, works great!

To save battery live it might be a good idea to be able not only to specify an update rate by distance but also by time.

Build failed when building a project with the plug-in

πŸ› Bug Report

I installed this plug-in yesterday and tried the getCurrentPosition and getLastKnownPosition features. It worked just as expected. Then I did other non-related changes in my project (updated an asset) and when I tried to build again I got this error.

Execution failed for task ':geolocator:compileDebugJavaWithJavac'.
Unable to find source java class: '/Users/lauraroige/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.5.0/android/src/main/java/com/baseflow/flutter/plugin/geolocator/tasks/CurrentLocationTask.java' because it does not belong to any of the source dirs: '[/Users/lauraroige/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.6.0/android/src/main/java, /Users/lauraroige/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.6.0/android/src/debug/java, /Users/lauraroige/ecolocal_app/ecolocal_app/build/geolocator/generated/source/r/debug, /Users/lauraroige/ecolocal_app/ecolocal_app/build/geolocator/generated/source/buildConfig/debug, /Users/lauraroige/ecolocal_app/ecolocal_app/build/geolocator/generated/source/aidl/debug, /Users/lauraroige/ecolocal_app/ecolocal_app/build/geolocator/generated/source/rs/debug]'

I tried changing the version of the plug-in, but when I delete the directory and install it again it always installs the 1.6.0 version regardless of what I try to install (tried with version 1.4.0 as the error mentions versions 1.5.0 and 1.6.0).

The project builds correctly if I eliminate the geolocator import from the pubspec. The build fails as soon as I add the import (even if I don't use it in the project code).

Expected behavior

Build correctly.

Reproduction steps

Add the plug-in to a project.

Configuration

Version: 1.6.0

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Null exception from getLastKnownPosition

in geolocator.dart ln 61:

return Position?._fromMap(position);

Throws an exception when position is null:

NoSuchMethodError: The method 'containsKey' was called on null.

It should instead simply return null if position is null as the documentation specifies.

ISO "ALPHA-2 Code

Is there any way I can get the 2 digits country ISO code? like "AR", "US", etc. from this plugin once it geolocates the device?

Thank you.

geolocator: "1.7.0"

πŸ”™ Regression

On iPhone 1.7.0 Fails to register location permissions. Android works OK.
Permissions package issue?

Old (and correct) behaviour

Successfully register location permissions on iOS 10 and 11

Current behaviour

Fails to register location permissions, then
on iOS 10 crashes out.
on iOS 11 fails to register location permission, app runs.

Reproduction steps

geolocator: "1.6.5"
Works
geolocator: "1.7.0"
Fails
In iOS settings the app has not registered for location permission.

Configuration

Version: 1.7.0

Platform:

  • [ x] πŸ“± iOS
  • πŸ€– Android

Configure location refresh interval

Currently the interval on which the location will be read is hard coded. It would be nice if we can update this so that the developer can change the interval at run-time.

The use-case here would be to allow developers to dial back or increase the frequency depending on the state off the App (e.g. background vs. foreground).

Geolocator doesnt works side by side with onesignal

πŸ› Bug Report

Simply add the onesignal package to geolocator the sample project, configure correctly the two packages, and run on a device and BOOM the trick happens

App crashes...

Expected behavior

Run the app

Reproduction steps

Add the latest onesignal package (oficial or community) from pub packages and run the app, him will crash....

Configuration

dont need...
My pubspec

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  onesignal: ^1.0.2
  geolocator: ^2.0.1

Version: ^2.0.1

Platform:

  • [] πŸ“± iOS
  • πŸ€– Android

Build fail, for iOS: 'geolocator/geolocator-Swift.h' file not found

running flutter build ios --release :

=== BUILD TARGET firebase_messaging OF PROJECT Pods WITH CONFIGURATION Release ===
/Users/****/development/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-0.0.1/ios/Classes/GeolocatorPlugin.m:2:9: fatal error: 'geolocator/geolocator-Swift.h' file not found
#import <geolocator/geolocator-Swift.h>
My doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel dev, v0.5.5, on Mac OS X 10.13.3 17D102, locale pt-PT)
[βœ—] Android toolchain - develop for Android devices
βœ— Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[βœ“] iOS toolchain - develop for iOS devices (Xcode 9.2)
[βœ—] Android Studio (not installed)
[!] VS Code (version 1.14.2)
[!] Connected devices
! No devices available

Crash when denying location access twice

πŸ› Bug Report

First deny returns exception as expected
PlatformException(PERMISSION_DENIED, Access to location data denied, null)

Second time denying, the app crashes

D/AndroidRuntime( 3792): Shutting down VM
E/AndroidRuntime( 3792): FATAL EXCEPTION: main
E/AndroidRuntime( 3792): Process: app.infmarketplace, PID: 3792
E/AndroidRuntime( 3792): java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=34, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {app.infmarketplace/app.infmarketplace.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 3792): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4324)
E/AndroidRuntime( 3792): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4367)
E/AndroidRuntime( 3792): 	at android.app.ActivityThread.-wrap19(Unknown Source:0)
E/AndroidRuntime( 3792): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
E/AndroidRuntime( 3792): 	at android.os.Handler.dispatchMessage(Handler.java:105)
E/AndroidRuntime( 3792): 	at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 3792): 	at android.app.ActivityThread.main(ActivityThread.java:6541)
E/AndroidRuntime( 3792): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3792): 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
E/AndroidRuntime( 3792): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
E/AndroidRuntime( 3792): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 3792): 	at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:162)
E/AndroidRuntime( 3792): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199)
E/AndroidRuntime( 3792): 	at com.baseflow.flutter.plugin.geolocator.data.Result.error(Result.java:30)
E/AndroidRuntime( 3792): 	at com.baseflow.flutter.plugin.geolocator.tasks.LastKnownLocationTask.handleError(LastKnownLocationTask.java:40)
E/AndroidRuntime( 3792): 	at com.baseflow.flutter.plugin.geolocator.tasks.LocationTask$1.onRequestPermissionsResult(LocationTask.java:118)
E/AndroidRuntime( 3792): 	at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult(FlutterPluginRegistry.java:175)
E/AndroidRuntime( 3792): 	at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult(FlutterActivityDelegate.java:132)
E/AndroidRuntime( 3792): 	at io.flutter.app.FlutterActivity.onRequestPermissionsResult(FlutterActivity.java:134)
E/AndroidRuntime( 3792): 	at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7388)
E/AndroidRuntime( 3792): 	at android.app.Activity.dispatchActivityResult(Activity.java:7239)
E/AndroidRuntime( 3792): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4320)
E/AndroidRuntime( 3792): 	... 9 more

Expected behavior

Return the exception again

Reproduction steps

Request last known location as follows

 try {
    Position position = await Geolocator().getLastKnownPosition(LocationAccuracy.medium);
    print(position); // May be null
  } catch (ex) {
    print(ex); // Or fail to give permissions
    // PlatformException(PERMISSION_DENIED, Access to location data denied, null)
  }

Configuration

Version: 1.4.0

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Option to configure distanceFilter

Great work! Good to see we can set desiredAccuracy. Please can we have an option to set DistanceFilter to "throttle" updates.

Thanks.
Nicolas

Optional LocationManager

πŸš€ Feature Requests

Can you add an option to LocationOptions for force LocationManager instead of FusedLocation?

Cannot use geolocator plugin since last flutter upgrade (0.9.6)

πŸ› Bug Report

Can't compile geolocator plugin (due to invalid GoogleApiAvailabilityPlugin compilation) since last upgrade to flutter 0.9.6, but works perfectly before (0.8.5):

.pub-cache/hosted/pub.dartlang.org/google_api_availability-1.0.2/android/src/main/kotlin/com/baseflow/googleapiavailability/GoogleApiAvailabilityPlugin.kt: (29, 48): Type inference failed. Expected type mismatch: inferred type is Boolean? but Boolean was expected
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':google_api_availability:compileDebugKotlin'.
> Compilation error. See log for more details

Thanks for any input !

Expected behavior

Reproduction steps

Configuration

Version: 1.x

Platform:

  • πŸ“± iOS
  • [ x] πŸ€– Android

Doesn't build without !use_framework

πŸ› Bug Report

Cannot build the app for iOS with the '!use_framework' commented out. This causes an issue when using with other libraries (map_view, firebase_*)

Expected behavior

This should be build as to not require the '!use_framework' option on podfile.

Reproduction steps

Try building with 'map_view' and 'geolocator' both present in the pubspec.yaml

Configuration

Version: 1.x

Platform:

  • [*] πŸ“± iOS
  • πŸ€– Android

README.md cleanup

πŸ— Enhancement Proposal

Pitch

I have found a couple of issues in the documentation/README.md, not quite sure if I'm right, hence creating an issue and not a PR.

Issues:

import 'package:geolocator/geolocator.dart';

Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);

desiredAccuracy seems to be a positional argument and not a named argument. The line should be:

Position position = await Geolocator().getCurrentPosition(LocationAccuracy.high);
import 'package:geolocator/geolocator.dart';

Placemark placemark = await Geolocator().placemarkFromAddress("Gronausestraat 710, Enschede");

Here placemarkFromAddress() returns a List and not a Placemark. Should be:

List<Placemark> placemark = await Geolocator().placemarkFromAddress("Gronausestraat 710, Enschede");

There can be a few more issues, but I didn't need more info than this, so I didn't try.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

error

Unable to find source java class: '/home/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.3.0/android/src/main/java/com/baseflow/flutter/plugin/geolocator/tasks/OneTimeLocationTask.java' because it does not belong to any of the source dirs: '[/home/hitanshu/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.4.0/android/src/main/java, /home/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-1.4.0/android/src/debug/java, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/r/debug, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/buildConfig/debug, /home/AndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/aidl/debug, /homeAndroidStudioProjects/onlinecitydemo/build/geolocator/generated/source/rs/debug]'
error after update

await Geolocator().getCurrentPosition blocks.

πŸ’¬ Questions and Help

I am using the following code in which the statement
Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
just hangs and does not reach the next statement

This is what I am doing

Future<Position> getLocation() async
{
    Geolocator geolocator = Geolocator()..forceAndroidLocationManager = true;
    GeolocationStatus geolocationStatus  = await geolocator.checkGeolocationPermissionStatus();
    Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
    return position;
}

Here are the details of my env.

$ flutter doctor -v
[βœ“] Flutter (Channel beta, v0.6.0, on Mac OS X 10.13.6 17G65, locale en-US)
β€’ Flutter version 0.6.0 at /Users/adam/Flutter/flutter
β€’ Framework revision 9299c02cf7 (6 weeks ago), 2018-08-16 00:35:12 +0200
β€’ Engine revision e3687f70c7
β€’ Dart version 2.1.0-dev.0.0.flutter-be6309690f

[βœ“] Android toolchain - develop for Android devices (Android SDK 28.0.0)
β€’ Android SDK at /Users/adam/Library/Android/sdk
β€’ Android NDK location not configured (optional; useful for native profiling support)
β€’ Platform android-28, build-tools 28.0.0
β€’ ANDROID_HOME = /Users/adam/Library/Android/sdk
β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
β€’ All Android licenses accepted.

[βœ“] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
β€’ Xcode at /Applications/Xcode.app/Contents/Developer
β€’ Xcode 9.4.1, Build version 9F2000
β€’ ios-deploy 1.9.2
β€’ CocoaPods version 1.5.0

[βœ“] Android Studio (version 3.1)
β€’ Android Studio at /Applications/Android Studio.app/Contents
βœ— Flutter plugin not installed; this adds Flutter specific functionality.
βœ— Dart plugin not installed; this adds Dart specific functionality.
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[βœ“] IntelliJ IDEA Ultimate Edition (version 2018.1.1)
β€’ IntelliJ at /Applications/IntelliJ IDEA.app
β€’ Flutter plugin version 24.0.2
β€’ Dart plugin version 181.4445.29

[βœ“] Connected devices (1 available)
β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 7.1.1 (API 25) (emulator)

β€’ No issues found!

Any suggestions on why the statement just hangs ?

placemarkFromCoordinates 'List' is not a subtype of type 'Future' error

πŸ› Bug Report

When using placemarkFromCoordinates, I get the error type 'List<dynamic>' is not a subtype of type 'Future<dynamic>' on line 192 in geolocator.dart.

Changing Future<dynamic> placemarks = await _methodChannel.invokeMethod( 'placemarkFromCoordinates', <String, double>{"latitude": latitude, "longitude": longitude}); to

List<dynamic> placemarks = await _methodChannel.invokeMethod( 'placemarkFromCoordinates', <String, double>{"latitude": latitude, "longitude": longitude});

fixes the issue.

Configuration

Flutter 0.7.0

Version: 1.6.2

Platform:

  • πŸ“± iOS
  • πŸ€– Android

error: Target of URI doesn't exist: 'package:geolocation/geolocation.dart

hi, i'm using this plugin but afther add the dependence in pubspec.yaml
geolocator: "^1.7.0"
i'm importing into a dart file ->
import 'package:geolocation/geolocation.dart';
i did flutter packages get, but in my dart analysis i get.
error: Target of URI doesn't exist: 'package:geolocation/geolocation.dart'. (uri_does_not_exist at [xxxxx] lib\screens\Home\tab_location.dart:8)

flutter doctor -v
[√] Flutter (Channel dev, v0.8.4, on Microsoft Windows [Versión 10.0.14393], locale es-US)
β€’ Flutter version 0.8.4 at c:\flutter
β€’ Framework revision 7f7a731da0 (2 days ago), 2018-09-14 13:11:32 -0400
β€’ Engine revision 7a9b430d74
β€’ Dart version 2.1.0-dev.4.0.flutter-c28db2d6e1

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
β€’ Android SDK at C:\Users\Alex\AppData\Local\Android\sdk
β€’ Android NDK location not configured (optional; useful for native profiling support)
β€’ Platform android-27, build-tools 27.0.3
β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.

[√] Android Studio (version 3.1)
β€’ Android Studio at C:\Program Files\Android\Android Studio
β€’ Flutter plugin version 28.0.1
β€’ Dart plugin version 173.4700
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[!] Connected devices
! No devices available

! Doctor found issues in 2 categories.

how i do to solve this error?

thank you

The use of Swift 3 @objc inference in Swift 4 mode is deprecated.

Steps to reproduce πŸ“œ

When compiling for iOS release

Expected behaviour πŸ€”

Clean build.

Actual behaviour ⚠️

The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with β€œUse of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.

Thanks

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.