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

Geolocation not working on MIUI 8 (Xiaomi mi5s) #1703

Closed
Zerokk opened this issue Jun 19, 2017 · 27 comments
Closed

Geolocation not working on MIUI 8 (Xiaomi mi5s) #1703

Zerokk opened this issue Jun 19, 2017 · 27 comments

Comments

@Zerokk
Copy link

Zerokk commented Jun 19, 2017

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request

Current behavior:
When I try to get my current position, the device just takes a really long time (2-3 minutes) to get it, while Google Maps itself works pretty nice. Works great on a Samsung S5, but... why not in my Xiaomi device?

Expected behavior:
Should get the current position really quick, as it does with other apps.

Steps to reproduce:
It stops for so long time, at this particular line:

this.geolocation.getCurrentPosition().then((position) => {
-->

Related code:

insert any relevant code here
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.0
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.1
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.0.1

System:

Node       : v7.9.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 4.2.0

package.json:

{
"name": "Myapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@ionic-native/core": "^3.6.0",
"@ionic-native/geolocation": "^3.8.0",
"@ionic-native/splash-screen": "^3.5.0",
"@ionic-native/status-bar": "3.4.2",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.3",
"cordova-plugin-compat": "^1.0.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-geolocation": "^2.4.3",
"cordova-plugin-googlemaps": "~1.4.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.1",
"cordova-plugin-whitelist": "^1.3.1",
"image-manipulation": "0.0.4",
"ionic-angular": "3.0.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"parse": "^1.9.2",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "^1.3.1",
"@ionic/cli-plugin-cordova": "1.4.0",
"@ionic/cli-plugin-ionic-angular": "1.3.1",
"typescript": "~2.2.1"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "AIzaSyDFX_9vIksX3JMDVjDIRa5bxoioWCW_q4g",
"API_KEY_FOR_IOS": "AIzaSyDFX_9vIksX3JMDVjDIRa5bxoioWCW_q4g"
},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android"
]
}
}

@Zerokk
Copy link
Author

Zerokk commented Jun 19, 2017

I must add that I'm not completely sure if the problem is with MIUI 8 or with Android 6...

@Zerokk Zerokk changed the title Geolocation not working on MIUI (Xiaomi mi5s) Geolocation not working on MIUI 8 (Xiaomi mi5s) Jun 19, 2017
@danielsogl
Copy link
Owner

Update your dependencies to theirs latest releases and try it again.

@Zerokk
Copy link
Author

Zerokk commented Jun 19, 2017

@danielsogl What do you recommend me for that? Should I run npm install in my project folder? I think they are in their latest releases, but I don't really know

@Zerokk
Copy link
Author

Zerokk commented Jun 19, 2017

Updated @ionic-native/geolocation to the version 3.12.1, works the same in navigator, but still having the same problem in my Xiaomi.

Any ideas?

@danielsogl
Copy link
Owner

Check out the latest ionic release notes for release 4.3.x.
Then,run npm outdated to see the latest available releases.

The latest release for ionic native packages are 3.12.x

@Zerokk
Copy link
Author

Zerokk commented Jun 19, 2017

Used npm update, then npm install. Now my whole project is dead and ionic serve won't work. I'm trying to fix this up and then try to get back into upgrading the depedencies individually, but now, I'm in a dead point. Will update as soon as I get the project fixed.

NPM should get its shit together with the dependencies management...

@Zerokk
Copy link
Author

Zerokk commented Jun 19, 2017

@danielsogl Updating the dependencies didn't work. Now my project is properly migrated to the latest version of each peer dependency, and everything works fine, except for the geolocation thingy.

I tried many things, I'm even monitoring the device and could locate the problem: both cordova navigator geolocation plugin, and ionic-native/Geolocation, fail delivering a response. They just throw error 3 always: timeout, and after some time, they reply with the position. Is taking usually 3-4 mins for that reply.

At the moment, it only happens to my Xiaomi mi5s (MIUI 8, Android 6), but it may happen in other devices. Tried everything, even disabling the high precission, but I can't still get a good location, though other apps do it correctly (tried with JustEat and Google Maps). Do you know what may be happening?

PD: It works perfectly in a Samsung S5 and the browser.

Thank you!

@stormwin
Copy link
Contributor

@Zerokk
it is known that some Xiaomi devices with specific ROMs (EU MIUI ROM i think) have a problem with geolocation service. It's software problem. You can find some discussions here (https://xiaomi.eu/community/)
I tested my app on multiple Xiaomi devices (Redmi 3, Redmi Note 3 PRO, Mi5sPlus), all with MIUI 8 on global ROM and geolocation service works without problems

@ihadeed
Copy link
Collaborator

ihadeed commented Jun 20, 2017

Looks like an issue with the plugin, and not with the Ionic Native wrapper. I'm going to close this issue but feel free to keep the conversation going.

To verify that it's not an Ionic Native issue, please run the following command and compare the behaviour with the one you experienced earlier:

import { Geolocation } from '@ionic-native/geolocation';

...

// run this somewhere in your code
Geolocation.getPlugin().getCurrentPosition(x => console.log('Success', x), e => console.log('Error', e));

@ihadeed ihadeed closed this as completed Jun 20, 2017
@Zerokk
Copy link
Author

Zerokk commented Jun 20, 2017

@ihadeed I don't get any response from that snippet. It's just as with the normal one: it just gets a lot of time to get a response from the GPS.

@stormwin I can't find any thread that talks about it; I'm thinking in posting the bug by myself. Do you know if there's a discussion about this topic? They should release an update if it's a ROM problem. Anyways, geolocation works good for you? Don't you know if there can be any workaround to fix this?

I'm beginning to think that Cordova is not suitable for proper GPS functioning, as many people say... I don't feel any comfortable knowing that my app doesn't work in 1 out of 2 devices I tried this far.

@karansharma27
Copy link

I am facing the same issue with my Redmi Note 4. Did you find any solution to the problem?

@Zerokk
Copy link
Author

Zerokk commented Oct 5, 2017 via email

@karansharma27
Copy link

So what can be done? Actually it worked fine in my Redmi some days back. IDK what happened now. Any workaround??

@Zerokk
Copy link
Author

Zerokk commented Oct 5, 2017 via email

@rajeevriitm
Copy link

I am having the same issue with note 4. I had it earlier but an MIUI update fixed it. But the latest update broke it again. Its not a problem with ionic wrapper so its not going to be solved here.

@rajatsawant
Copy link

I am having the same issue with Redmi Note 4.

@rajeevriitm
Copy link

It is a cordova plugin issue. But I dont think its going to be fixed from their side. Background geolocation plugin do work. But the plugin 5 times heavier .

@sandeepdillerao
Copy link

I am also facing same issue in redmi MIUI 8. but working fine woth redmi note 3. but not working in redmi 4 and note 4.

@rajeevriitm
Copy link

I expected it to be rectified on MiUI9 but it was not. So I eventually decided to look for other plugins. And google maps plugin did a much better job. It was faster and offered google play services . But its heavy. I needed maps too so I decided to go with it.

@hemanthg4
Copy link

@Zerokk, Your package.json exposes your API Keys, hope you've changed them by now.

@Spanchal21
Copy link

Spanchal21 commented Nov 29, 2017

Please help,
it tested on different Android phones to identify current location issues, find below results :

Mobile Handset | Android Version | Status (current location shows)

Moto G4 Plus | Android 7.0 | WORKING
MI Note 3 | Android 6+, MIUI 8+ | WORKING
Honor holly 2 plus |   | WORKING
Coolpad 3600I | Android 6.0.1 | NOT WORKING
Samsung J7 |   | WORKING
Moto g 3 |   | WORKING
Moto g 3 | Android 6 | NOT WORKING
Redmi note 4 | Android 7, MIUI 9 | NOT WORKING
Redmi 4 | Android 7.1.2 MIUI 9.1 | WORKING

@dmastag
Copy link

dmastag commented Dec 8, 2017

@rajeevriitm I am curious about you mentioning that the google maps plugin using the getMyLocation() is performing better. Did you have any problems using that? Can I just use that function and not any of ther other google maps functions which I don't need?

@rajeevriitm
Copy link

@dmastag I am yet to face any problem . I did make a pull request to use getMyLocation to work without loading map. But I havent tested on many phones. Would be happy to see it tested on many phones. You can check the latest commit but I dont think documentation is ready yet.

@helloitsyf
Copy link

@Spanchal21 I think it might be a MIUI issue?
My location services used to work when i was on MIUI 8.X
Failed to work after I upgraded it to 9.1

Same app works on a samsung galaxy 5.

@rherrerag
Copy link

rherrerag commented Dec 20, 2017

I am having the same issue too with Redmi Note 4, Android 7, MIUI 9. Android Emulator with Nexus 5 is also returning nothing. I have all the dependencies updated.

With Moto G4 Plus, ionic serve and iOS it is working fine. I will test it on other devices soon.

@apicpich
Copy link

test on Redmi note 4 | Android 7
turn on gps device only not with assistant by wifi or cellular network it's fix my ionic app with geolocation.

@Maninder-cell
Copy link

5 years have passed but the problem is still persistent not working with mi devices. Sometimes it works and sometimes not. Any solutions?

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