richou / react-native-android-location-enabler Goto Github PK
View Code? Open in Web Editor NEWDisplay a GoogleMap like android popup to ask for user to enable location services if disabled
License: MIT License
Display a GoogleMap like android popup to ask for user to enable location services if disabled
License: MIT License
These are the packages installed
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-android-location-enabler": "1.2.2",
Android version: 10
Error message: Method addObserver must be called on the main thread
When the gps is turned off and we open the app, I call promptForEnableLocationIfNeeded method which asks the user to enable location with Ok and Cancel buttons. When user selects Ok or Cancel, the promise doesn't work in react-native code. Please update the code.
It will be nice to have a function that only checks if the location is turned on instead of asking to turn it on.
Useful in case for localize icons
such as Google Maps.
if GPS is off, localize the show question mark icon.
I have Problem in android 12
permission will granted but will crash after that
During the execution of the yarn install command, an error occurs indicating that the [email protected] package is not compatible with the arm64 CPU architecture.
How can I solve this?
yarn install
yarn install v1.22.19
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
warning react-native-android-location-enabler > [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
warning react-native-android-location-enabler > degenerator > [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
[3/5] 🚚 Fetching packages...
error [email protected]: The CPU architecture "arm64" is incompatible with this module.
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Apple M1 Pro - macOS Ventura 13.5.2
Yarn Version: v1.22.19
I added this line
RNAndroidLocationEnabler.promptForEnableLocationIfNeeded( ... )
on press event and useeffect. Both sides it says
err [TypeError: null is not an object (evaluating '_reactNativeAndroidLocationEnabler.default.promptForEnableLocationIfNeeded')]
Getting this error message, when trying to run it:
A problem occurred configuring project ':react-native-android-location-enabler'.
Could not resolve all files for configuration ':react-native-android-location-enabler:classpath'.
Could not find bundletool.jar (com.android.tools.build:bundletool:0.1.0-alpha01).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/bundletool/0.1.0-alpha01/bundletool-0.1.0-alpha01.jar
Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/manifest-merger/26.1.0/manifest-merger-26.1.0.jar
Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/ddms/ddmlib/26.1.0/ddmlib-26.1.0.jar
Could not find dvlib.jar (com.android.tools:dvlib:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/dvlib/26.1.0/dvlib-26.1.0.jar
Could not find common.jar (com.android.tools:common:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/common/26.1.0/common-26.1.0.jar
Could not find aapt2-proto.jar (com.android.tools.build:aapt2-proto:0.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/aapt2-proto/0.1.0/aapt2-proto-0.1.0.jar
Hello,
I just added your plugin into my project, but i can't compile it
/Users/mad/Documents/HangoverApp/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:36: error: RNAndroidLocationEnablerModule is not abstract and does not override abstract method onNewIntent(Intent) in ActivityEventListener public class RNAndroidLocationEnablerModule extends ReactContextBaseJavaModule implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, ResultCallback<LocationSettingsResult>, ActivityEventListener { ^ /Users/mad/Documents/HangoverApp/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:122: error: method does not override or implement a method from a supertype @Override ^ 2 errors
it's on ResultCallback and the Override of onActivityResult()
I used react-native link, but checked the code with your manual setup's step and it's the same...
(I use the i18n plugin, fbsdk plugin too, maybe it's doing a conflict, don't know)
android sdk 25
Thank you in advance
May you please add screenshots (ideally GIF) of this in action in repo? That's the first thing a lot of RN package searchers do. There are so many packages its not easy to install each one (this one especially as it requires native linking), render it respecting properties, then uninstall it if it doesn't fit.
Is it possible to explain why we need location access in the prompt? Or for this would i need to roll my own dialog, and then use some native module to enable location services for my app. (is it possible to auto enable location services for my app, as this dialog does?)
Do you think about ios support?
The library was working fine till yesterday. I am using latest version only.
Even if i click OK button, that popup dialog 'To continue, turn device location' shows again and again
Hello. It took me 1 hour to import your package but it doesn't work yet. Would you mind creating new example for me to have a look easily?
hi, i have this usse
"react": "16.6.3",
"react-native": "0.59.3",
"react-native-android-location-enabler": "^1.2.0",
/Applications/XAMPP/xamppfiles/htdocs/picpuc/app/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:7:5-117 to override.
Greetings,
First of all thank you for this great react native library,
The issue is when I test this library in Android Physical device,
Always in the first time I will get denied if I select OK!
and after that the library back to normal and works great,
I tested many times and the same result,
error message:
Error: denied
at createErrorFromErrorData (b06a4d22-d319-4883-8…d-d43fd0168137:2023)
at b06a4d22-d319-4883-8…d-d43fd0168137:1975
at MessageQueue.__invokeCallback (b06a4d22-d319-4883-8…d-d43fd0168137:2417)
at b06a4d22-d319-4883-8…d-d43fd0168137:2162
at MessageQueue.__guardSafe (b06a4d22-d319-4883-8…d-d43fd0168137:2330)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (b06a4d22-d319-4883-8…d-d43fd0168137:2161)
at debuggerWorker.js:72
my react info:
"react": "^16.3.0-alpha.1",
"react-native": "^0.54.2",
Best regards.
I'm facing an issue with a very rare use case. I have been using the package for 2 years in our app and haven't faced any issues till now.
But, now I'm facing an issue while trying to enable the location of the device from the app.
The popup is not coming up and the error says ERR03: Internal error
The very interesting thing here is, with the same version of the package, there is no issue with the apk created 10 days ago. If I create an apk with the same code I'm facing the issue now
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-android-location-enabler": "^1.1.0",
"@react-native-community/geolocation": "^2.0.2",
Can someone please help and give a solution for this
Hi, received this error
Attempt to invoke virtual method 'void android.app.Activity.startIntentSenderForResult(android.content.IntentSender, int, android.content.Intent, int, int, int)' on a null object reference
com.google.android.gms.common.api.Status in startResolutionForResult at line 17
com.google.android.gms.common.api.ResolvableApiException in startResolutionForResult at line 3
com.heanoria.library.reactnative.locationenabler.RNAndroidLocationEnablerModule in onComplete at line 120
com.google.android.gms.tasks.zzi in run at line 4
android.os.Handler in handleCallback at line 883
android.os.Handler in dispatchMessage at line 100
com.google.android.gms.internal.tasks.zzb in dispatchMessage at line 6
android.os.Looper in loop at line 237
android.app.ActivityThread in main at line 8167
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 496
com.android.internal.os.ZygoteInit in main at line 1100
RNAndroidLocationEnablerModule
l.120: resolvable.startResolutionForResult(getCurrentActivity(), REQUEST_CHECK_SETTINGS);
is wrapped by trycatch, any idea why this is not handled here?
Hi,
How can I use this library with expo? I've been trying since but constantly getting this error:
[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNativeAndroidLocationEnabler.default.promptForEnableLocationIfNeeded')]
I have this abnormal problem. When I compile the application in debug mode everything works in the correct mode. The moment I create the apk and publish it for online tests, the alert to activate the GPS no longer appears. Anyone know what it is?
Here the specifications:
React Native Environment Info:
System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Memory: 74.91 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.8.0 - /usr/local/bin/node
Yarn: 1.22.0 - ~/.yarn/bin/yarn
npm: 6.13.7 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.3.1/11C505 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.59.8 => 0.59.8
npmGlobalPackages:
react-native-cli: 2.0.1
react-native: 0.61.5
I thank in advance who will want to help me.
App crashed when app state changes from background to foreground.
react-native: 0.47
"react-native-android-location-enabler": "1.0.5"
Fatal Exception: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:30)
at com.facebook.react.bridge.PromiseImpl.resolve(PromiseImpl.java:32)
at com.heanoria.library.reactnative.locationenabler.RNAndroidLocationEnablerModule.onResult(RNAndroidLocationEnablerModule.java:108)
at com.heanoria.library.reactnative.locationenabler.RNAndroidLocationEnablerModule.onResult(RNAndroidLocationEnablerModule.java:37)
at com.google.android.gms.common.api.internal.BasePendingResult$CallbackHandler.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Console now, i'm trying just run android
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
Bahaviour
3 days before everything worked perfect, now we have such problem
I'm getting this error on my physical device screen after running the app: could not invoke RNAndroidLocationEnabler.promptForEnableLocationIfNeeded. found interface com.google.android.gms.location.settingsclient, but class was expected (declaration of 'com.google.android.gms.location.SettingsClient' appears in /data/app/~~dQIJYPyV_0zb5PG-2RsSMg==/applicationId-s0 mk9yoRtp0KWm9j-w-wQ==/ base.apk)
react-native version 0.66.4
"react-native-android-location-enabler": "^1.2.2"
Task :react-native-android-location-enabler:compileReleaseJavaWithJavac FAILED
/home/ravi/workspace/React_native/astroBuild/astro/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:8: error: cannot find symbol
import androidx.annotation.NonNull;
^
symbol: class NonNull
location: package androidx.annotation
/home/ravi/workspace/React_native/astroBuild/astro/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:98: error: cannot find symbol
public void onComplete(@nonnull Task task) {
^
symbol: class NonNull
location: class RNAndroidLocationEnablerModule
2 errors
While using this library, the pop up doesn't come in Android OS 10.
Tried in below devices:
Samsung M21
Poco X2
Can you please resolve or guide about this issue ASAP. Thanks
Hi,
I'm using RN version 0.62.1 and the module version is 1.2.1
Issue : When I start my server getting these errors
> Task :react-native-android-location-enabler:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
46 actionable tasks: 44 executed, 2 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/
com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:18: error: cannot find symbol
import com.google.android.gms.common.api.ApiException;
^
symbol: class ApiException
location: package com.google.android.gms.common.api
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:19: error: cannot find symbol
import com.google.android.gms.common.api.ResolvableApiException;
^
symbol: class ResolvableApiException
location: package com.google.android.gms.common.api
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:23: error: cannot find symbol
import com.google.android.gms.location.LocationSettingsResponse;
^
symbol: class LocationSettingsResponse
location: package com.google.android.gms.location
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:37: error: cannot find symbol
public class RNAndroidLocationEnablerModule extends ReactContextBaseJavaModule implements ActivityEventListener, OnCompleteListener {
^
symbol: class LocationSettingsResponse
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:110: error: cannot find symbol
public void onComplete(@nonnull Task task) {
^
symbol: class LocationSettingsResponse
location: class RNAndroidLocationEnablerModule
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:73: error: cannot find symbol
Task task = LocationServices.getSettingsClient(getCurrentActivity()).checkLocationSettings(builder.build());
^
symbol: class LocationSettingsResponse
location: class RNAndroidLocationEnablerModule
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:73: error: cannot find symbol
Task task = LocationServices.getSettingsClient(getCurrentActivity()).checkLocationSettings(builder.build());
^
symbol: method getSettingsClient(Activity)
location: class LocationServices
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:112: error: cannot find symbol
task.getResult(ApiException.class);
^
symbol: class ApiException
location: class RNAndroidLocationEnablerModule
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:115: error: cannot find symbol
} catch (ApiException exception) {
^
symbol: class ApiException
location: class RNAndroidLocationEnablerModule
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:119: error: cannot find symbol
ResolvableApiException resolvable = (ResolvableApiException) exception;
^
symbol: class ResolvableApiException
location: class RNAndroidLocationEnablerModule
/Users/mac/Desktop/Hams/BackgroundJobTracking/node_modules/react-native-android-location-enabler/android/src/main/java/com/heanoria/library/reactnative/locationenabler/RNAndroidLocationEnablerModule.java:119: error: cannot find symbol
ResolvableApiException resolvable = (ResolvableApiException) exception;
^
symbol: class ResolvableApiException
location: class RNAndroidLocationEnablerModule
11 errorsFAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-android-location-enabler:compileDebugJavaWithJavac'.Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.Get more help at https://help.gradle.org
error: invalid source release: 17
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
What went wrong:
java.lang.StackOverflowError (no error message)
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================
Please help me as soon as possible thanks in advance.
The parameters interval and fastInterval are undocumented
Location Popup is not Appearing on the Screen, and it leads to Inactivity of the Screen.
Version: 9
Device: RealMe: RMX1911
I recently updated react native and RN android location enabler but I get this error when I run the project:
=========================================
Task :react-native-android-location-enabler:compileDebugJavaWithJavac FAILED
...\node_modules\react-native-android-location-enabler\android\src\main\java\com\heanoria\library\reactnative\locationenabler\RNAndroidLocationEnablerModule.java:8: error: package androidx.annotation does not exist
import androidx.annotation.NonNull;
^
...\node_modules\react-native-android-location-enabler\android\src\main\java\com\heanoria\library\reactnative\locationenabler\RNAndroidLocationEnablerModule.java:98: error: cannot find symbol
public void onComplete(@nonnull Task task) {
^
symbol: class NonNull
location: class RNAndroidLocationEnablerModule
2 errors
"react": "^16.10.1",
"react-native": "0.57.8",
"react-native-android-location-enabler": "^1.2.0",
Anyone knows how to fix it?
For specific developments with Bluetooth Low Energy, I need to activate location, but I don't need it to be PRIORITY_HIGH_ACCURACY. It could be nice if we can pass a priority param
This feature is only for android 8.1 and less (https://support.google.com/accounts/answer/3467281?hl=en)
Finished installing it, react-native run-android
outputed the following error:
* Where:
Build file '...\node_modules\react-native-android-location-enabler\android\build.gradle' line: 5
* What went wrong:
A problem occurred evaluating project ':react-native-android-location-enabler'.
> Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.523 secs
{
react-native-cli: 2.0.1
react-native: 0.53.0
}
This sounds a bit weird,but is it possible to actually turn the GPS off by a trigger? Lol
Initially, i had react-native-geolocation
only, then i figured i needed the functionalities of this wonderful package.
But unfortunately after installing it and using its features, the react-native-geolocation doesn't work anymore, it always says permission denied.
Steps to repro:
react-native-geolocation: v1.4.2
this package: v1.2
Edit: Actually i tried to use different GetLocation libraries and all of em crashes when i use this lib.
Hello,
New release of React-native https://facebook.github.io/react-native/blog/2019/07/03/version-60 has changed on how dependencies should be linked.
Regards,
Hello, I have installed react-native-location-enabler on RN 0.61.0-rc.3 and got this error when I am running on a real device:
Could invoke RNAndroidLocationEnabler. promptForEnabledLocationNeeded
null
Failed resolution of: Lcom/google/android/gs/location/LocationRequest;
com.google.android.gms.location.LocationRequest
Failed resolution of: Lcom/google/android/gms/internal/zzbgl
Didn't find class
"com.google.android.gms.internal.zzbgl
FAILURE: Build failed with an exception.
com.android.builder.errors.EvalIssueException: defaultConfig contains custom BuildConfig fields, but the feature is disabled.
To enable the feature, add the following to your module-level build.gradle:
android.buildFeatures.buildConfig true
how to disable location if not needed anymore?
After installing manually correctly, when run react-native run-android the application closes.
It was done:
rm -Rf node_modules
./gradlew clean
and without any results.
I can not detect the error since I do not see any error in the console, only the android message.
x
Hi Team
Im using React Native version 59.10 and the module version i
ve used is 1.1.0
Issue : The pop up correctly when location is turned off but that happens automatically before screen are loaded
as result i`m not able to handle that ok or No Thanks Event
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.