Uncaught (in promise) CapacitorException: "BackgroundGeolocation" plugin is not implemented on web at createPluginMethod
< /code>
Вот объявление о фоновой диалекту: < /p>
import { registerPlugin } from '@capacitor/core';
const BackgroundGeolocation = registerPlugin('BackgroundGeolocation');
mounted() {
BackgroundGeolocation.addWatcher(
{
// If the "backgroundMessage" option is defined, the watcher will
// provide location updates whether the app is in the background or the
// foreground. If it is not defined, location updates are only
// guaranteed in the foreground. This is true on both platforms.
// On Android, a notification must be shown to continue receiving
// location updates in the background. This option specifies the text of
// that notification.
backgroundMessage: 'Cancel to prevent battery drain.',
// The title of the notification mentioned above. Defaults to "Using
// your location".
backgroundTitle: 'Tracking You.',
// Whether permissions should be requested from the user automatically,
// if they are not already granted. Defaults to "true".
requestPermissions: true,
// If "true", stale locations may be delivered while the device
// obtains a GPS fix. You are responsible for checking the "time"
// property. If "false", locations are guaranteed to be up to date.
// Defaults to "false".
stale: false,
// The minimum number of metres between subsequent locations. Defaults
// to 0.
distanceFilter: 50
},
function callback(location, error) {
if (error) {
if (error.code === 'NOT_AUTHORIZED') {
if (
window.confirm(
'This app needs your location, ' +
'but does not have permission.\n\n' +
'Open settings now?'
)
) {
// It can be useful to direct the user to their device's
// settings when location permissions have been denied. The
// plugin provides the 'openSettings' method to do exactly
// this.
BackgroundGeolocation.openSettings();
}
}
return console.error(error);
}
this.location = { lat: location.latitude, lng: location.longitude };
return console.log(location);
}
).then(function after_the_watcher_has_been_added(watcher_id) {
// When a watcher is no longer needed, it should be removed by calling
// 'removeWatcher' with an object containing its ID.
BackgroundGeolocation.removeWatcher({
id: watcher_id
});
});
},
Я не могу заставить его работать на Android и Web, и он выбрасывает эту ошибку:
для более подробного контекста, я использую capacitor. Ionic/Vue 7
Я пытаюсь использовать @incacitor-community/facky-Geolocation с использованием [b] Ionic Vue [/b], но он говорит [code]Uncaught (in promise) CapacitorException: "BackgroundGeolocation" plugin is not implemented on web at createPluginMethod < /code> Вот объявление о фоновой диалекту: < /p> import { registerPlugin } from '@capacitor/core'; const BackgroundGeolocation = registerPlugin('BackgroundGeolocation'); [/code] И вот где я использую его на монтированном : [code] mounted() { BackgroundGeolocation.addWatcher( { // If the "backgroundMessage" option is defined, the watcher will // provide location updates whether the app is in the background or the // foreground. If it is not defined, location updates are only // guaranteed in the foreground. This is true on both platforms. // On Android, a notification must be shown to continue receiving // location updates in the background. This option specifies the text of // that notification. backgroundMessage: 'Cancel to prevent battery drain.', // The title of the notification mentioned above. Defaults to "Using // your location". backgroundTitle: 'Tracking You.', // Whether permissions should be requested from the user automatically, // if they are not already granted. Defaults to "true". requestPermissions: true, // If "true", stale locations may be delivered while the device // obtains a GPS fix. You are responsible for checking the "time" // property. If "false", locations are guaranteed to be up to date. // Defaults to "false". stale: false, // The minimum number of metres between subsequent locations. Defaults // to 0. distanceFilter: 50 }, function callback(location, error) { if (error) { if (error.code === 'NOT_AUTHORIZED') { if ( window.confirm( 'This app needs your location, ' + 'but does not have permission.\n\n' + 'Open settings now?' ) ) { // It can be useful to direct the user to their device's // settings when location permissions have been denied. The // plugin provides the 'openSettings' method to do exactly // this. BackgroundGeolocation.openSettings(); } } return console.error(error); } this.location = { lat: location.latitude, lng: location.longitude }; return console.log(location); } ).then(function after_the_watcher_has_been_added(watcher_id) { // When a watcher is no longer needed, it should be removed by calling // 'removeWatcher' with an object containing its ID. BackgroundGeolocation.removeWatcher({ id: watcher_id }); }); }, [/code] Я не могу заставить его работать на Android и Web, и он выбрасывает эту ошибку:
для более подробного контекста, я использую capacitor. Ionic/Vue 7
Я пытаюсь
import Geolocation from '@react-native-community/geolocation';
in my react native app
I have done yarn add @react-native-community/geolocation
but I keep getting the module is not linked error.
I have tried restarting the app and added...
Я пытаюсь
import Geolocation from '@react-native-community/geolocation';
in my react native app
I have done yarn add @react-native-community/geolocation
but I keep getting the module is not linked error.
I have tried restarting the app and added...