Geofence Plugin for Xamarin Released

2»

Posts

  • PalakkumarPalakkumar USMember

    I am still having this error even after I updated the packages to the latest version:

    Error executing task LinkAssemblies: error XA2006: Reference to metadata item 'Android.Gms.Common.GoogleApiAvailability Android.Gms.Common.GoogleApiAvailability::get_Instance()' (defined in 'Geofence.Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Geofence.Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved

  • PalakkumarPalakkumar USMember

    @CyrilCathala
    Can you please tell how you fixed the problem in details (like step by step) if you can. It would be very helpful. I am new to android/Xamarin.

  • CyrilCathalaCyrilCathala FRMember ✭✭

    Well the pull request from Gerald has been merged so you can retrieve the source code from the master branch, build it and reference the dll directly within your project. It should work that way...

  • PalakkumarPalakkumar USMember

    @CyrilCathala

    Thank You for replying. What do you mean by referencing the dll directly in my project. Do you mean copy the dll files to my project. (If yes, what folders do I copy it to?). And what dll files should I reference? Just the one with "Geofence.Plugin.dll"?

    Thanks in Advance.

  • CyrilCathalaCyrilCathala FRMember ✭✭

    You can put the dlls within an "Assemblies" folder in your solution, or whatever you like.
    Then you can mimic the same folder hierarchy as the NuGet one, putting the dlls you have built in the same place.
    Then you reference the dll you need per project, just note what NuGet do and try to do the same.

    Or you can wait a bit, the pull request was merged so it should be a matter of days before the new version is pushed to NuGet.

  • RendyDelRosarioRendyDelRosario DOUniversity ✭✭✭

    Package is updated now

  • kwackmasterkwackmaster USMember

    Hi,
    The plugin doesn't work on IOS (9.3)
    I'm having the same issue where CrossGeofence.Current is throwing System.InvalidCastException: Specified cast is not valid.
    It seems this plugin doesn't work on IOS. You can reproduce it by doing the following:
    1. In Visual studio, create a new PCL and a new blank IOS app
    2. Add the Geofence plugin from nuget to both projects
    3. Create an implementation of IGeofenceListener in the library and reference the library in the IOS project
    4. Initialize the listener as said in the doc in the App delegate:
    CrossGeofence.Initialize();
    At this point try to access CrossGeofence.Current. You'll get the same exception.
    It's such a basic scenario, has no one else seen this?

    @RendyDelRosario said:
    Hi

    @DavidCatteuw Are you still having the issue?

    Do you have a sample repo that reproduce this situation to test?

  • kwackmasterkwackmaster USMember

    Actually I found the problem:
    locationManager.MonitoredRegions includes all CLCircularRegion and CLBeaconRegions which are monitored. If you're monitoring beacons within the app, they will be in the MonitoredRegions collection.
    Since this component only focusses on geolocations, it makes sense to cast as follows:

    NSSet monitoredRegions = locationManager.MonitoredRegions;

                foreach (var mRegion in monitoredRegions)
                {
                    var region = mRegion as CLCircularRegion;
                    if (region == null)
                    {
                        continue; 
                    }
                    //If not on regions remove on startup since that region was set not persistent
                    if (!Regions.ContainsKey(region.Identifier))
                    {
                        locationManager.StopMonitoring(region);
                    }
                    else
                    {
                        locationManager.RequestState(region);
                    }
    
                }
    

    This occurs in the constructor as well as LocationsUpdated().
    Hopefully this change can go in for the next update.

    @kwackmaster said:
    Hi,
    The plugin doesn't work on IOS (9.3)
    I'm having the same issue where CrossGeofence.Current is throwing System.InvalidCastException: Specified cast is not valid.
    It seems this plugin doesn't work on IOS. You can reproduce it by doing the following:
    1. In Visual studio, create a new PCL and a new blank IOS app
    2. Add the Geofence plugin from nuget to both projects
    3. Create an implementation of IGeofenceListener in the library and reference the library in the IOS project
    4. Initialize the listener as said in the doc in the App delegate:
    CrossGeofence.Initialize();
    At this point try to access CrossGeofence.Current. You'll get the same exception.
    It's such a basic scenario, has no one else seen this?

    @RendyDelRosario said:
    Hi

    @DavidCatteuw Are you still having the issue?

    Do you have a sample repo that reproduce this situation to test?

  • Dennis.StringifyDennis.Stringify USMember ✭✭

    Hi,
    thanks very much for the plugin and the fixes.

    I have a question related to the CrossGeofence.Initialize method for Android. Is the boolean parameter, requestLocationPermission doing anything when the app is built against and targeting API level 23? I am not seeing any permission to use location when I set this flag. I would normally do this myself, but I am experiencing a very strange problem where the app will switch to a black screen and then crash whenever I try and call ContextCompat.CheckSelfPermission or RequestPermissions, so was hoping that this was going to work in CrossGeofence.

    thanks,
    Dennis

  • Dennis.StringifyDennis.Stringify USMember ✭✭

    Fixed my issues when I discovered there was a plug in for permissions. Still unclear why I was having issues, very weird, but it's now working fine.

  • DharumaRajDharumaRaj USMember ✭✭
    edited September 2016

    im getting the following exception. When I installed the v1.1.1
    System.TypeLoadException: Could not load type 'Android.Gms.Common.GoogleApiAvailability' from assembly 'Xamarin.GooglePlayServices.Basement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. @RendyDelRosario
    Any fix for this. I'm not able to use the latest update beacuse I'm not able to update my Xamarin.GooglePlayservices.Base to 29.0.0.2

  • DharumaRajDharumaRaj USMember ✭✭

    Is there any property to know that I have entered a Region,because I have to store the entry time to the server. I'll use that property to make server calls. @RendyDelRosario

  • EncryptionEncryption USMember
    edited October 2016

    Great plugin @RendyDelRosario! I created a sample app and everything worked fine.

    Couple questions I haven't seen answered wholly:

    1) Are you still actively developing this?

    2) Can this plugin monitor location while the app is terminated? (not in background) How does that work on iOs and Android?

    3) What provides the information to the Current.LastKnownLocation? I intend to check this whenever location changed event is triggered. Will it be consistent and accurate information from the GPS?

    Thank you!

  • MCvelMCvel USMember ✭✭

    @DharumaRaj did you were able to fix the TypeLoadException using the v1.1.1 ?

    thanks

  • MCvelMCvel USMember ✭✭

    Hi @GeraldVersluis do you know if there's a way to use this library along TK.CustomMap which I have already on a project however due dependencies issues I'm not being able to do it, the closest I'am on this is:

    adding this Geofence plugin v 1.1.1, along with

    Xamarin.GooglePlayServices.Base 29.0.0.1
    Xamarin.GooglePlayServices.Basement 29.0.0.1
    Xamarin.GooglePlayServices.Location 29.0.0.1
    Xamarin.GooglePlayServices.Maps 29.0.0.1

    Xamarin.Forms.Maps 2.3.2.127

    TK.CustomMap 1.5.0

    the packages are added correctly, but when I try to Build, I get the message

    Error: Error executing task LinkAssemblies: error XA2006: Reference to metadata item 'Android.Gms.Common.GoogleApiAvailability Android.Gms.Common.GoogleApiAvailability::get_Instance()' (defined in 'Geofence.Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Geofence.Plugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved.

    I'm actually trying with Acr.Geofencing, but the OnRegionStatusChanged is not being called properly, so I want to try this plugin since seems very complete,

    I appreciate it a lot,

    regards

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    Hi @MCvel I think this is not going to work without updating the Acr.Geofencing dependencies or at least synchronising the dependencies for them to work together.

  • MCvelMCvel USMember ✭✭

    @GeraldVersluis said:
    Hi @MCvel I think this is not going to work without updating the Acr.Geofencing dependencies or at least synchronising the dependencies for them to work together.

    Thanks mate!

  • SomeshThati.9145SomeshThati.9145 USUniversity ✭✭

    I am not able to install Xamarin.Forms.Maps after installing this plugin on Android.. Does that mean Forms Map functionality will not work if we want Geofencing in android??

  • SomeshThati.9145SomeshThati.9145 USUniversity ✭✭

    @MCvel said:
    @DharumaRaj did you were able to fix the TypeLoadException using the v1.1.1 ?

    thanks

    I am getting the similar exception using 1.1.1.. Any Ideas??

  • ibrahimnadaibrahimnada USMember

    Can anyone give me a vaild nugit package none of the is woking they all demand android mono v 7

  • HelloWorldThereHelloWorldThere USMember ✭✭

    This plugin does not work anymore after updating google play service.

  • AshaarAshaar USMember ✭✭
    edited March 21

    I am running the sample app which I have downloaded from https://github.com/domaven/xamarin-plugins

    Unfortunately I am getting below 2 errors

    • When application load it throws below error from MapPage.xaml.cs/onAppearing but still app is running without crashing

      mapView.MoveToRegion (
                  MapSpan.FromCenterAndRadius (
                      new Xamarin.Forms.Maps.Position (lat, lon), Distance.FromMiles (1)).WithZoom (20));
      
    • When adding geofence radious and press OK, from below code snippet it throws exception saying
      'System.NullReferenceException: Object reference not set to an instance of an object' and it continuously displaying 'loading' icon

      CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion (place.Name,place.Latitude,place.Longitude,place.Radius) {
      
                      NotifyOnStay=true,
                      StayedInThresholdDuration=TimeSpan.FromMinutes(5)
      
                  });
      
  • CanAlganCanAlgan USMember

    @RendyDelRosario I'm getting this error when trying to use Maps in my Xamarin.Android app. Not sure which update caused it but restoring the older versions won't help:

    -Using-
    Xamarin Google Play Services Version 42.1021.1 (Basement 10.2.1)

    C:\Users\rendy\Maven\xamarin-plugins\Geofence\Geofence\Geofence.Plugin.Android\GeofenceImplementation.cs: Error XA4204: Unable to resolve interface type 'Android.Gms.Common.Apis.GoogleApiClient/IConnectionCallbacks'. Are you missing an assembly reference? (XA4204)

  • KarlCodouniKarlCodouni USMember

    @RendyDelRosario will the compatibility issue between Xamarin Google Play Services and your plugin on Android be resolved soon or should we look for another plugin?

    Thanks!

  • RendyDelRosarioRendyDelRosario DOUniversity ✭✭✭

    Hey I'm planning on working on this in a few weeks.

  • SlowmindSlowmind HRMember

    @RendyDelRosario Hi, i'm working on tracking pet location app and using geofence, when we can expect this compatibility issue is going to be fixed?

  • BuddhimaKudagamaBuddhimaKudagama USMember ✭✭

    OnRegionStateChanged event does not work....

    public void OnRegionStateChanged(GeofenceResult result) { if (result.Transition == GeofenceTransition.Exited || result.Transition == GeofenceTransition.Entered) { MessagingCenter.Send(result, "region"); } }

  • LakshanLakshan USMember

    I'm not getting Notifications at all. OnMonitoringStarted and OnLocationChanged are triggering but not OnRegionStateChanged. What might be the issue?

    CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion(branchcode, 6.940474, 79.878434, 5) { StayedInThresholdDuration = TimeSpan.FromMilliseconds(1000), NotifyOnEntry = true, NotifyOnExit = true, NotifyOnStay = true, ShowNotification = true, NotificationStayMessage = "In", ShowEntryNotification = true, ShowExitNotification = true, ShowStayNotification = true });

  • LakshanLakshan USMember

    Sorry. It is working. but it is bit slow to trigger the OnRegionStateChanged.

  • CanAlganCanAlgan USMember

    @RendyDelRosario Hi Rendy, are you planning to work on this issue? (Google Play Services compatibility)

  • joaobp7joaobp7 BRMember ✭✭

    Hi guys! Has anyone here solved this problem?

    Severity Code Description Project File Line Suppression State
    Error Unable to resolve interface type 'Android.Gms.Common.Apis.GoogleApiClient/IConnectionCallbacks'. Are you missing an assembly reference? Base.Droid C:\Users\rendy\Maven\xamarin-plugins\Geofence\Geofence\Geofence.Plugin.Android\GeofenceImplementation.cs

  • JimKOZLOWSKIJimKOZLOWSKI USMember ✭✭

    @RendyDelRosario Thanks for this plugin! I saw support is coming for Region expiration time support. What is the ETA on this? Thanks.

  • RobinSchroeder.8683RobinSchroeder.8683 USMember ✭✭
    edited November 13

    @joaobp7 said:
    Hi guys! Has anyone here solved this problem?

    Severity Code Description Project File Line Suppression State
    Error Unable to resolve interface type 'Android.Gms.Common.Apis.GoogleApiClient/IConnectionCallbacks'. Are you missing an assembly reference? Base.Droid C:\Users\rendy\Maven\xamarin-plugins\Geofence\Geofence\Geofence.Plugin.Android\GeofenceImplementation.cs


    I am experiencing this same problem
    Running:
    GooglePlayServices.Base 42.1001.0
    GooglePlayServices.Basement 42.1001.0
    GooglePlayServices.Location 42.1001.0
    GooglePlayServices.Maps 42.1001.0
    GooglePlayServices.Tasks 42.1001.0

    The problem does not seem to occur with the 29.0.0.2 series of Google Play Services Libraries.

2»
Sign In or Register to comment.