O app dá erro se o GPS não estiver habilitado
Opened this issue · 7 comments
Ocorre o erro "Location provider is unavailable. Make sure that location services are enabled". Ele funciona por um tempo, depois começa a dar esse erro. Lembro de ter ocorrido uma vez, mas é preciso testar o app pra ver se volta a ocorrer, desativando o GPS, o 4G e o WiFi, um de cada vez para ver como o app se comporta.
Tudo isso é usado para obter a localização, sendo o GPS o mais preciso, mas o que mais consome bateria.
No iPhone ocorreu
[Unhandled promise rejection: Error: Background Location has not been configured. To enable it, add `location` to `UIBackgroundModes` in Info.plist file.]
Stack trace:
node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:99:50 in fn
node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.js:15:46 in moduleName.methodInfo.name
node_modules/expo-location/build/Location.js:331:49 in startLocationUpdatesAsync
node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
node_modules/regenerator-runtime/runtime.js:274:30 in invoke
node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
node_modules/regenerator-runtime/runtime.js:135:28 in invoke
node_modules/regenerator-runtime/runtime.js:170:17 in PromiseImpl$argument_0
node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
node_modules/promise/setimmediate/core.js:200:23 in doResolve
node_modules/promise/setimmediate/core.js:66:12 in Promise
node_modules/regenerator-runtime/runtime.js:169:31 in PromiseImpl$argument_0
node_modules/regenerator-runtime/runtime.js:192:38 in enqueue
node_modules/regenerator-runtime/runtime.js:219:8 in exports.async
node_modules/expo-location/build/Location.js:329:7 in startLocationUpdatesAsync
utils/LocalizacaoDispositivo.js:14:38 in startLocationBackgroundUpdate
node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
node_modules/regenerator-runtime/runtime.js:274:30 in invoke
node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
node_modules/regenerator-runtime/runtime.js:135:28 in invoke
node_modules/regenerator-runtime/runtime.js:145:19 in PromiseImpl.resolve.then$argument_0
node_modules/promise/setimmediate/core.js:37:14 in tryCallOne
node_modules/promise/setimmediate/core.js:123:25 in setImmediate$argument_0
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:146:14 in _callTimer
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:194:17 in _callImmediatesPass
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:458:30 in callImmediates
[native code]:null in callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:407:6 in __callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:143:6 in __guard$argument_0
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:142:17 in __guard$argument_0
[native code]:null in flushedQueue
[native code]:null in invokeCallbackAndReturnFlushedQueue
@manoelcampos, Bom dia, instalei o apk, estou testando no meus celulares e no da minha esposa. Eu desabilitei a localização o aplicativo pediu para que eu ativar a localização novamente. Se eu não ativar a localização o app não da erro. Más estou testando ainda.
Não esquece de desativar WiFi e 4G também.
Sim, estou fazendo desse jeito.
Ragir, como ficou a issue?
Você precisa descrever o que fez e fechá-la.
@manoelcampos, Boa noite, eu instalei o apk no dispositivo, quando eu desabilito a localização e abro o mapa o app não da erro apenas pede para abilitar a localização. Caso eu não abilite a localização o app continua funcionando. Agora no emulador o erro e reproduzido no console.log, más o app continua funcionando. Sobre o erro no iPhone não tem como eu emular no iPhone.
Então, se no emulador deu erro, é preciso mais testes. Envia o texto da msg de erro completa aqui
Está sendo exibido esse erro no console.
undefined is not an object (evaluating 'data.results[1].address_components')
- utils/LocalizacaoDispositivo.js:94:32 in getGeocodingLocalizacao
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:274:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:135:28 in invoke
- node_modules/regenerator-runtime/runtime.js:145:19 in PromiseImpl.resolve.then$argument_0
- node_modules/promise/setimmediate/core.js:37:14 in tryCallOne
- node_modules/promise/setimmediate/core.js:123:25 in setImmediate$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:146:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:194:17 in _callImmediatesPass
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:458:30 in callImmediates
- [native code]:null in callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:407:6 in __callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:143:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:142:17 in __guard$argument_0
- [native code]:null in flushedQueue
- [native code]:null in callFunctionReturnFlushedQueue