Skip to content

Commit

Permalink
examples: add XBee IoT Tank Monitoring sample application
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Moral <[email protected]>
  • Loading branch information
rubenmoral committed Sep 30, 2021
1 parent dccb921 commit 6d1166e
Show file tree
Hide file tree
Showing 79 changed files with 26,554 additions and 0 deletions.
96 changes: 96 additions & 0 deletions XBeeLibrary.sln
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgricultureDemo.Android", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgricultureDemo.iOS", "examples\xamarin\AgricultureDemo\AgricultureDemo.iOS\AgricultureDemo.iOS.csproj", "{0A24A683-9395-4C6D-83CD-16FDDAA948A8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TankDemo", "TankDemo", "{6C577AC1-8C7F-4D46-9BC2-63A9E87A334D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TankDemo", "examples\xamarin\TankDemo\TankDemo\TankDemo.csproj", "{9EB16A70-3094-436C-AFFF-8D81046F3065}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TankDemo.Android", "examples\xamarin\TankDemo\TankDemo.Android\TankDemo.Android.csproj", "{A48E4CE7-DA61-429A-A154-9271A5910FCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TankDemo.iOS", "examples\xamarin\TankDemo\TankDemo.iOS\TankDemo.iOS.csproj", "{0A24A684-9395-4C6D-83CD-16FDDAA948A8}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
examples\xamarin\BleMicrocontrollerSample\BleMicrocontrollerSample\BleMicrocontrollerSample.projitems*{02867b8d-7e36-4952-abdf-c6f060f17840}*SharedItemsImports = 4
Expand Down Expand Up @@ -456,6 +464,90 @@ Global
{0A24A683-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhone.Deploy.0 = Release|iPhone
{0A24A683-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0A24A683-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|iPhone.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|iPhone.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|Any CPU.Build.0 = Release|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|iPhone.ActiveCfg = Release|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|iPhone.Build.0 = Release|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{9EB16A70-3094-436C-AFFF-8D81046F3065}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|Any CPU.Deploy.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|Any CPU.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|Any CPU.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhone.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhone.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhone.Build.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|Any CPU.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|Any CPU.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhone.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhone.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhone.Deploy.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A48E4CE7-DA61-429A-A154-9271A5910FCC}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|Any CPU.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|Any CPU.Build.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|Any CPU.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|Any CPU.Build.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|iPhone.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|iPhone.Build.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.AppStore|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|Any CPU.ActiveCfg = Debug|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|iPhone.ActiveCfg = Debug|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|iPhone.Build.0 = Debug|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|iPhone.Deploy.0 = Debug|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|Any CPU.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhone.ActiveCfg = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhone.Build.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhone.Deploy.0 = Release|iPhone
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0A24A684-9395-4C6D-83CD-16FDDAA948A8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -482,6 +574,10 @@ Global
{FF632E32-38AB-487D-A776-E247B9C972CE} = {A9ECF39C-CA3F-43A5-B792-4D3E4447978A}
{A48E4CE6-DA61-429A-A154-9271A5910FCC} = {A9ECF39C-CA3F-43A5-B792-4D3E4447978A}
{0A24A683-9395-4C6D-83CD-16FDDAA948A8} = {A9ECF39C-CA3F-43A5-B792-4D3E4447978A}
{6C577AC1-8C7F-4D46-9BC2-63A9E87A334D} = {35778E6E-3CAF-4613-B4F6-FA207832E55D}
{9EB16A70-3094-436C-AFFF-8D81046F3065} = {6C577AC1-8C7F-4D46-9BC2-63A9E87A334D}
{A48E4CE7-DA61-429A-A154-9271A5910FCC} = {6C577AC1-8C7F-4D46-9BC2-63A9E87A334D}
{0A24A684-9395-4C6D-83CD-16FDDAA948A8} = {6C577AC1-8C7F-4D46-9BC2-63A9E87A334D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {93045932-780D-4431-B805-9947A5C296FA}
Expand Down
73 changes: 73 additions & 0 deletions examples/xamarin/TankDemo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
XBee IoT Tank Monitoring Demo Application
=========================================

This example is part of the Digi XBee IoT Tank Monitoring demo. It
demonstrates how to use XBee 3 Cellular modules to exchange data, communicate
with Digi Remote Manager and use the BLE interface to talk to mobile apps
applied to the tank monitoring vertical.

This application is used to make the initial provisioning of the different
smart tanks of the installation (XBee 3 Cellular modules).

Read the demo documentation for more information:
https://www.digi.com/resources/documentation/digidocs/90002422/.

Demo requirements
-----------------

To run this example you need:

* At least one XBee 3 Cellular module with MicroPython support running the
corresponding MicroPython application of the demo and its corresponding
carrier board (XBIB-C board).
* A smartphone (Android or iOS) with access to the Internet.
* A Digi Remote Manager account. Go to https://myaccount.digi.com/ to create it
if you do not have one.

Demo setup
----------

Make sure the hardware is set up correctly:

1. The mobile device is powered on.
2. The XBee 3 Cellular modules are properly set up and running their
corresponding MicroPython application.

Demo run
--------

The example is already configured, so all you need to do is to build and launch
the project.

The first page of the application lists the available smart tank devices near
to you. Before starting the provisioning, make sure you configure your Digi
Remote Manager credentials from the menu.

To provision a device, tap on it on the list and enter its default Bluetooth
password. If the connection is successful, the Provisioning page appears. Enter
the required information about the device you want to provisioning and tap
**Provision device**.


Compatible with
---------------

* Android devices
* iOS devices

License
-------

Copyright 2021, Digi International Inc.

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, you can obtain one at http://mozilla.org/MPL/2.0/.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 changes: 19 additions & 0 deletions examples/xamarin/TankDemo/TankDemo.Android/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
164 changes: 164 additions & 0 deletions examples/xamarin/TankDemo/TankDemo.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/*
* Copyright 2021, Digi International Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

using Acr.UserDialogs;
using Android;
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Rg.Plugins.Popup;
using System.Collections;
using System.Linq;
using Xamarin.Forms;

namespace TankDemo.Droid
{
[Activity(Label = "Digi XBee Tank", Icon = "@drawable/digi_icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
// Constants.
private readonly int REQUEST_BLUETOOTH_ID = 0;
private readonly string[] PERMISSIONS_BLUETOOTH =
{
Manifest.Permission.AccessCoarseLocation,
Manifest.Permission.AccessFineLocation,
Manifest.Permission.Bluetooth,
Manifest.Permission.BluetoothAdmin
};

private readonly string ERROR_BLE_PERMISSIONS = "Bluetooth permissions are required in order to scan and connect to Bluetooth devices.";

protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(savedInstanceState);

Xamarin.Essentials.Platform.Init(this, savedInstanceState);
UserDialogs.Init(this);
Popup.Init(this, savedInstanceState);

CheckPermissions();

global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Xamarin.FormsMaps.Init(this, savedInstanceState);
LoadApplication(new App());
}

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

if (requestCode != REQUEST_BLUETOOTH_ID)
return;

// Check if user declined any Bluetooth permission.
bool anyPermissionDenied = false;
foreach (var result in grantResults)
{
if (result == Permission.Denied)
{
anyPermissionDenied = true;
break;
}
}
// Display a message indicating that bluetooth permissions must be enabled.
if (anyPermissionDenied)
Toast.MakeText(this, ERROR_BLE_PERMISSIONS, ToastLength.Long).Show();

base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}

public override bool OnOptionsItemSelected(IMenuItem item)
{
// check if the current item id
// is equals to the back button id
if (item.ItemId == 16908332)
{
// retrieve the current xamarin forms page instance
Page currentPage = Xamarin.Forms.Application.Current.MainPage.Navigation.NavigationStack.LastOrDefault();
if (currentPage is CustomContentPage)
{
// check if the page has subscribed to
// the custom back button event
if (((CustomContentPage)currentPage)?.CustomBackButtonAction != null)
{
((CustomContentPage)currentPage)?.CustomBackButtonAction.Invoke();
// and disable the default back button action
return false;
}
}

// if its not subscribed then go ahead
// with the default back button action
return base.OnOptionsItemSelected(item);
}
else
{
// since its not the back button
//click, pass the event to the base
return base.OnOptionsItemSelected(item);
}
}

public override void OnBackPressed()
{
// retrieve the current xamarin forms page instance
Page currentPage = Xamarin.Forms.Application.Current.MainPage.Navigation.NavigationStack.LastOrDefault();
if (currentPage is CustomContentPage)
{
// check if the page has subscribed to
// the custom back button event
if (((CustomContentPage)currentPage)?.CustomBackButtonAction != null)
{
((CustomContentPage)currentPage)?.CustomBackButtonAction.Invoke();
}
else
{
base.OnBackPressed();
}
}
else
{
base.OnBackPressed();
}
}

/// <summary>
/// Checks if the minimum permissions required to execute the
/// application are granted. If not, requests them.
/// </summary>
private void CheckPermissions()
{
if ((int)Build.VERSION.SdkInt < 23)
return;

var permissionsToRequest = new ArrayList();
foreach (string permission in PERMISSIONS_BLUETOOTH)
{
if (CheckSelfPermission(permission) != Permission.Granted)
permissionsToRequest.Add(permission);
}
// If the minimum permissions are not granted, request them to the user.
if (permissionsToRequest.Count > 0)
RequestPermissions(permissionsToRequest.ToArray(typeof(string)) as string[], REQUEST_BLUETOOTH_ID);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="2" android:versionName="1.0.0" package="com.digi.xbee.sample.xamarin.tank" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<application android:label="Digi XBee Tank" android:theme="@style/MainTheme" android:icon="@drawable/digi_icon">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyDbQlHHVE1-wZxmfeDw_eA_v3jtTSIjGME" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
</manifest>
Loading

0 comments on commit 6d1166e

Please sign in to comment.