Skip to content

Update alt beacon library to 2.16.1 #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ ComponentStore/
lib/

*.DS_Store
*.droidres.db
*.droidres.db
/AndroidAltBeaconLibrary/.vs
/AndroidAltBeaconLibrary/.mfractor
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<AndroidResgenClass>Resource</AndroidResgenClass>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class BeaconTest : TestBase
[SetUp]
public void BeforeEachTest()
{
Beacon.SetHardwareEqualityEnforced(false);
Beacon.HardwareEqualityEnforced = false;
}

[Test]
Expand Down Expand Up @@ -76,7 +76,7 @@ public void TestBeaconsWithDifferentId3AreNotEqual() {

[Test]
public void TestBeaconsWithSameMacsAreEqual() {
Beacon.SetHardwareEqualityEnforced(true);
Beacon.HardwareEqualityEnforced = true;
Beacon beacon1 = new AltBeacon.Builder().SetMfgReserved(7).SetId1("1").SetId2("2").SetId3("3").SetRssi(4)
.SetBeaconTypeCode(5).SetTxPower(6)
.SetBluetoothAddress("1:2:3:4:5:6").Build();
Expand All @@ -88,7 +88,7 @@ public void TestBeaconsWithSameMacsAreEqual() {

[Test]
public void TestBeaconsWithDifferentMacsAreNotEqual() {
Beacon.SetHardwareEqualityEnforced(true);
Beacon.HardwareEqualityEnforced = true;
Beacon beacon1 = new AltBeacon.Builder().SetMfgReserved(7).SetId1("1").SetId2("2").SetId3("3").SetRssi(4)
.SetBeaconTypeCode(5).SetTxPower(6)
.SetBluetoothAddress("1:2:3:4:5:6").Build();
Expand Down Expand Up @@ -131,7 +131,7 @@ public void TestCalculateAccuracyWithRssiEqualsPowerOnInternalProperties() {
[Test]
public void TestCalculateAccuracyWithRssiEqualsPowerOnInternalPropertiesAndRunningAverage() {
var beacon = new Beacon.Builder().SetTxPower(-55).SetRssi(0).Build();
beacon.SetRunningAverageRssi(-55);
beacon.RunningAverageRssi = -55;
double distance = beacon.Distance;
AssertEx.AreEqual("Distance should be one meter if mRssi is the same as power", 1.0, distance, 0.1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public SBeacon(Parcel parcel) {

public String Id => Identifiers[1].ToString();

public override int DescribeContents()
public int DescribeContents()
{
return 0;
}

public override void WriteToParcel(Parcel @out, ParcelableWriteFlags flags)
public void WriteToParcel(Parcel @out, ParcelableWriteFlags flags)
{
// TODO: Implement me
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class BeaconServiceTest
{
[SetUp]
public void before() {
BeaconManager.SetsManifestCheckingDisabled(true);
BeaconManager.ManifestCheckingDisabled = true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RangingDataTest
{
[SetUp]
public void before() {
BeaconManager.SetsManifestCheckingDisabled(true);
BeaconManager.ManifestCheckingDisabled = true;
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ScanFilterUtilsTest
[Test]
public void testGetAltBeaconScanFilter() {
BeaconParser parser = new AltBeaconParser();
BeaconManager.SetsManifestCheckingDisabled(true); // no manifest available in robolectric
BeaconManager.ManifestCheckingDisabled = true; // no manifest available in robolectric
var scanFilterDatas = new ScanFilterUtils().CreateScanFilterDataForBeaconParser(parser);
AssertEx.AreEqual("scanFilters should be of correct size", 1, scanFilterDatas.Count);
ScanFilterUtils.ScanFilterData sfd = scanFilterDatas[0];
Expand All @@ -26,7 +26,7 @@ public void testGetAltBeaconScanFilter() {
public void testGenericScanFilter() {
BeaconParser parser = new BeaconParser();
parser.SetBeaconLayout("m:2-3=1111,i:4-6,p:24-24");
BeaconManager.SetsManifestCheckingDisabled(true); // no manifest available in robolectric
BeaconManager.ManifestCheckingDisabled = true; // no manifest available in robolectric
var scanFilterDatas = new ScanFilterUtils().CreateScanFilterDataForBeaconParser(parser);
AssertEx.AreEqual("scanFilters should be of correct size", 1, scanFilterDatas.Count);
ScanFilterUtils.ScanFilterData sfd = scanFilterDatas[0];
Expand All @@ -40,7 +40,7 @@ public void testGenericScanFilter() {
public void testEddystoneScanFilterData() {
BeaconParser parser = new BeaconParser();
parser.SetBeaconLayout(BeaconParser.EddystoneUidLayout);
BeaconManager.SetsManifestCheckingDisabled(true); // no manifest available in robolectric
BeaconManager.ManifestCheckingDisabled = true; // no manifest available in robolectric
var scanFilterDatas = new ScanFilterUtils().CreateScanFilterDataForBeaconParser(parser);
AssertEx.AreEqual("scanFilters should be of correct size", 1, scanFilterDatas.Count);
ScanFilterUtils.ScanFilterData sfd = scanFilterDatas[0];
Expand All @@ -51,7 +51,7 @@ public void testEddystoneScanFilterData() {
public void testZeroOffsetScanFilter() {
BeaconParser parser = new BeaconParser();
parser.SetBeaconLayout("m:0-3=11223344,i:4-6,p:24-24");
BeaconManager.SetsManifestCheckingDisabled(true); // no manifest available in robolectric
BeaconManager.ManifestCheckingDisabled = true; // no manifest available in robolectric
var scanFilterDatas = new ScanFilterUtils().CreateScanFilterDataForBeaconParser(parser);
AssertEx.AreEqual("scanFilters should be of correct size", 1, scanFilterDatas.Count);
ScanFilterUtils.ScanFilterData sfd = scanFilterDatas[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -44,6 +43,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Identifier.cs" />
<Compile Include="ModelSpecificInstanceUpdater.cs" />
<Compile Include="Beacon.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Additions\AboutAdditions.txt" />
Expand All @@ -55,7 +55,7 @@
<TransformFile Include="Transforms\Metadata.xml" />
</ItemGroup>
<ItemGroup>
<LibraryProjectZip Include="Jars\android-beacon-library-2.10.aar" />
<LibraryProjectZip Include="Jars\android-beacon-library-2.16.1.aar" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
</Project>
</Project>
20 changes: 20 additions & 0 deletions AndroidAltBeaconLibrary/AndroidAltBeaconLibrary/Beacon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Android.Runtime;

namespace AltBeaconOrg.BoundBeacon
{
// Metadata.xml XPath class reference: path="/api/package[@name='org.altbeacon.beacon']/class[@name='Beacon']"
public partial class Beacon
{
public int DescribeContents()
{
return 0;
}

public void WriteToParcel(Android.OS.Parcel p, Android.OS.ParcelableWriteFlags f)
{

}
}
}

Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Android AltBeacon Library ![](https://ci.appveyor.com/api/projects/status/gpeioj

A Xamarin.Android binding of the [AltBeacon Android Beacon Library](https://github.com/AltBeacon/android-beacon-library). This library allows Android apps to interact with BLE beacons in accordance with the open and interoperable [AltBeacon proximity beacon protocol specification](https://github.com/AltBeacon/spec).

Note: This library uses the Java library version 2.15, and is Android Oreo (8.x) compatible!

## Use

- [Nuget Package](https://www.nuget.org/packages/AndroidAltBeaconLibrary/)
Expand All @@ -19,6 +21,8 @@ The [Android AltBeacon Library](http://components.xamarin.com/view/android-altbe

## Changes

[current version] - Using java library 2.15: Android Oreo compatible!

_v2.10.0 - [Work in Progress](https://github.com/chrisriesgo/Android-AltBeacon-Library/issues/25)_

[v2.7](https://github.com/chrisriesgo/Android-AltBeacon-Library/releases/tag/2.7)
Expand Down