Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this tutorial, you will connect an Android device to WSO2 IoT Server and monitor the sensor data.

Info

WSO2 IoT Server supports devices on Android version 4.2.x to 7.0 (Android Jelly Beans to Nougat)

The following subsections explain how you can work with the Android Sense device type:

Table of Contents

Tip
titleBefore you begin

 Start the WSO2 IoT Server broker, core and, analytics profiles in the given order. For more information, see how to start the WSO2 IoT Server.

Panel
Code Block
cd <IOTS_HOME>/bin
 
------Linux/Mac OS/Solaris ----------
./broker.sh
./iot-server.sh
./analytics.sh
 
-----Windows-----------
broker.bat
iot-server.bat
analytics.bat

...

  1. Sign in to the Device Management console.

    Expand
    titleClick here for more information.
    Panel
    borderColor#6A98FA
    bgColor#ffffff
    borderWidth1
    Insert excerpt
    Accessing the WSO2 IoT Server Consoles
    Accessing the WSO2 IoT Server Consoles
    nopaneltrue
  2. Click Enroll New Device.

    Info

    If you are an Admin user, click the Image Modifiedmenu icon, and select select DEVICE MANAGEMENT, to access the the ENROLL DEVICE button.

  3. Click Android Sense to enroll a device of the type Android Sense.
  4. Enroll the device.

    Localtabgroup
    Localtab
    activetrue
    titleScan the QR code
    Panel
    borderColor#11375B
    bgColor#ffffff
    borderWidth2

     Scan the QR code using your device, and the Android Sense agent will download on to your device.

    Tip

    Prerequisite: If you click Scan QR code, you will need to have a QR scanner application on the device.

    Localtab
    titleDownload the APK
    Panel
    borderColor#11375B
    bgColor#ffffff
    borderWidth2
    1. Click Download APK.
    2. Copy the downloaded file to your mobile device.
    Localtab
    titleInvite by email
    Panel
    borderColor#11375B
    bgColor#ffffff
    borderWidth2
    Panel
    titlePrerequsite

    Configure the email settings to send out an invitation for users to register their device with WSO2 IoT Server.

    Expand
    titleClick here for more information on configuring the email settings.

    Include Page
    Configuring the Email Settings
    Configuring the Email Settings

    1. Click Invite by Email.
    2. Enter the email address of the users who need to enroll their device with WSO2 IoT Server, and click Send Invite(s).
      If you entered your email address, you will receive the registration email.

      Note

      In this scenario, WSO2 IoT Server uses a third-party email account to send the email invite to the same/another email address. Make sure the settings of that third-party email account allows another entity (in this case it is WSO2 IoT Server) to send an email on its behalf.

  5. Open the downloaded file, tap NEXT, and tap INSTALL.

  6. Tap OPEN, once the WSO2-SenseAgent is installed.
  7. Enter your details and tap REGISTER DEVICE.
    • Username: Your WSO2 IoT Server username
    • Password: The password you used to sign into WSO2 IoT Server
    • Server URL: Provide the server URL in the https://<IOTS_HOST>:<IOTS_HTTPS_PORT> format.
      Example:  https://10.100.4.98:8243
  8. Try out the Android Sense application.

    • If you want to add sensors, tap add sensor , select the sensors you wish to add, and tap OK.

      Info

      For more information on configuring the accelerometer to work with Android Sense, see Configuring the Rapid Accelerometer of the Android Sense.

    • If you want to push the data to the WSO2 IoT Server so you can view the data in real time or check out the historical data, tap push data to device.

...

  1. Click on the device icon available on the Devices page, and navigate to Device Details page.
  2. To view location-based device statistics, follow the steps below: 
    1. Install the geoextension geo extension feature to WSO2 IoT Server, by navigating to <IoTS_HOME>/wso2/analytics/scriptsdirectory  directory and running the following command. 

      Code Block
      mvn clean install -f siddhi-geo-extention-deployer.xml
    2. Enable the geoextension geo extension feature in WSO2 IoT Server, by openning opening the cdm-config.xml file in the <IoTS_HOME>/conf directory and setting the following properties under the <GeoLocationConfiguration> tag to true. 

      Code Block
      <GeoLocationConfiguration>      
      	<isEnabled>true</isEnabled>
          <PublishLocationOperationResponse>true</PublishLocationOperationResponse>
      </GeoLocationConfiguration>
    3. Restart the WSO2 IoT Server broker, core and, analytics profiles in the given order 

      Code Block
      cd <IOTS_HOME>/bin
       
      ------Linux/Mac OS/Solaris ----------
      ./broker.sh
      ./iot-server.sh
      ./analytics.sh
       
      -----Windows-----------
      broker.bat
      iot-server.bat
      analytics.bat
    4. Click on the Device Location tab. 

      Note

      For more information on location-based services, see Monitoring Devices Using Location Based Services

What's next

Follow the options given below to see what you can do next:

...