-
Notifications
You must be signed in to change notification settings - Fork 40
Geofence.startListening not working #5
Comments
Hey, can you provide me more information here? I’d love to help out! For starters: was this Android or iOS? Did you call Geofence.initialize and did you get a callback that your regions were registered? |
I am using android, I am sharing my code, Can you check it? Whenever I am going outside from region I am not getting notification. import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { class _MyAppState extends State { FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); @OverRide // initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project } // Platform messages are asynchronous, so we initialize in an async method.
} @OverRide
} void scheduleNotification(String title, String subtitle) {
} |
Hey, are you running the example app or did you copy that into your app? if so, dont forget to add the things mentioned in the github readme to your |
yeah, I am using this code in my app and also I am adding things in the manifest. I am not getting that what is the channel id, channel name and channel description, can you clear it how to generate all these? Showing error Unresolved class GeofenceBroadcastReceiver And also unresolved class GeofencePlugin when I am adding receiver and services in manifest.
|
channel id, channel name and channel description are related to the example app, check the referenced library at: https://pub.dev/packages/flutter_local_notifications Running the app locally shows me necessary callbacks happen. |
I am using your example code I am giving code snippet here for startListening method and logger also Can you please check here why I am getting null ... /// Set a callback block for a specific geo-event static void startListening(GeolocationEvent event, GeofenceCallback entry) { I/flutter (27080): event GeolocationEvent.entry entry Closure: (Geolocation) => Null Also, I am getting one error in the manifest which showing in the screenshot /home/aponiar-17/Pictures/Screenshot from 2020-02-10 17-32-58.png |
@DwayneCoussement I tried the example-app and the On my device I have Android 9 running. iOS is working good on phone and simulator. |
I looked a bit into this and could not make it work till now. Just found out that the onReceive function of the GeofenceBroadcastReceiver is never called.... |
|
Is working for me on Android. What I did was set a position on emulator outside of the Geofence, then set new position inside of it and exit the geofence again. Worked just fine. Maybe this can help. |
I have tried that but it is still not working. Edit: @DwayneCoussement Now it looks like even the example app is not working |
@prabhunath111 I just made a contribution as the example app also wasn't working for me. You can try it out and see if this fixes your problem. Basically, it had to do with the background permission. |
@kroobroeck @DwayneCoussement Tested on Pixel 3a XL emulator with android R. Background permission is working and notifications are being delivered but still the core problem of startListening not firing is present. Edit: Tested on device Asus Zenfone Max Pro M1 X100TD with android 10 and NOTHING worked. Again tested on Realme 5 RMX1911 with android 9 and everything worked perfectly. Edit 2: Tested again on Pixel 3a XL emulator with android 10 and just like real device NOTHING worked. |
Can you please provide code snippet to me it will very helpful to me? |
|
Re-Tested on Asus Zenfone Max Pro M1 X100TD with android 10 and everything works perfectly. Made a pixel 3a XL emulator with android 9 and nothing works there. Looks like there's a problem with Emmulators but I can confirm in real device re-test of both Asus Zenfone Max Pro M1 X100TD with android 10 and Realme 5 RMX1911 with android 9 plugin works correctly. |
Update: Example app works perfectly but not the following implementation locationService.dart
orderService.dart
|
Hi @DebkanchanSamadder, I'd be happy to have a look, but could you maybe provide a small demoproject that reproduces the issue? That might be of help to quickly isolate and fix it. |
@DwayneCoussement I tweaked the example app a little bit so here it is:
I was able to isolate 2 problems:
|
I have same issue but when terminated app the listener not trigger but when app is open it's working ! I GeofencerStateMachine: removeGeofences: removeRequest=RemoveGeofencingRequest[REMOVE_BY_PENDING_INTENT pendingIntent=PendingIntent[creatorPackage=com.google.android.gms], packageName=com.google.android.gms] |
is everything working when the app is open? |
Ios working as prefect in open/terminated // test on simulator I want test in real world maybe it will different ! |
I have the same problem, but only the subscription to exit the geofence does not work. Getting into geofence works correctly |
|
This issue has been inactive for a long time |
@DwayneCoussement Any updates? Latest release certainly didn't fix the issue. |
@DwayneCoussement sir, I also facing the same problem here, |
Hello, I have experienced the same problem: startListening method is not invoked on both Android simulator and physical device. Tried with Samsung Galaxy S8 and Moto G5. Thanks! |
i also have the same problem , ! hep please |
So after a while, digging into API documentations and related Android implementation of the plugin, I have understood that events are not triggered when geofence radius is too small for the accuracy level of GPS signal. In fact, by increasing the radius of the geofence, I was able to receive notifications of entrance and exit in/from the fence I have created. Specifically, when I was trying with radius equal to 1 or 10, it was not working, while if I increased it to 100, it was working perfectly. Hope this could help! |
Hope it will work for me also, let me check,If this one works, It'll be
very useful for all of us who are facing this issue in the last few times.
Thanks and love to blaster92...:)
…On Tue, Jun 30, 2020 at 3:02 PM blaster92 ***@***.***> wrote:
So after a while, digging into API documentations and related Android
implementation of the plugin, I have understood that events are not
triggered when geofence radius is too small for the accuracy level of GPS
signal. In fact, by increasing the radius of the geofence, I was able to
receive notifications of entrance and exit in/from the fence I have
created. Specifically, when I was trying with radius equal to 1 or 10, it
was not working, while if I increased it to 100, it was working perfectly.
Hope this could help!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK2CCF4WPJPX66SHYJYWKCTRZGWLVANCNFSM4KPGFO5Q>
.
|
Can anyone please check what's the minimum working radius? |
I checked twice and even with a radius of 100m the geofence is still not working. Furthermore the |
I would say that using a function to verify that current position falls within a predefined geofence (circle or polygon) is a more reliable solution. |
At this point of time it looks like it indeed is the solution. But I have concern about battery life and performance and reliability on low end devices. That was the reason I wanted geofence because I thought it is now a mature solution which is more reliable than my vitamix code. But looking at the current situation, will manually measuring haversine distance as a callback to a location service that runs even when app is killed be a good idea? of course it has a distance filter of 20m and interval of 5 sec |
Same with me, entry events are okay, exit events never fire .. even when increasing the radius to 100 |
@MahmoudEzzatAbdul-Rahman me too, entry fires but exit doesnt |
Hi all, I've been experiencing the same issue as most of you have. From my perspective it seemed that it was very random when the events were triggered -- sometimes they would trigger exactly as they should, and some other times they just wouldn't trigger at all. I've done some digging to understand why this was the case, and ended up finding this interesting post regarding iOS devices; however, we can assume the same/similar applies to android devices as well. Basically, the precision of the location varies between 100-200 meters depending on the device's capabilities and what localization solutions it is using (i.e. GPS or GPS + Wi-Fi) simply put, if the device is connected to a Wi-Fi network, you can assume the minimum radius a geofence region can have is 100 meters. Otherwise it is recommended to stick with 200 meters as a safe bet. Also, the post mentions that geofence events (at least on iOS) are not triggered immediately, rather after 20 seconds give or take to make sure you're not going in-and-out of the geofence region. In other words, it only triggers geofence events if the device is either moving away from the border (i.e. entering the region) and staying inside or if the device is moving toward the border (i.e exiting the region) and staying outside. In a nutshell, it reiterates what @blaster92 was saying and adds one more constraint. I haven't tested the plugin with this new knowledge, but I will try it as soon as possible and update you all. You can read the whole thing in this link: https://developer.apple.com/forums/thread/94091 Also, if anyone got it to work regardless of minimum distance and the other constraints I've talked about above, please let me know! |
UPDATE Hey everyone it's me again, coming with good news. I've tested the plugin with the constraints I've outlined above and it works perfectly. For testing, I defined two different Georegions and set a radius of 200 meters for both. Drove around a little bit and got both entry and exit events for both regions. As I predicted, sometimes the events are triggered a little late, and sometimes they trigger pretty fast. For those still experiencing this issue, I would suggest trying these suggestions out and see if it works. I'll also submit a pull request to add those constraints to the documentation of this plugin so future users are aware of these constraints from the get-go. Cheers :D |
Hey, is this library working to fetch geofence entry exit points? |
Facing the same issue. I am getting notifications of entry to a geofence region but not getting any exit events. |
Why the Geofence.startListening method is not calling?
The text was updated successfully, but these errors were encountered: