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

Location not getting #613

Closed
usaman9040 opened this issue Jul 29, 2021 · 10 comments
Closed

Location not getting #613

usaman9040 opened this issue Jul 29, 2021 · 10 comments
Labels

Comments

@usaman9040
Copy link

usaman9040 commented Jul 29, 2021

solved

@misaelriojasftf
Copy link

same issue here

@misaelriojasftf
Copy link

for ios doesn't work

@TaiTrien
Copy link

TaiTrien commented Aug 3, 2021

Same issue on iOS

@VarmaTech
Copy link

java/io/flutter/plugins/GeneratedPluginRegistrant.java:29: error: cannot find symbol
flutterEngine.getPlugins().add(new com.lyokone.location.LocationPlugin());
^
symbol: class LocationPlugin
location: package com.lyokone.location

@aliazimoshan
Copy link

I use
location: 4.3.0
doesn't work in ios.

@Zeehshan
Copy link

Zeehshan commented Aug 6, 2021

same issue on mine side, butt also not working in android

@cchamm
Copy link

cchamm commented Aug 10, 2021

Not working in Huawei P20.

@AbhideepChakravarty
Copy link

It is not working in deployed mode for web. While development everything seems working as expected. The moment I packaged and deployed the application and tried testing it, suddenly it is not able to fetch the location. What might be going wrong?

@SamoilovEA
Copy link

SamoilovEA commented Sep 20, 2021

Hi guys. I managed to solve the problem.
What was the problem:
When the application was debugged, everything worked as expected. But if you create an .apk file and open it, then nothing happened. I also noticed that not all devices have this problem. For example, Android Emulators do not have this problem, so I was at a loss why my Google Play users complain that nothing works for them! :(

But I noticed that if you reload the Class that is responsible for this, then everything works! I have little experience with Flutter, but here's how I solved the problem:

class _MyAppState extends State<MyApp> {
  Location location = Location();
  LocationData? _locationData;
  bool? _serviceEnabled;
  @override
  void initState() {
    super.initState();
    timerLocationData();
  }

  timerLocationData() {
    Timer.periodic(
      Duration(seconds: 2),
      (timer) {
        vPermissionGranted();
        if (_locationData != null) {
          timer.cancel();
          setState(() {});
        }
      },
    );
  }

  void vPermissionGranted() async {
    PermissionStatus _permissionGranted;
    _serviceEnabled = await location.serviceEnabled();
    if (!_serviceEnabled!) {
      _serviceEnabled = await location.requestService();
    }
    _permissionGranted = await location.hasPermission();
    if (_permissionGranted == PermissionStatus.denied) {
      _permissionGranted = await location.requestPermission();
      if (_permissionGranted != PermissionStatus.granted) {}
    }
    if (_locationData == null) {
      _locationData = await location.getLocation();
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: _locationData != null
          ? HomePage(locationData: _locationData!)
          : const Center(
              child: CircularProgressIndicator(),
            ),
    );
  }
}

As I said, I have little experience, so I hope there is an easier way to fix this.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Apr 16, 2022
@stale stale bot closed this as completed Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants