Comments (6)
Use $ npx run:android
or run:iOS
from react-native-background-geolocation.
Your app thinks the plug-in is not installed.
go back to the Setup Instructions and install from scratch. Carefully follow all setup instructions.
Also, provide how youβre launching your app.
from react-native-background-geolocation.
i'll restart the process.
it's quite simple also i am runing the regular npx expo start with Expo Go App
from react-native-background-geolocation.
my App.js
`
import React from 'react';
import {
Switch,
Text,
View,
} from 'react-native';
import BackgroundGeolocation, {
Location,
Subscription
} from "react-native-background-geolocation";
const App = () => {
const [enabled, setEnabled] = React.useState(false);
const [location, setLocation] = React.useState('');
React.useEffect(() => {
console.log('[App] useEffect 001');
/// 1. Subscribe to events.
const onLocation = BackgroundGeolocation.onLocation((location) => {
console.log('[onLocation]', location);
setLocation(JSON.stringify(location, null, 2));
})
const onMotionChange = BackgroundGeolocation.onMotionChange((event) => {
console.log('[onMotionChange]', event);
});
const onActivityChange = BackgroundGeolocation.onActivityChange((event) => {
console.log('[onActivityChange]', event);
})
const onProviderChange = BackgroundGeolocation.onProviderChange((event) => {
console.log('[onProviderChange]', event);
})
console.log('[App] useEffect 002');
/// 2. ready the plugin.
BackgroundGeolocation.ready({
// Geolocation Config
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 0, // Must be 0 or locationUpdateInterval is ignored!
locationUpdateInterval: 5000, // Get a location every 5 seconds
// Activity Recognition
stopTimeout: 500,
// Application config
debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
startOnBoot: true, // <-- Auto start tracking when device is powered-up.
// HTTP / SQLite config
url: 'http://yourserver.com/locations',
batchSync: false, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
autoSyncThreshold: 5,
autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives.
headers: { // <-- Optional HTTP headers
"X-FOO": "bar"
},
params: { // <-- Optional HTTP params
"auth_token": "maybe_your_server_authenticates_via_token_YES?"
}
}).then((state) => {
console.log('[App] useEffect 003');
setEnabled(state.enabled)
console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
});
return () => {
console.log('[App] useEffect Return');
// Remove BackgroundGeolocation event-subscribers when the View is removed or refreshed
// during development live-reload. Without this, event-listeners will accumulate with
// each refresh during live-reload.
onLocation.remove();
onMotionChange.remove();
onActivityChange.remove();
onProviderChange.remove();
}
}, []);
/// 3. start / stop BackgroundGeolocation
React.useEffect(() => {
if (enabled) {
BackgroundGeolocation.start();
} else {
BackgroundGeolocation.stop();
setLocation('');
}
}, [enabled]);
return (
<View style={{alignItems:'center'}} className="mt-50">
Click to enable BackgroundGeolocation
<Text style={{fontFamily:'monospace', fontSize:12}}>{location}
)
}
export default App;`
and my package.json
{ "name": "tr02", "version": "1.0.0", "main": "expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "expo": "~51.0.14", "expo-gradle-ext-vars": "^0.1.2", "expo-status-bar": "~1.12.1", "react": "18.2.0", "react-native": "0.74.2", "react-native-background-fetch": "^4.2.5", "react-native-background-geolocation": "^4.16.3" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }
from react-native-background-geolocation.
do i need to eject my expo app
currently using expo for all our apps because of the dev workflow
from react-native-background-geolocation.
now every thing is OK
it's working only with expo-dev-client not with the regular expo Go app
thanks for your support
you'll hear a lot from me in the next few hours :-) sorry for that lol
from react-native-background-geolocation.
Related Issues (20)
- onEnabled and onGeofence not triggering on production but does work on development HOT 8
- Schedule is not working as expected in IOS HOT 12
- updating location while terminated HOT 2
- Unable to track user location continuously with shorter intervals using heartbeat or background fetch HOT 7
- Question about License Key HOT 3
- getCurrentPosition not working HOT 4
- Updating state in onLocation major lag when screen off HOT 3
- Background geolocation not working HOT 1
- background location not working HOT 6
- Push Notifications Not Triggering on Geofence Entry When App is Closed HOT 1
- Very old (48h) positions still recorded even after having already been flushed HOT 12
- Polgon Geofence licence can't be applied via Expo config plugin HOT 2
- Facing issues in Real devices HOT 3
- iOS native methods mapping with config HOT 2
- It does not get the position clearly and therefore the polyline does not draw smooth lines. HOT 17
- cannot read the property ready of null HOT 10
- LICENCE VALIDATION FAILURE HOT 9
- LICENCE VALIDATION FAILURE on android ( paid licence ) HOT 3
- onGeofence not trigger running HOT 10
- RNBG doesn't send data to server after internet connection was lost and then restored. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-background-geolocation.