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

lat, lng is 0 #20

Open
jinesh08 opened this issue Nov 8, 2017 · 3 comments
Open

lat, lng is 0 #20

jinesh08 opened this issue Nov 8, 2017 · 3 comments
Labels

Comments

@jinesh08
Copy link

jinesh08 commented Nov 8, 2017

In many phones its working perfect but in few phones lag lng is zero all the time. any solution?

@ocram ocram added the question label Nov 8, 2017
@ocram
Copy link
Contributor

ocram commented Nov 8, 2017

What are these “few phones”? Which manufacturers, which Android versions?

Apart from that, how do you create and use the instance of this library? Can you show the code?

@jinesh08
Copy link
Author

jinesh08 commented Nov 9, 2017

// instance of this library
@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView= inflater.inflate(R.layout.fragment_dispatch, container, false);
location = new SimpleLocation(getActivity());
location.setListener(new SimpleLocation.Listener() {
@OverRide
public void onPositionChanged() {
}
});
bindViews(rootView);
return rootView;
}

//then just called location.getLatitude(); and location.getLongitude() in few methods

//phones in which this code is not working
moto e4 plus android 7.1.1
Jio lyf phone android 6.0.1
MI redmi note 4

on other phones same code is working

pls help

@ocram
Copy link
Contributor

ocram commented Nov 9, 2017

  1. Do you have one (or two) permissions set up correctly (and been granted them) as shown in the README?
  2. Can you check the return value of location.hasLocationEnabled()?
  3. I don't see any call to location.beginUpdates();.
  4. (I don't see any call to location.endUpdates();.)
  5. Try logging something in the onPositionChanged callback method.

Otherwise, can you move the instance and its creation to the parent Activity and then follow the README?

@ocram ocram mentioned this issue Apr 26, 2018
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

2 participants