Open bigbossmaher opened 7 years ago
@bigbossmaher For my experience, this plugin already works when app closed/in background/in screen off. iOS/Android will trigger your subscription when user has crossed your geo fences. If local notification doesn't work, you can try ionic push notification.
is it possible to send local notification using ionic push notification ? how ? because when i use cordova-plugin-geofence only the notification is shown only when the app is opened
Local/Push notification are different things. Push needs server side to send message. Local only concerns stuffs inside mobile. I suggest using local notification which has been already integrated in this plugin. It works in iOS, not tested for Android.
can you please tell me what is the plugin that i can use to make local notification , and please just tell me what is the code that i should put to send local notification thnaks
Have a look at this plugin https://github.com/katzer/cordova-plugin-local-notifications
Something like this:
window.geofence.onTransitionReceived = function (geofences) {
geofences.forEach(function (geo) {
console.log('Geofence transition detected', geo);
// Your code here to use plugin
cordova.plugins.notification.local.schedule({
id: 1,
title: "Geofence title",
text: "Geofence text"
});
});
};
@bigbossmaher @seed880505 javascript execution may be suspended when your application is the background, so the code above may not work. @bigbossmaher if you set notification
object for geofence, you should get local notification. If you need to execute some custom action, https://github.com/cowbell/cordova-plugin-geofence#listening-for-geofence-transitions-in-native-code native code is the best choice.
hi , thank you for your answer. i'm satisfied about the current fonctionalities in the plugin . but it not working some times . how we can fix this ?
Maybe you set too small radius? This plugin is a wrapper to native Geofence APIs which comes with all of their's limitations.
i'm developping an app that notify the user when he is in the parking , to help us to have an idea how much the parking is full ( 25% 50% 75% 100% ). so 50 m as a raduis is good ?
Not sure, you have to look up for some answers on StackOverflow about native geofence API (android or iOS) minimum reliable radius.
why i should use native code ? is this plugin is not working in this situation ?
This plugin uses native API, that's why read about limitations of those. You may also check https://github.com/transistorsoft plugins, maybe their solutions are more suitable for you.
just i want told you that the plugin is work very good when i use fake GPS app . but when i go to the place really i'm not getting a notification :(
Try bigger radius and example applications. I have one always installed on my phone at works everytime, but never tried radius smaller than 200m.
thank you very much
hi , thank you for this awesome plugin is there any way to make the plugin work when ap is closed or in background / when screen off also ?