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

[Bug]: Flutter app not update automatically position with geolocator and geocoding #1595

Open
3 of 8 tasks
zine3 opened this issue Oct 26, 2024 · 1 comment
Open
3 of 8 tasks

Comments

@zine3
Copy link

zine3 commented Oct 26, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

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

Steps to reproduce

i have add the permission




and follow the documentation
Screenshot_20241026_152925 1
it only works when i change to go a new refreshing page

Expected results

i need that the city position automatically appears when i open the app

Actual results

not showing the position

Code sample

Code sample
 // If permission is granted, retrieve the current position
    if (serviceEnabled) {
      try {
        Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best);

        final String currentTimeZone = await FlutterTimezone.getLocalTimezone();
        prayerTimeAPI(position.latitude, position.longitude, currentTimeZone);
        getAddress(position.latitude, position.longitude);
        update();
      } catch (e) {
        await prefs.setBool("isLocationDenied", true);
        bool? storedFontSize = prefs.getBool("isLocationDenied");
        if (storedFontSize != null) {
          isLocationDenied.value = storedFontSize;
        }
// Get Address Function====>
  getAddress(double lat, double long) async {
    try {
      List<Placemark> addressList = await placemarkFromCoordinates(lat, long);

      final callAddress = addressList.first;
      currentAddress.value = callAddress.locality!;
      update();
    } catch (e) {
      print("Location not found");
    }
  }

Screenshots or video

Screenshots or video demonstration

[Upload media here]

Version

9.0.2

Flutter Doctor output

Doctor output
flutter doctor -v
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [version 10.0.22631.4391], locale fr-FR)
    • Flutter version 3.24.3 on channel stable at C:\Users\adjem\AppData\Local\flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (6 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\adjem\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35303.130
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:       
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] VS Code (version 1.94.2)
    • VS Code at C:\Users\adjem\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.98.0

[√] Connected device (4 available)
    • SM F721B (mobile) • R5CT83M4X2L • android-arm64  • Android 14 (API 34)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [version 10.0.22631.4391]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 130.0.6723.70
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 130.0.2849.56

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
@TimHoogstrate
Copy link
Contributor

Dear @zine3,

Do you get a position at al?

Kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants