Skip to content

Android app DEMO project based on Sensoro™ Beacons and Azure IoT Hub

License

Notifications You must be signed in to change notification settings

GianlucaCapozzi/Easy2Park

Repository files navigation

Easy2Park

Description

This is an Android app DEMO project based on Sensoro™ Beacons (https://www.sensoro.com) and Azure Iot Hub (https://azure.microsoft.com/en-us/services/iot-hub/). The idea is to make it easier to find free parking lots. This is done through bluetooth connectivity to Sensoro beacons and Azure cloud computing.


Schema

Installation

App has been developed on android studio and tested on Android 9.0, other versions are not supported.

  1. Import the Easy2ParkApp folder as a project into Android studio.
  2. In Constant.java class, replace SENSORO_DEVICEs Strings with the SN codes of your Sensoro devices.
//Constant.java
package com.example.easy2park;

public class Constant {
    public static final String BLE_STATE_CHANGED_ACTION = "android.bluetooth.adapter.action.STATE_CHANGED";
    public static final String SENSORO_DEVICE1="0117C59B4EC7";
    public static final String SENSORO_DEVICE2="0117C582CAD7";
    public static final String SENSORO_DEVICE3="0117C5578442";
}
  1. You need to continue with following procedure to register you to Azure.

First step: register your device on azure iot hub platform

  1. Download azure cloud shell, after you need to login to azure from command line:
az login
  1. Register your device on the azure iot hub platform

In order to register your device on the azure iot hub platform, you need to perform the following two commands from the azure cloud shell:

az extension add --name azure-cli-iot-ext
az iot hub device-identity create --hub-name YourIoTHubName --device-id MyAndroidDevice

where YourIoTHubName is the name of the device registered on the azure iot hub platform.

Second step: obtain the connection string for your device

az iot hub device-identity show-connection-string --hub-name YourIoTHubName --device-id MyAndroidDevice --output table

Third step: sent data to azure iot hub platform

  1. Put the connection string obtained at step 2 in the file gradle.properties
  2. Now you can run the app pressing the START button
  3. In order to check if data are sent to azure iot hub you can check this from the azure cloud shell with the following command:
az iot hub monitor-events --hub-name YourIoTHubName --output table

Run your android app

App has been developed on android studio and tested on Android 9.0, other versions are not supported.

  1. Make sure your Android device is connected to your computer via a USB cable.
  2. Connect the device to WiFi/UMTS network that allows for communication with the server.
  3. Make sure your device is set up for development as explained here (https://developer.android.com/training/basics/firstapp/running-app#RealDevice).
  4. Change USB mode to data transfer and allow the RSA fingerprint request of access if asked.
  5. Click on run button on Android Studio GUI and select your device.

Run on device

Alternatively you can use adb from shell (http://delphi.org/2013/11/installing-and-running-android-apps-from-command-line/)

N.B. You cannot run the app through android studio emulator (at the time of writing) due to the lack of bluetooth connection.

Usage

If you completed the installation part the app will open on your device.

  1. Turn on bluetooth and gps.
  2. Go into the range of your sensoro beacons.
    This will be displayed on your screen:

3. Click on Park here to start sending data to Azure

4. Click on Leave the parking to stop sending data to Azure

TODO

Features to be implemented:

  • Background proper functioning

Credits:

  • Giuseppe Capaldi

  • Gianluca Capozzi

  • Daniele Davoli

License:

Code is under Apache License 2.0.

About

Android app DEMO project based on Sensoro™ Beacons and Azure IoT Hub

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages