Comments (6)
I did some digging… I encounter this problem only when using Ionic. When I create an app with cordova create myproject and install the plugin, I can access the window.geofence object.
But with Ionic it says it is undefined… have somebody else encountered the same issue? Can somebody please help? Thanks
from cordova-plugin-geofence.
Did you run on device or browser? Cordova plugins always be undefined on browsers. If you're running on device, giving plugin version and other information from command ionic info
would help pinpointing the problem faster.
from cordova-plugin-geofence.
Hey Papermonster,
I deleted my comment from before… it seems to work now. Thanks for the other issue you opened. Fixing this solved the problem + running it on the device.
One more thing, if you could help me out once more. Is there a way to specify options for this plugin, such as accuracy or the frequency how often the current location is checked?
I tested some geofences that are relatively close to each other (about 100 metres)… I registered them each with a radius of 10 but when I jumped between the coordinates for both I always got an enter event for both geofences. When I choose some geofences that are further part this does not occur.
Thanks,
Florian
from cordova-plugin-geofence.
I don't think you can specify accuracy or frequency unless modifying the plugin, as this plugin relies on standard iOS' region monitoring feature which is based on 'significant location change'. A discussion at Stackoverflow pointed out that the location mainly comes from surrounding Wi-Fi hotspots and cellular towers, not GPS. Also, region entrance/exit only triggers when crossing boundary by at least ~200m, as following quote from the documentation:
When testing your region monitoring code in iOS Simulator or on a device, realize that region events may not happen immediately after a region boundary is crossed. To prevent spurious notifications, iOS doesn’t deliver region notifications until certain threshold conditions are met. Specifically, the user’s location must cross the region boundary, move away from the boundary by a minimum distance, and remain at that minimum distance for at least 20 seconds before the notifications are reported.
The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if Wi-Fi is disabled, region monitoring is significantly less accurate. However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.
Therefore, regions smaller than 150m radius placed too close together are unlikely to be caught by region monitoring correctly.
If you really need high-accuracy region monitoring, you might consider modifying the plugin to utilize standard location (and/or background mode setup) which continuously track the location for the specified level of accuracy, at the cost of more battery draining.
from cordova-plugin-geofence.
@PaperMonster Thanks a lot for your help and the explanation.
from cordova-plugin-geofence.
I'm having this issue with geofence and phonegap.
I created a new phonegap project, installed the plugin, edit the config.xml as has been suggested else where
npm install -g phonegap
phonegap create geofenceTest com.test.geofence geofenceTest
phonegap plugin add cordova-plugin-add-swift-support
phonegap plugin add cordova-plugin-geofence
Edit config.xml to change the min version from 14 to 16
<preference name="android-minSdkVersion" value="16" />
Edit the index.html
<script type="text/javascript">
app.initialize();
try {
window.geofence.initialize(function(){console.log(1)}, function(){ console.log(2)}).then(function(){console.log(3)});
} catch (e) {
console.log(e)
}
</script>
When I then run the app (I'm using Webstorm with Phonegap/cordova plugin installed, running the serve command for android ) and I just receive this exception everytime
[phonegap] [console.log] TypeError: Cannot read property 'initialize' of undefined
from cordova-plugin-geofence.
Related Issues (20)
- Not getting IOS Notification , but Works on android HOT 2
- Geofence notification in background is working up to android version 7 only
- Unable to install the plugin HOT 3
- repo dead? HOT 2
- It is not working with ionic 4 Cordova 9 HOT 2
- Notifications are not working on latest android version >= 8 HOT 4
- Geofence notifications are not working in background HOT 2
- Not working on ios HOT 2
- Working geofence repo HOT 3
- This is not working in cordova 8 Please add support for cordova 8 HOT 4
- XCODE 11. Swift version not supported HOT 4
- Notification not showing in Android 9+ device
- cannot find symbolimport android.support.v4.app.NotificationCompat;
- Found the mobile hotspot blocked this plugin notification.
- TypeError: Object(...) is not a function at Geofence.initialize HOT 2
- Plugin not creating Local notifications even when app is open
- xamarin Support
- Not able install and use the geofence plugin, following is the error am getting
- Not compatible with Cordova Android 11 due `android:exported` error HOT 1
- Maintained repo
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 cordova-plugin-geofence.