diff --git a/XPlat/Estimote/Android/External-Dependency-Info.txt b/XPlat/Estimote/Android/External-Dependency-Info.txt new file mode 100644 index 0000000000..062abeb1b4 --- /dev/null +++ b/XPlat/Estimote/Android/External-Dependency-Info.txt @@ -0,0 +1,38 @@ +THIRD-PARTY SOFTWARE NOTICES AND INFORMATION +Do not translate or localize + +Xamarin Components for Estimote SDK for Android incorporates +third party material from the projects listed below. The original copyright +notice and the license under which Microsoft received such third party +material are set forth below. Microsoft reserves all other rights not +expressly granted, whether by implication, estoppel or otherwise. + +######################################## +# Estimote SDK for Android +# https://github.com/Estimote/Android-SDK +######################################## + +The MIT License (MIT) + +Copyright (c) 2013 Estimote, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +######################################## +# end - Estimote SDK for Android +######################################## diff --git a/XPlat/Estimote/Android/License.md b/XPlat/Estimote/Android/License.md new file mode 100644 index 0000000000..803f57c885 --- /dev/null +++ b/XPlat/Estimote/Android/License.md @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) .NET Foundation Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +20171017 diff --git a/XPlat/Estimote/Android/build.cake b/XPlat/Estimote/Android/build.cake index 016577ab0b..d5010d830b 100644 --- a/XPlat/Estimote/Android/build.cake +++ b/XPlat/Estimote/Android/build.cake @@ -1,13 +1,9 @@ -#tool nuget:?package=XamarinComponent -#addin nuget:?package=Cake.XCode -#addin nuget:?package=Cake.Xamarin -#addin nuget:?package=Cake.Xamarin.Build -#addin nuget:?package=Cake.FileHelpers +#load "../../../common.cake" -var NUGET_VERSION = "0.11.0.1"; +var NUGET_VERSION = "1.0.3"; -var ESTIMOTES_VERSION = "0.11.0"; +var ESTIMOTES_VERSION = "1.0.3"; var ESTIMOTES_SDK_URL = "http://search.maven.org/remotecontent?filepath=com/estimote/sdk/" + ESTIMOTES_VERSION + "/sdk-" + ESTIMOTES_VERSION + ".aar"; var ESTIMOTES_DOC_URL = "http://search.maven.org/remotecontent?filepath=com/estimote/sdk/" + ESTIMOTES_VERSION + "/sdk-" + ESTIMOTES_VERSION + "-javadoc.jar"; @@ -44,11 +40,7 @@ Task ("externals") .Does (() => { CreateDirectory ("./externals/"); - DownloadFile (ESTIMOTES_SDK_URL, "./externals/estimotes.aar"); - DownloadFile (ESTIMOTES_DOC_URL, "./externals/javadocs.jar"); - - Unzip ("./externals/javadocs.jar", "./externals/javadocs/"); }); Task ("clean") diff --git a/XPlat/Estimote/Android/component/Details.md b/XPlat/Estimote/Android/component/Details.md index 0b7968dfb6..3d14b47aa0 100644 --- a/XPlat/Estimote/Android/component/Details.md +++ b/XPlat/Estimote/Android/component/Details.md @@ -34,7 +34,7 @@ Beacon is only a piece of hardware broadcasting radio signal. On top of that, th # Estimote SDK for Android -The Estimote SDK for Android is a library that allows interaction with Estimote beacons & stickers. The SDK system works on Android 4.3 or above and requires device with Bluetooth Low Energy (SDK's min Android SDK version is 9). +The Estimote SDK for Android is a library that allows interaction with Estimote beacons & stickers. The SDK system works on Android 4.3 or above and requires device with Bluetooth Low Energy. It allows for: diff --git a/XPlat/Estimote/Android/component/GettingStarted.md b/XPlat/Estimote/Android/component/GettingStarted.md index 16157a9ba7..02ff8093b2 100644 --- a/XPlat/Estimote/Android/component/GettingStarted.md +++ b/XPlat/Estimote/Android/component/GettingStarted.md @@ -2,12 +2,13 @@ The system requirements are Android 4.3 and Bluetooth Low Energy. ## Quick start for beacon ranging -The `BeaconManager` class is the primary means of interating with Estimotes. Create an instance of this class, and use the `.Connect` method, passing it `BeaconManager.IServiceReadyCallback` object. When the BeaconManager is up and running, it will notify clients by call `BeaconManager.IServiceReadyCallback.OnServiceReady()`. At this point the client can start ranging or monitoring for the Estimotes. +The `BeaconManager` class is the primary means of integrating with Estimotes. Create an instance of this class, and use the `.Connect` method, passing it `BeaconManager.IServiceReadyCallback` object. When the BeaconManager is up and running, it will notify clients by call `BeaconManager.IServiceReadyCallback.OnServiceReady()`. At this point the client can start ranging or monitoring for the Estimotes. The following code shows an example of how to use the `BeaconManager`. ```csharp -using Estimote; +using EstimoteSdk.Service; +using EstimoteSdk.Observation.Region.Beacon; namespace Estimotes.Droid { @@ -17,7 +18,7 @@ namespace Estimotes.Droid static readonly int NOTIFICATION_ID = 123321; BeaconManager _beaconManager; - Region _region; + BeaconRegion _region; protected override void OnCreate(Bundle bundle) { @@ -30,10 +31,10 @@ namespace Estimotes.Droid // Default values are 5s of scanning and 25s of waiting time to save CPU cycles. // In order for this demo to be more responsive and immediate we lower down those values. _beaconManager.SetBackgroundScanPeriod(TimeUnit.Seconds.ToMillis(1), 0); - _beaconManager.EnteredRegion += (sender, e) => { + _beaconManager.BeaconEnteredRegion += (sender, e) => { // Do something as the device has entered in region for the Estimote. }; - _beaconManager.ExitedRegion += (sender, e) => { + _beaconManager.BeaconExitedRegion += (sender, e) => { // Do something as the device has left the region for the Estimote. }; @@ -69,45 +70,45 @@ namespace Estimotes.Droid public class NearableActivity : Activity, BeaconManager.IServiceReadyCallback { BeaconManager beaconManager; - string scanId; - protected override void OnCreate(Bundle savedInstanceState) - { - base.OnCreate(savedInstanceState); - - // Create beacon manager - beaconManager = new BeaconManager(this); - - // Wearables will be triggered when nearables are found - beaconManager.Nearable += (sender, e) => - { - ActionBar.Subtitle = string.Format("Found {0} nearables.", e.Nearables.Count; - }; - - //Connect to beacon manager to start scanning - beaconManager.Connect(this); - } - - protected override void OnStop() - { - base.OnStop(); - if (!isScanning) - return; - - isScanning = false; - beaconManager.StopNearableDiscovery(scanId); - } - - public void OnServiceReady() - { - isScanning = true; - scanId = beaconManager.StartNearableDiscovery(); - } - - protected override void OnDestroy() - { - base.OnDestroy(); - beaconManager.Disconnect(); - } + string scanId; + protected override void OnCreate (Bundle savedInstanceState) + { + base.OnCreate (savedInstanceState); + + // Create beacon manager + beaconManager = new BeaconManager (this); + + // Wearables will be triggered when nearables are found + beaconManager.Nearable += (sender, e) => + { + ActionBar.Subtitle = string.Format ("Found {0} nearables.", e.Nearables.Count); + }; + + //Connect to beacon manager to start scanning + beaconManager.Connect (this); + } + + protected override void OnStop () + { + base.OnStop (); + if (!isScanning) + return; + + isScanning = false; + beaconManager.StopNearableDiscovery (); + } + + public void OnServiceReady () + { + isScanning = true; + beaconManager.StartNearableDiscovery (); + } + + protected override void OnDestroy () + { + base.OnDestroy (); + beaconManager.Disconnect (); + } } ``` @@ -116,6 +117,7 @@ public class NearableActivity : Activity, BeaconManager.IServiceReadyCallback [Eddystone](https://developers.google.com/beacons) is an open protocol BLE protocol from Google. Estimote Beacons can broadcast the Eddystone packet. With Estimote SDK you can: + - find nearby Eddystone beacons - configure Eddystone ralated properties: - URL property of `Eddystone-URL` @@ -132,45 +134,45 @@ Following code snippet shows you how you can start discovering nearby Estimote b public class NearableActivity : Activity, BeaconManager.IServiceReadyCallback { BeaconManager beaconManager; - string scanId; - protected override void OnCreate(Bundle savedInstanceState) - { - base.OnCreate(savedInstanceState); - - // Create beacon manager - beaconManager = new BeaconManager(this); - - // Wearables will be triggered when nearables are found - beaconManager.Eddystone += (sender, e) => - { - ActionBar.Subtitle = string.Format("Found {0} eddystones.", e.Eddystones.Count; - }; - - //Connect to beacon manager to start scanning - beaconManager.Connect(this); - } - - protected override void OnStop() - { - base.OnStop(); - if (!isScanning) - return; - - isScanning = false; - beaconManager.StopEddystoneScanning(scanId); - } - - public void OnServiceReady() - { - isScanning = true; - scanId = beaconManager.StartEddystoneScanning(); - } - - protected override void OnDestroy() - { - base.OnDestroy(); - beaconManager.Disconnect(); - } + string scanId; + protected override void OnCreate (Bundle savedInstanceState) + { + base.OnCreate (savedInstanceState); + + // Create beacon manager + beaconManager = new BeaconManager (this); + + // Wearables will be triggered when nearables are found + beaconManager.Eddystone += (sender, e) => + { + ActionBar.Subtitle = string.Format ("Found {0} eddystones.", e.Eddystones.Count); + }; + + //Connect to beacon manager to start scanning + beaconManager.Connect (this); + } + bool isScanning = false; + protected override void OnStop () + { + base.OnStop (); + if (!isScanning) + return; + + isScanning = false; + beaconManager.StopEddystoneScanning (); + } + + public void OnServiceReady () + { + isScanning = true; + beaconManager.StartEddystoneScanning (); + } + + protected override void OnDestroy () + { + base.OnDestroy (); + beaconManager.Disconnect (); + } } ``` diff --git a/XPlat/Estimote/Android/component/License.md b/XPlat/Estimote/Android/component/License.md deleted file mode 100644 index 7578925e89..0000000000 --- a/XPlat/Estimote/Android/component/License.md +++ /dev/null @@ -1,17 +0,0 @@ -**Xamarin is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may require or install dependencies which are governed by additional licenses.** - -Note: This component depends on [Estimote SDK for Android](https://github.com/Estimote/Android-SDK), which is subject to the [Estimote SDK for Android License](https://github.com/Estimote/Android-SDK/blob/master/LICENSE) - -### Xamarin Component for Estimote SDK for Xamarin.Android - -**The MIT License (MIT)** - -Copyright (c) .NET Foundation Contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -20160704 \ No newline at end of file diff --git a/XPlat/Estimote/Android/component/component.yaml b/XPlat/Estimote/Android/component/component.yaml index 9745ee151c..41f64e09ad 100644 --- a/XPlat/Estimote/Android/component/component.yaml +++ b/XPlat/Estimote/Android/component/component.yaml @@ -3,7 +3,7 @@ name: Estimote SDK for Android id: estimotesdkandroid publisher: "Xamarin Inc." -license: License.md +license: ../License.md icons: - icons/estimotesdk_128x128.png - icons/estimotesdk_512x512.png @@ -11,13 +11,13 @@ publisher-url: "https://www.xamarin.com" summary: "Estimote SDK for Xamarin.Android to actively scan for Bluetooth Beacons, Nearables, and Eddystones." details: Details.md getting-started: "GettingStarted.md" -version: "0.11.0.1" +version: "1.0.3" is-shell: true libraries: android: ../output/Xamarin.Estimote.Android.dll packages: android: - - Xamarin.Estimote.Android, Version=0.11.0.1 + - Xamarin.Estimote.Android, Version=1.0.3 src-url: "https://www.xamarin.com" samples: - name: "Estimote Sample" @@ -31,4 +31,7 @@ samples: packages: - Xamarin.Estimote.Android local-nuget-repo: ../output +additional-files: + - source: "../External-Dependency-Info.txt" + destination: "THIRD-PARTY-NOTICES.txt" no_build: true diff --git a/XPlat/Estimote/Android/nuget/Xamarin.Estimote.Android.nuspec b/XPlat/Estimote/Android/nuget/Xamarin.Estimote.Android.nuspec index c99528b408..2014cbe029 100644 --- a/XPlat/Estimote/Android/nuget/Xamarin.Estimote.Android.nuspec +++ b/XPlat/Estimote/Android/nuget/Xamarin.Estimote.Android.nuspec @@ -6,15 +6,16 @@ Estimote SDK for Xamarin.Android Xamarin Xamarin - https://github.com/xamarin/XamarinComponents/blob/master/XPlat/Estimote/Android/component/License.md + https://github.com/xamarin/XamarinComponents/blob/master/XPlat/Estimote/Android/License.md false Estimote SDK for Xamarin.Android to actively scan for Bluetooth Beacons, Nearables, and Eddystones. Copyright 2016 Xamarin en-US - https://xamarin-component-icons.s3.amazonaws.com/Xamarin.Estimote.png + https://github.com/xamarin/XamarinComponents/raw/master/XPlat/Estimote/Android/component/icons/estimotesdk_128x128.png Xamarin Xamarin.Android Estimote - + + diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/ActivityHelpers.cs b/XPlat/Estimote/Android/samples/EstimoteSample/ActivityHelpers.cs index 05f5749afd..9bc35242cf 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/ActivityHelpers.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/ActivityHelpers.cs @@ -4,8 +4,9 @@ using Android.Content; using Android.Widget; -using EstimoteSdk; - +using EstimoteSdk.Observation; +using EstimoteSdk.Observation.Region.Beacon; +using EstimoteSdk.Recognition.Packets; using JavaInteger = Java.Lang.Integer; namespace Estimotes.Droid @@ -34,18 +35,18 @@ public static void StartActivityForBeacon(this Activity activity, Bea activity.StartActivity(intent); } - public static Region CreateRegion(this Beacon beacon) + public static BeaconRegion CreateRegion(this Beacon beacon) { - Region region = new Region("region_id", beacon.ProximityUUID, new JavaInteger(beacon.Major), new JavaInteger(beacon.Minor)); + BeaconRegion region = new BeaconRegion("region_id", beacon.ProximityUUID, new JavaInteger(beacon.Major), new JavaInteger(beacon.Minor)); return region; } - public static Tuple GetBeaconAndRegion(this Activity activity) + public static Tuple GetBeaconAndRegion(this Activity activity) { Beacon beacon = GetBeacon(activity); - Region region = beacon.CreateRegion(); + BeaconRegion region = beacon.CreateRegion(); - return new Tuple(beacon, region); + return new Tuple(beacon, region); } } } diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFinder.cs b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFinder.cs index 29fab5f7f5..28aefb0e6b 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFinder.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFinder.cs @@ -2,9 +2,8 @@ using Android.Content; using Android.Util; - -using EstimoteSdk; - +using EstimoteSdk.Common.Requirements; +using EstimoteSdk.Service; using JavaObject = Java.Lang.Object; namespace Estimotes.Droid diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFoundEventArgs.cs b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFoundEventArgs.cs index 5f61077376..bf35ba2acf 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFoundEventArgs.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconFoundEventArgs.cs @@ -1,6 +1,6 @@ using System; -using EstimoteSdk; +using EstimoteSdk.Recognition.Packets; namespace Estimotes.Droid { diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconsFoundEventArgs.cs b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconsFoundEventArgs.cs index 697a86815f..4d37776458 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/BeaconsFoundEventArgs.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/BeaconsFoundEventArgs.cs @@ -3,6 +3,7 @@ using System.Linq; using EstimoteSdk; +using EstimoteSdk.Recognition.Packets; namespace Estimotes.Droid { diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/DeviceItemViewHolder.cs b/XPlat/Estimote/Android/samples/EstimoteSample/DeviceItemViewHolder.cs index f1f21bed37..db8f5b840a 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/DeviceItemViewHolder.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/DeviceItemViewHolder.cs @@ -2,7 +2,8 @@ using Android.Widget; using EstimoteSdk; - +using EstimoteSdk.Observation.Region; +using EstimoteSdk.Recognition.Packets; using Java.Lang; namespace Estimotes.Droid @@ -26,7 +27,7 @@ public DeviceItemViewHolder(View view) public void Display(Beacon beacon) { - _macTextView.Text = string.Format("MAC: {0} ({1:N2})", beacon.MacAddress, Utils.ComputeAccuracy(beacon)); + _macTextView.Text = string.Format("MAC: {0} ({1:N2})", beacon.MacAddress, RegionUtils.ComputeAccuracy(beacon)); _majorTextView.Text = string.Format("Major: {0}", beacon.Major); _minorTextView.Text = string.Format("Minor: {0}", beacon.Minor); _measuredPowerTextView.Text = string.Format("MPower: {0}", beacon.MeasuredPower); diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/DistanceBeaconActivity.cs b/XPlat/Estimote/Android/samples/EstimoteSample/DistanceBeaconActivity.cs index eb94d03bd3..935d9b65da 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/DistanceBeaconActivity.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/DistanceBeaconActivity.cs @@ -6,6 +6,9 @@ using Android.Views; using EstimoteSdk; +using EstimoteSdk.Observation.Region; +using EstimoteSdk.Observation.Region.Beacon; +using EstimoteSdk.Recognition.Packets; namespace Estimotes.Droid { @@ -18,7 +21,7 @@ public class DistanceBeaconActivity : Activity, ViewTreeObserver.IOnGlobalLayout Beacon _beacon; View _dotView; FindSpecificBeacon _findBeacon; - Region _region; + BeaconRegion _region; int _segmentLength = -1; View _sonar; int _startY = -1; @@ -59,7 +62,7 @@ protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); - Tuple stuff = this.GetBeaconAndRegion(); + Tuple stuff = this.GetBeaconAndRegion(); _beacon = stuff.Item1; _region = stuff.Item2; @@ -84,7 +87,7 @@ protected override void OnCreate(Bundle bundle) float ComputeDotPosY(Beacon foundBeacon) { // Put the dot at the end of the scale when it's further than 6m. - double x = Utils.ComputeAccuracy(foundBeacon); + double x = RegionUtils.ComputeAccuracy(foundBeacon); Log.Debug(Tag, "Beacon is approx. {0:N1} metres away", x); double distance = Math.Min(x, 6.0); return _startY + (int)(_segmentLength * (distance / 6.0)); diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/EddystoneActivity.cs b/XPlat/Estimote/Android/samples/EstimoteSample/EddystoneActivity.cs index 292f3f2c3e..46ddb6f6bf 100644 --- a/XPlat/Estimote/Android/samples/EstimoteSample/EddystoneActivity.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/EddystoneActivity.cs @@ -11,6 +11,8 @@ using Android.Views; using Android.Widget; using EstimoteSdk; +using EstimoteSdk.Observation.Region; +using EstimoteSdk.Service; namespace Estimotes.Droid { @@ -32,7 +34,7 @@ protected override void OnCreate(Bundle savedInstanceState) RunOnUiThread(()=> { - var items = e.Eddystones.Select(n => "Url: " + n.Url + "Proximity: " + Utils.ComputeProximity(n)); + var items = e.Eddystones.Select(n => "Url: " + n.Url + "Proximity: " + RegionUtils.ComputeProximity(n)); ListAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, @@ -57,7 +59,7 @@ private void Stop() isScanning = false; - beaconManager.StopEddystoneScanning(scanId); + beaconManager.StopEddystoneScanning(); refreshItem.SetActionView(null); refreshItem.SetIcon(Resource.Drawable.ic_refresh); } @@ -95,7 +97,6 @@ public override bool OnOptionsItemSelected(IMenuItem item) } - string scanId; bool isScanning; private void LookForEddystones() { @@ -111,7 +112,7 @@ private void LookForEddystones() public void OnServiceReady() { - scanId = beaconManager.StartEddystoneScanning(); + beaconManager.StartEddystoneScanning(); } protected override void OnDestroy() diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/EstimoteSample.csproj b/XPlat/Estimote/Android/samples/EstimoteSample/EstimoteSample.csproj index 1ff7c7b3e4..d1db5c8973 100644 --- a/XPlat/Estimote/Android/samples/EstimoteSample/EstimoteSample.csproj +++ b/XPlat/Estimote/Android/samples/EstimoteSample/EstimoteSample.csproj @@ -18,6 +18,8 @@ .\ true armeabi;armeabi-v7a;x86;arm64-v8a;x86_64 + true + 512M true diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/FindAllBeacons.cs b/XPlat/Estimote/Android/samples/EstimoteSample/FindAllBeacons.cs index 3a66fdde96..17bbdf8b67 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/FindAllBeacons.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/FindAllBeacons.cs @@ -6,12 +6,14 @@ using Android.Util; using EstimoteSdk; +using EstimoteSdk.Observation.Region.Beacon; +using EstimoteSdk.Service; namespace Estimotes.Droid { class FindAllBeacons : BeaconFinder { - public static readonly Region ALL_ESTIMOTE_BEACONS_REGION = new Region("rid", "B9407F30-F5F8-466E-AFF9-25556B57FE6D"); + public static readonly BeaconRegion ALL_ESTIMOTE_BEACONS_REGION = new BeaconRegion("rid", "B9407F30-F5F8-466E-AFF9-25556B57FE6D"); static readonly string TAG = typeof(FindAllBeacons).Name; @@ -19,7 +21,7 @@ class FindAllBeacons : BeaconFinder public FindAllBeacons(Context context) : base(context) { - BeaconManager.Ranging += HandleRanging; + BeaconManager.BeaconRanging += HandleRanging; } public override void OnServiceReady() @@ -27,7 +29,7 @@ public override void OnServiceReady() BeaconManager.StartRanging(ALL_ESTIMOTE_BEACONS_REGION); } - protected virtual void HandleRanging(object sender, BeaconManager.RangingEventArgs e) + protected virtual void HandleRanging(object sender, BeaconManager.BeaconRangingEventArgs e) { Log.Debug(TAG, "Found {0} beacons.", e.Beacons.Count); // IEnumerable beacons = from item in e.Beacons diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/FindSpecificBeacon.cs b/XPlat/Estimote/Android/samples/EstimoteSample/FindSpecificBeacon.cs index 93d2d5076e..be73d016e6 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/FindSpecificBeacon.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/FindSpecificBeacon.cs @@ -8,25 +8,27 @@ using Android.Widget; using EstimoteSdk; - +using EstimoteSdk.Observation.Region.Beacon; +using EstimoteSdk.Recognition.Packets; +using EstimoteSdk.Service; using JavaObject = Java.Lang.Object; namespace Estimotes.Droid { - class FindSpecificBeacon : BeaconFinder, BeaconManager.IRangingListener + class FindSpecificBeacon : BeaconFinder, BeaconManager.IBeaconRangingListener { static readonly string Tag = typeof(FindSpecificBeacon).FullName; Beacon _beacon; bool _isSearching; - Region _region; + BeaconRegion _region; public EventHandler BeaconFound = delegate { }; public FindSpecificBeacon(Context context) : base(context) { - BeaconManager.SetRangingListener(this); + BeaconManager.SetBeaconRangingListener(this); } - public void OnBeaconsDiscovered(Region region, IList beacons) + public void OnBeaconsDiscovered(BeaconRegion region, IList beacons) { Log.Debug(Tag, "Found {0} beacons", beacons.Count); Beacon foundBeacon = (from b in beacons @@ -58,7 +60,7 @@ public override void OnServiceReady() } } - public void LookForBeacon(Region region, Beacon beacon) + public void LookForBeacon(BeaconRegion region, Beacon beacon) { _beacon = beacon; _region = region; diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/LeDevicesListAdapter.cs b/XPlat/Estimote/Android/samples/EstimoteSample/LeDevicesListAdapter.cs index f49495c5a9..60fd1b2922 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/LeDevicesListAdapter.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/LeDevicesListAdapter.cs @@ -4,8 +4,7 @@ using Android.Views; using Android.Widget; -using EstimoteSdk; - +using EstimoteSdk.Recognition.Packets; using Java.Lang; namespace Estimotes.Droid diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/MainActivity.cs b/XPlat/Estimote/Android/samples/EstimoteSample/MainActivity.cs index af0095121e..7b09db2ef0 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/MainActivity.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/MainActivity.cs @@ -9,6 +9,7 @@ using Android.Widget; using EstimoteSdk; +using EstimoteSdk.Recognition.Packets; namespace Estimotes.Droid { diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/NearableActivity.cs b/XPlat/Estimote/Android/samples/EstimoteSample/NearableActivity.cs index 203e0dacf3..aa101e66c7 100644 --- a/XPlat/Estimote/Android/samples/EstimoteSample/NearableActivity.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/NearableActivity.cs @@ -12,6 +12,8 @@ using Android.Widget; using EstimoteSdk; using System.Linq; +using EstimoteSdk.Service; +using EstimoteSdk.Observation.Region; namespace Estimotes.Droid { @@ -33,7 +35,7 @@ protected override void OnCreate(Bundle savedInstanceState) RunOnUiThread(()=> { - var items = e.Nearables.Select(n => "Id: " + n.Identifier + "Proximity: " + Utils.ComputeProximity(n)); + var items = e.Nearables.Select(n => "Id: " + n.Identifier + "Proximity: " + RegionUtils.ComputeProximity(n)); ListAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, @@ -58,7 +60,7 @@ private void Stop() isScanning = false; - beaconManager.StopNearableDiscovery(scanId); + beaconManager.StopNearableDiscovery(); refreshItem.SetActionView(null); refreshItem.SetIcon(Resource.Drawable.ic_refresh); } @@ -96,7 +98,6 @@ public override bool OnOptionsItemSelected(IMenuItem item) } - string scanId; bool isScanning; private void LookForNearables() { @@ -112,7 +113,7 @@ private void LookForNearables() public void OnServiceReady() { - scanId = beaconManager.StartNearableDiscovery(); + beaconManager.StartNearableDiscovery(); } protected override void OnDestroy() diff --git a/XPlat/Estimote/Android/samples/EstimoteSample/NotifyDemoActivity.cs b/XPlat/Estimote/Android/samples/EstimoteSample/NotifyDemoActivity.cs index 07dbae7bb2..05ec4e4cab 100755 --- a/XPlat/Estimote/Android/samples/EstimoteSample/NotifyDemoActivity.cs +++ b/XPlat/Estimote/Android/samples/EstimoteSample/NotifyDemoActivity.cs @@ -4,8 +4,8 @@ using Android.Views; using Android.Widget; -using EstimoteSdk; - +using EstimoteSdk.Observation.Region.Beacon; +using EstimoteSdk.Service; using Java.Util.Concurrent; namespace Estimotes.Droid @@ -16,7 +16,7 @@ public class NotifyDemoActivity : Activity, BeaconManager.IServiceReadyCallback static readonly int NOTIFICATION_ID = 123321; BeaconManager _beaconManager; NotificationManager _notificationManager; - Region _region; + BeaconRegion _region; public void OnServiceReady() { @@ -38,8 +38,8 @@ protected override void OnCreate(Bundle bundle) // In order for this demo to be more responsive and immediate we lower down those values. _beaconManager.SetBackgroundScanPeriod(TimeUnit.Seconds.ToMillis(1), 0); - _beaconManager.EnteredRegion += (sender, e) => PostNotification("Entered region"); - _beaconManager.ExitedRegion += (sender, e) => PostNotification("Exited region"); + _beaconManager.BeaconEnteredRegion += (sender, e) => PostNotification("Entered region"); + _beaconManager.BeaconExitedRegion += (sender, e) => PostNotification("Exited region"); } public override bool OnOptionsItemSelected(IMenuItem item) diff --git a/XPlat/Estimote/Android/source/Additions/Fixups.cs b/XPlat/Estimote/Android/source/Additions/Fixups.cs new file mode 100644 index 0000000000..4470c48823 --- /dev/null +++ b/XPlat/Estimote/Android/source/Additions/Fixups.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using Android.Runtime; + +namespace EstimoteMgmtSdk.Feature.Settings.Mapping +{ + public partial class Version + { + int global::Java.Lang.IComparable.CompareTo (global::Java.Lang.Object another) + { + return CompareTo (another.JavaCast ()); + } + } +} + +namespace EstimoteSdk.Observation.Region.Beacon +{ + public partial class BeaconRegionRanger + { + static Delegate cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; +#pragma warning disable 0169 + static Delegate GetProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_Handler () + { + if (cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ == null) + cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ = JNINativeWrapper.CreateDelegate ((Action)n_ProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_); + return cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; + } + + static void n_ProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ (IntPtr jnienv, IntPtr native__this, IntPtr native_singleScan, IntPtr native_messenger) + { + global::EstimoteSdk.Observation.Region.Beacon.BeaconRegionRanger __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); + var singleScan = global::Android.Runtime.JavaList.FromJniHandle (native_singleScan, JniHandleOwnership.DoNotTransfer); + global::EstimoteSdk.Service.IBeaconServiceMessenger messenger = (global::EstimoteSdk.Service.IBeaconServiceMessenger)global::Java.Lang.Object.GetObject (native_messenger, JniHandleOwnership.DoNotTransfer); + __this.ProcessNewScanCycle (singleScan, messenger); + } +#pragma warning restore 0169 + + static IntPtr id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; + // Metadata.xml XPath method reference: path="/api/package[@name='com.estimote.coresdk.observation.region.beacon']/class[@name='BeaconRegionRanger']/method[@name='processNewScanCycle' and count(parameter)=2 and parameter[1][@type='java.util.List<com.estimote.coresdk.recognition.packets.Beacon>'] and parameter[2][@type='com.estimote.coresdk.service.BeaconServiceMessenger']]" + [Register ("processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V", "GetProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_Handler")] + public virtual unsafe void ProcessNewScanCycle (global::System.Collections.IList singleScan, global::EstimoteSdk.Service.IBeaconServiceMessenger messenger) + { + if (id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ == IntPtr.Zero) + id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ = JNIEnv.GetMethodID (class_ref, "processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V"); + IntPtr native_singleScan = global::Android.Runtime.JavaList.ToLocalJniHandle (singleScan); + try + { + JValue* __args = stackalloc JValue[2]; + __args[0] = new JValue (native_singleScan); + __args[1] = new JValue (messenger); + + if (((object)this).GetType () == ThresholdType) + JNIEnv.CallVoidMethod (((global::Java.Lang.Object)this).Handle, id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_, __args); + else + JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object)this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V"), __args); + } + finally + { + JNIEnv.DeleteLocalRef (native_singleScan); + } + } + } + + public partial class BeaconRegionMonitor + { + static Delegate cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_; +#pragma warning disable 0169 + static Delegate GetProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_Handler () + { + if (cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_ == null) + cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_ = JNINativeWrapper.CreateDelegate ((Action)n_ProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_); + return cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_; + } + + static void n_ProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_ (IntPtr jnienv, IntPtr native__this, IntPtr native_regionDecorator, IntPtr native_packets) + { + global::EstimoteSdk.Observation.Region.Beacon.BeaconRegionMonitor __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); + global::EstimoteSdk.Observation.Region.Beacon.BeaconRegionDecorator regionDecorator = global::Java.Lang.Object.GetObject (native_regionDecorator, JniHandleOwnership.DoNotTransfer); + var packets = global::Android.Runtime.JavaSet.FromJniHandle (native_packets, JniHandleOwnership.DoNotTransfer); + __this.ProcessFoundPacketsInRegion (regionDecorator, packets); + } +#pragma warning restore 0169 + + static IntPtr id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_; + // Metadata.xml XPath method reference: path="/api/package[@name='com.estimote.coresdk.observation.region.beacon']/class[@name='BeaconRegionMonitor']/method[@name='processFoundPacketsInRegion' and count(parameter)=2 and parameter[1][@type='com.estimote.coresdk.observation.region.beacon.BeaconRegionDecorator'] and parameter[2][@type='java.util.Set<com.estimote.coresdk.recognition.packets.Beacon>']]" + [Register ("processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/beacon/BeaconRegionDecorator;Ljava/util/Set;)V", "GetProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_Handler")] + protected override unsafe void ProcessFoundPacketsInRegion (global::Java.Lang.Object regionDecorator, global::System.Collections.ICollection packets) + { + if (id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_ == IntPtr.Zero) + id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_ = JNIEnv.GetMethodID (class_ref, "processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/beacon/BeaconRegionDecorator;Ljava/util/Set;)V"); + IntPtr native_packets = global::Android.Runtime.JavaSet.ToLocalJniHandle (packets); + try + { + JValue* __args = stackalloc JValue[2]; + __args[0] = new JValue (regionDecorator); + __args[1] = new JValue (native_packets); + + if (((object)this).GetType () == ThresholdType) + JNIEnv.CallVoidMethod (((global::Java.Lang.Object)this).Handle, id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_beacon_BeaconRegionDecorator_Ljava_util_Set_, __args); + else + JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object)this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/beacon/BeaconRegionDecorator;Ljava/util/Set;)V"), __args); + } + finally + { + JNIEnv.DeleteLocalRef (native_packets); + } + } + } +} + +namespace EstimoteSdk.Observation.Region.Mirror +{ + public partial class MirrorRegionRanger + { + static Delegate cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; +#pragma warning disable 0169 + static Delegate GetProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_Handler () + { + if (cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ == null) + cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ = JNINativeWrapper.CreateDelegate ((Action)n_ProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_); + return cb_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; + } + + static void n_ProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ (IntPtr jnienv, IntPtr native__this, IntPtr native_singleScan, IntPtr native_messenger) + { + global::EstimoteSdk.Observation.Region.Mirror.MirrorRegionRanger __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); + var singleScan = global::Android.Runtime.JavaList.FromJniHandle (native_singleScan, JniHandleOwnership.DoNotTransfer); + global::EstimoteSdk.Service.IBeaconServiceMessenger messenger = (global::EstimoteSdk.Service.IBeaconServiceMessenger)global::Java.Lang.Object.GetObject (native_messenger, JniHandleOwnership.DoNotTransfer); + __this.ProcessNewScanCycle (singleScan, messenger); + } +#pragma warning restore 0169 + + static IntPtr id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_; + // Metadata.xml XPath method reference: path="/api/package[@name='com.estimote.coresdk.observation.region.mirror']/class[@name='MirrorRegionRanger']/method[@name='processNewScanCycle' and count(parameter)=2 and parameter[1][@type='java.util.List<com.estimote.coresdk.recognition.packets.Mirror>'] and parameter[2][@type='com.estimote.coresdk.service.BeaconServiceMessenger']]" + [Register ("processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V", "GetProcessNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_Handler")] + public virtual unsafe void ProcessNewScanCycle (global::System.Collections.IList singleScan, global::EstimoteSdk.Service.IBeaconServiceMessenger messenger) + { + if (id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ == IntPtr.Zero) + id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_ = JNIEnv.GetMethodID (class_ref, "processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V"); + IntPtr native_singleScan = global::Android.Runtime.JavaList.ToLocalJniHandle (singleScan); + try + { + JValue* __args = stackalloc JValue[2]; + __args[0] = new JValue (native_singleScan); + __args[1] = new JValue (messenger); + + if (((object)this).GetType () == ThresholdType) + JNIEnv.CallVoidMethod (((global::Java.Lang.Object)this).Handle, id_processNewScanCycle_Ljava_util_List_Lcom_estimote_coresdk_service_BeaconServiceMessenger_, __args); + else + JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object)this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "processNewScanCycle", "(Ljava/util/List;Lcom/estimote/coresdk/service/BeaconServiceMessenger;)V"), __args); + } + finally + { + JNIEnv.DeleteLocalRef (native_singleScan); + } + } + } + + public partial class MirrorRegionMonitor + { + static Delegate cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_; +#pragma warning disable 0169 + static Delegate GetProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_Handler () + { + if (cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_ == null) + cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_ = JNINativeWrapper.CreateDelegate ((Action)n_ProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_); + return cb_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_; + } + + static void n_ProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_ (IntPtr jnienv, IntPtr native__this, IntPtr native_region, IntPtr native_packets) + { + global::EstimoteSdk.Observation.Region.Mirror.MirrorRegionMonitor __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); + global::EstimoteSdk.Observation.Region.Mirror.MirrorRegionDecorator region = global::Java.Lang.Object.GetObject (native_region, JniHandleOwnership.DoNotTransfer); + var packets = global::Android.Runtime.JavaSet.FromJniHandle (native_packets, JniHandleOwnership.DoNotTransfer); + __this.ProcessFoundPacketsInRegion (region, packets); + } +#pragma warning restore 0169 + + static IntPtr id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_; + // Metadata.xml XPath method reference: path="/api/package[@name='com.estimote.coresdk.observation.region.mirror']/class[@name='MirrorRegionMonitor']/method[@name='processFoundPacketsInRegion' and count(parameter)=2 and parameter[1][@type='com.estimote.coresdk.observation.region.mirror.MirrorRegionDecorator'] and parameter[2][@type='java.util.Set<com.estimote.coresdk.recognition.packets.Mirror>']]" + [Register ("processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/mirror/MirrorRegionDecorator;Ljava/util/Set;)V", "GetProcessFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_Handler")] + protected override unsafe void ProcessFoundPacketsInRegion (global::Java.Lang.Object region, global::System.Collections.ICollection packets) + { + if (id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_ == IntPtr.Zero) + id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_ = JNIEnv.GetMethodID (class_ref, "processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/mirror/MirrorRegionDecorator;Ljava/util/Set;)V"); + IntPtr native_packets = global::Android.Runtime.JavaSet.ToLocalJniHandle (packets); + try + { + JValue* __args = stackalloc JValue[2]; + __args[0] = new JValue (region); + __args[1] = new JValue (native_packets); + + if (((object)this).GetType () == ThresholdType) + JNIEnv.CallVoidMethod (((global::Java.Lang.Object)this).Handle, id_processFoundPacketsInRegion_Lcom_estimote_coresdk_observation_region_mirror_MirrorRegionDecorator_Ljava_util_Set_, __args); + else + JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object)this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "processFoundPacketsInRegion", "(Lcom/estimote/coresdk/observation/region/mirror/MirrorRegionDecorator;Ljava/util/Set;)V"), __args); + } + finally + { + JNIEnv.DeleteLocalRef (native_packets); + } + } + } +} \ No newline at end of file diff --git a/XPlat/Estimote/Android/source/Additions/Permissions.cs b/XPlat/Estimote/Android/source/Additions/Permissions.cs deleted file mode 100755 index 08c5fc57d6..0000000000 --- a/XPlat/Estimote/Android/source/Additions/Permissions.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Android; -using Android.App; - -[assembly: UsesPermission(Manifest.Permission.Bluetooth)] -[assembly: UsesPermission(Manifest.Permission.BluetoothAdmin)] -[assembly: UsesFeature("android.hardware.bluetooth_le", Required = false)] diff --git a/XPlat/Estimote/Android/source/Additions/Region.cs b/XPlat/Estimote/Android/source/Additions/Region.cs index f3f26df26d..6f3e82f080 100644 --- a/XPlat/Estimote/Android/source/Additions/Region.cs +++ b/XPlat/Estimote/Android/source/Additions/Region.cs @@ -1,24 +1,24 @@ using System; using Android.Runtime; -namespace EstimoteSdk +namespace EstimoteSdk.Observation.Region.Beacon { - public partial class Region + public partial class BeaconRegion { - public Region(string identifier, string proximityUUID) + public BeaconRegion(string identifier, string proximityUUID) : this(identifier, Java.Util.UUID.FromString (proximityUUID), null, null) { } - public Region(string identifier, string proximityUUID, int major) + public BeaconRegion(string identifier, string proximityUUID, int major) : this(identifier, Java.Util.UUID.FromString (proximityUUID), new Java.Lang.Integer(major), null) { } - public Region(string identifier, string proximityUUID, int major, int minor) + public BeaconRegion(string identifier, string proximityUUID, int major, int minor) : this(identifier, Java.Util.UUID.FromString (proximityUUID), new Java.Lang.Integer(major), new Java.Lang.Integer(minor)) { diff --git a/XPlat/Estimote/Android/source/Transforms/Metadata.xml b/XPlat/Estimote/Android/source/Transforms/Metadata.xml index a0ba4e6cff..087cf164be 100644 --- a/XPlat/Estimote/Android/source/Transforms/Metadata.xml +++ b/XPlat/Estimote/Android/source/Transforms/Metadata.xml @@ -1,60 +1,144 @@  - EstimoteSdk - EstimoteSdk.Cloud - EstimoteSdk.Cloud.Model - EstimoteSdk.Cloud.Model.Analytics - EstimoteSdk.Cloud.Model.Google - EstimoteSdk.Connection - EstimoteSdk.Connection.Errors - EstimoteSdk.Connection.Exceptions - EstimoteSdk.Connection.Scanner - EstimoteSdk.Connection.Settings - EstimoteSdk.EddystoneSdk - EstimoteSdk.Service - EstimoteSdk.Exception - EstimoteSdk.Location - EstimoteSdk.Telemetry - EstimoteSdk.Nfc - + EstimoteSdk + EstimoteSdk.Cloud.Api + EstimoteSdk.Cloud.Google + EstimoteSdk.Cloud.Google.Model + EstimoteSdk.Cloud.Model + EstimoteSdk.Common.Config + EstimoteSdk.Common.Exception + EstimoteSdk.Common.Requirements + EstimoteSdk.Connection.Bluerock + EstimoteSdk.Connection.Gatt + EstimoteSdk.Connection.Utils + EstimoteSdk.Observation.Region + EstimoteSdk.Observation.Region.Beacon + EstimoteSdk.Observation.Region.Mirror + EstimoteSdk.Observation.Utils + EstimoteSdk.Recognition.Packets + EstimoteSdk.Recognition.Utils + EstimoteSdk.Scanning.Bluetooth.Adapters + EstimoteSdk.Scanning.Bluetooth.Filters + EstimoteSdk.Scanning.Bluetooth.Settings + EstimoteSdk.Scanning.Module + EstimoteSdk.Scanning.Scheduling + EstimoteSdk.Service + EstimoteMgmtSdk + EstimoteMgmtSdk.Common.Errors + EstimoteMgmtSdk.Common.Exceptions + EstimoteMgmtSdk.Connection.Api + EstimoteMgmtSdk.Connection.Protocol + EstimoteMgmtSdk.Connection.Protocol.Characteristic + EstimoteMgmtSdk.Connection.Protocol.Nearables + EstimoteMgmtSdk.Connection.Protocol.Packet + EstimoteMgmtSdk.Connection.Strategy + EstimoteMgmtSdk.Connection.Strategy.Security + EstimoteMgmtSdk.Connection.Strategy.Sync + EstimoteMgmtSdk.Feature.Bulk_updater + EstimoteMgmtSdk.Feature.FU + EstimoteMgmtSdk.Feature.FU.Dfu + EstimoteMgmtSdk.Feature.FU.Ota + EstimoteMgmtSdk.Feature.Mesh + EstimoteMgmtSdk.Feature.Nfc + EstimoteMgmtSdk.Feature.Settings + EstimoteMgmtSdk.Feature.Settings.Api + EstimoteMgmtSdk.Feature.Settings.Mapping + - Estimote + Estimote - - - - - - - - - - _MinorInternal - protected - _MajorInternal - protected - - - BatteryLevelValue - FirmwareStateValue - OrientationValue - - - eddystones - errorId - region - beacons - - nearables - region - beacons - - Java.Lang.Object + + + + + + + + _MinorInternal + protected + _MajorInternal + protected + + + region + beacons + region + region + beacons + region + beacons + region + devices + eddystones + errorId + locations + mirrors + region + mirrors + nearables + telemetries + + + BeaconList + ObservationList + Response + + + public + public + + + BeaconEnteredRegion + BeaconExitedRegion + + MirrorEnteredRegion + MirrorExitedRegion + + BeaconEnteredRegionEventArgs + BeaconExitedRegionEventArgs - - BeaconList - ObservationList + MirrorEnteredRegionEventArgs + MirrorExitedRegionEventArgs + + SetBeaconMonitoringListener + SetMirrorMonitoringListener + SetBeaconRangingListener + SetMirrorRangingListener + + + Java.Lang.Object + Java.Lang.Object + Java.Lang.Object + + Java.Lang.Object + Java.Lang.Object + Java.Lang.Object + + + + + + + diff --git a/XPlat/Estimote/Android/source/Xamarin.Estimote.Android.csproj b/XPlat/Estimote/Android/source/Xamarin.Estimote.Android.csproj index 10d69ae25d..c0c7ede47e 100644 --- a/XPlat/Estimote/Android/source/Xamarin.Estimote.Android.csproj +++ b/XPlat/Estimote/Android/source/Xamarin.Estimote.Android.csproj @@ -10,7 +10,8 @@ Resources Assets Xamarin.Estimote.Android - v4.3 + v5.0 + class-parse true @@ -32,9 +33,6 @@ false false - - ..\..\externals\javadocs - Jars\estimotes.aar @@ -48,8 +46,8 @@ - + @@ -58,7 +56,6 @@ -