Forum Xamarin.Forms

Beacons

AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

Is it possible to read beacons in pcl?

Posts

  • AllisterAllister USMember ✭✭

    yes (though I'm yet to work out how to get android to monitor for beacons in the background in a pcl project)

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @Allister can you inform me when you have found a solution? Thanks

  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Thanks @JamesMontemagno . Do you confirm this is only for Estimote beacons?

  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    You can use the estimate sdk for any beacon.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @JamesMontemagno , are you sure? It' a great thing!
    Thanks

  • AllisterAllister USMember ✭✭

    @alessandrocaliaro if @jamesmontemagno is right and the estimotes sdk works for generic beacons then give that a look, but I'm seeing gimbal beacons with the AltBeacon component and that see's generic beacons.
    https://components.xamarin.com/gettingstarted/android-altbeacon-library
    I just don't have background scanning hooked up yet in the android project of my PCL solution, and its not on our short todo list this month.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @AllanRitchie , first of all congratulation for MVP, I am happy for you.
    I've downloaded, like suggested by @JamesMontemagno , the estimote-xplat from github.
    I would like to run Android sample, but when I run it I have 268 errors as

    /Users/alessandrocaliaro/Projects/Test/estimotes-xplat/Samples/Samples.Droid/Resources/Resource.Designer.cs(111,111): Error CS0117: Samples.Droid.Resource.Animation' does not contain a definition fordesign_fab_in' (CS0117) (Samples.Droid)

    /Users/alessandrocaliaro/Projects/Test/estimotes-xplat/Samples/Samples.Droid/Resources/Resource.Designer.cs(114,114): Error CS0117: Samples.Droid.Resource.Color' does not contain a definition forcardview_dark_background' (CS0117) (Samples.Droid)

    and so on.

    I have done some mistakes?

    Thanks

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    Looks like your sdk is out of date. Nothing really to do with the sample code

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Yes, it was Xamarin.Android.Support.xxx to update
    Thanks

  • Hi @AllanRitchie, I've downloaded the estimote-xplat from github (branches 1.5).

    I've tried to set a region with the UUID of my beacon but in the following list views:

    • Ranging
    • Monitoring
    • Eddystones
      nothing appears (the listviews seem empty)

    My current version of Xamarin Studio is 5.9.7 .

    I have done some mistakes?

    Thanks a lot

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @AndreaTodeschini.3063 Are you testing with the samples? I hardcode a bunch of regions to scan. You also need to make sure you grant permissions on the device when it requests them.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @AllanRitchie, What does it mean "you grant permissions on the device...". I'm using your estimote demo...

    In Xamarin Studio "Application Output " tab I read

    [BluetoothAdapter] onClientRegistered() - status=0 clientIf=1
    [BluetoothAdapter] onScanResult() - Device=DD:01:E3:CA:53:A5 RSSI=-61
    [BluetoothAdapter] onScanResult() - Device=DD:01:E3:CA:53:A5 RSSI=-61
    [BluetoothAdapter] stopLeScan()

    So it seems that something is "in range" but nothing appears on the screen.

    Do I have to "register" the beacon in Android? I have inserted the second line:

        public static IList<BeaconRegion> Regions { get; } = new List<BeaconRegion> {
            new BeaconRegion("whites", "B9407F30-F5F8-466E-AFF9-25556B57FE6D"),
            **new BeaconRegion("beacon 2", "8E6DBFBB-489D-418A-9560-1BA1CE6301DF")**
        };
    
  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    On IPhone (with your demo) I have a beacon listed on "Ranging" Tab. So the problem seems to be in Android.

    In iOS, If I have the app in background, the "OnRanged" event is no longer raised. Is it possible to listen to Beacons also when App is in background?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @Allister have you some news about your tests?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @AlessandroCaliaro No, you cannot technically range while in the background (or at least it is heavily discouraged). That is what monitoring is for. I would encourage you to read developer.estimote.com to get a full understanding of how to work with beacons.

    I am seeing beacons range on my droid device. Make sure you are on a device with 4.3 with BLE enabled stuff. Check the return from the Initialize method

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Thanks @AllanRitchie I have understand that I have to use "monitoring" ...
    I have changed my device. On these device I have installed "Beaconfig" app that reads (without do nothing) 2 beacons.
    Now with your sample installed (and added the region how I have written in the previous post), going to "Monitoring" tab I don't see any beacons.
    What I have to do to read these 2 beacons?
    I'm doing some mistakes?
    Thanks Allan!
    have a nice weekend

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @AllanRitchie have you some suggestion for my problem?
    Your app works very well on iOS, but in Android "Monitoring" does not monitor anything

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @AlessandroCaliaro make sure you are triggering the monitoring events (entry and exit). Take a look at the following to run a test. developer.estimote.com/ibeacon/tutorial/part-2-background-monitoring/#test-monitoring-flip-to-sleep

    Keep in mind that it can take upwards of 30 seconds before an exit is triggered. Entries are almost instant

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Sorry @AlanRitchie but your example is PCL and works in iOS. I think it should works also in Android without any changes. I don't see specific code for android that is commented so it does not works...

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @AllanRitchie I have take a look to to your link.
    I have installed Estimote App on my iPhone and try the "Device" option, but the radar does not see my beacons. I am a little confused... Why your app "Range" my beacons (on iOS...) and Estimote app does not range them?

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @AlessandroCaliaro You keep bouncing between the two things. Ranging and monitoring are two different things. Ranging will find all beacons near you, monitoring will trigger an event if you enter or exit the region you are monitoring.

    I have tested both ranging and monitoring on android and ios without issue.

    This library does not officially support non-estimote beacons... if you are using non-estimote beacons like what you said above, then you are on your own. Read the FAQ listed right on the github page https://github.com/aritchie/estimotes-xplat

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Thanks @AllanRitchie for your answer. I Have understand correctly the difference between Range and Monitor.

    I have a NON estimote beacon that is Ranged and Monitored correctly in iOS but in Android it is not Ranged and is not Monitored (with your PCL example).

    Could be a 'parse' problem of received data?

    I don't know the reason for this strange behavior.

    By the way thanks for the time you have spent to help me. I will search some others libs.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @AllanRitchie I would like to update you about Estimotes-xplat.
    I have now a estimote beacons and your app works fine in Android and iOS.
    So the problem could be that the previous beacons was not a Estimote beacon (It's always present the question "why iOS Monitor the beacon and Android not"?...).
    By the way, I would like to understand if it was a "Parser" problem.
    I am searching for BeaconParser (or a method like this...) in Estimote SKD but I haven't found it...

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    @AlessandroCaliaro I knew it was an non-estimote problem after the very last post I made. The library is called estimote-xplat intentionally. You will not find a beaconparser because that is an open source idea to deal with the specific manufacturer beacon problem on android. So you didn't find it because it simply isn't there. The estimoteSDK uses the iOS iBeacon framework underneath the hood. Please talk to estimote for any further answers to your question.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Ok Allan, thanks again

Sign In or Register to comment.