Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: i am trying to call _storeAttendance(action); based on distance but however the distance is wrong even though the location is same #1554

Closed
3 of 8 tasks
devlprRohit opened this issue Aug 13, 2024 · 3 comments
Assignees
Labels
status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue.

Comments

@devlprRohit
Copy link

Please check the following before submitting a new issue.

Please select for which platform(s) you need help

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

Your question

  Future<void> getCurrentPos(String action) async {
    currentPos = await Geolocator.getCurrentPosition(
        desiredAccuracy: LocationAccuracy.medium);
    print("latitude: ${currentPos.latitude} , target latitude : ${targetLatitude}");
    print("longitude: ${currentPos.longitude}, target longitude  : ${targetLongitude}");

    double distance = Geolocator.distanceBetween(
      currentPos.latitude,
      currentPos.longitude,
      targetLatitude,
      targetLongitude,
    );
    print("the distance is ${distance}");

    if (distance <= 100) {
      await _storeAttendance(action);
    } else {
      _showResultDialog("Failed", "You are not within the required distance to check in/out.");
    }
  }

here is the console prints :

I/flutter (13227): latitude: 20.9931481 , target latitude : 20.9911605
I/flutter (13227): longitude: 75.5525976, target longitude : 75.5515482
I/flutter (13227): the distance is 246.6792033217311

Version

12.0.0

@eunseoDev

This comment has been minimized.

@TimHoogstrate
Copy link
Contributor

Dear @devlprRohit,

I can't see that your current location and target location are the same. Furthermore, please give some more context about the issue. How do you know that the distance is wrong? Your location accuracy is medium. Have you tried playing around with this and did you find different answers?

Dear @eunseoDev,

I appreciate your effort, but your issue seems like a different issue. based on your input I cannot help you. Please file a separate issue with clear steps to reproduce. The plugin uses the different api's of iOs and Android I can expect that there is a difference in accuracies.

Kind regards,

@TimHoogstrate TimHoogstrate self-assigned this Aug 19, 2024
@TimHoogstrate TimHoogstrate added the status: needs more info We need more information before we can continue work on this issue. label Aug 19, 2024
Copy link

github-actions bot commented Sep 2, 2024

Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.

@github-actions github-actions bot added the status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. label Sep 2, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue.
Projects
None yet
Development

No branches or pull requests

3 participants