A Simple Flutter Android App, which displays Sensor Data.

Overview

sensorz

A Simple Flutter Android App, which displays Android Sensor Data.

Introduction ::

  • For implementation of UI, this app uses Flutter Framework.
  • Code base is written mainly using Dart and Kotlin, these two languages.
  • For accessing platform features, such as Sensors, Kotlin Language is used.
  • UI level coding is done using Dart Language.
  • For receiving continuous sensor data feed from platform level, EventChannel is used.
  • This Android App is tested to be properly working on Android Pie (9.0).
  • This app uses Android Sensors Feature ( android.hardware.sensor ).
  • To install apk using adb, try running following command in your computer's console, after downloading apk. Make sure you have adb installed and PATH variable is properly set.
  >>> adb install sensorz.apk
  • For more info on adb, head to this link.

Download ::

  • You could easily download the apk file here.

App Overview ::

Overview 1 Overview 3 Overview 3
screenshot1 screenshot2 screenshot3

Implementation Info ::

Lets first talk about Dart portion of the app ...

UI using Dart :

  • In main.dart, I created one Stateless Widget, SensorMain under which, initialRoute was SensorMainHome, which is a Stateful Widget.

  • As I'm using one Stateful Widget, I need to define a class which will be holding the current state of the app.

  • _SensorMainState, holds current state of app.

  • Overriding build method is required in _SensorMainState. So I used a Scaffold Widget, which is a very basic material based widget.

  • Well let me tell you one thing, in flutter, almost every UI component is a Widget.

  • For displaying sensor info and their live data feed, I'm using LisView layout manager.

  • A Card ( material design UI component ), is holding info regarding a certain sensor which is present on that device.

  • For invoking methods which are available in platform level ( Android API ), I used methodChannel.

  • First need to create an instance of method channel with one unique methodChannelName (String), the same name should be used in platform level code too.

  • That instance will help us to invoke methods which are defined in platform level.

  • One eventChannel is also created, which helps us to gain live sensor data updates from platform level.

  • Remember, we need to create both, methodChannel and eventChannel from platform level too, using same channel identifier string.

  • Check code comments, for more info.

Going to platform level implementation of the app ...

Platform Level using Kotlin :

  • In MainActivity.kt, I registered methodChannel and eventChannel.

  • When getSensorsList() is invoked from platform level, a list of all sensors present in that device is returned back to UI level calling function.

  • And using the instance of SensorManager which I created at very beginning of app lifecycle, SensorEventListener is registered for all of those sensors.

  • For sending live sensor data feed to UI level, so that I can update UI as soon as data comes in, I wrote on class MySensorListener, which overrides SensorEventListener, and takes instance of EventChannel.EventSink as the only parameter.

  • In onSensorChanged(), I send sensor data back to UI level, where a listening service is already registered.

  • As soon as data comes in, UI level Dart code starts working for extracting that data and updates UI, so that changes gets reflected.

Well this is it.

Hope it was helpful :)

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

You might also like...

Api Call Check flutter - A new Flutter project that demonstrates api calling and displays them in a scrollable list

Api Call Check flutter - A new Flutter project that demonstrates api calling and displays them in a scrollable list

api_fetch A new Flutter project that demonstrates api calling and displays them

Jan 2, 2022

This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc.

screen_retriever This plugin allows Flutter desktop apps to Retrieve information about screen size, displays, cursor position, etc. screen_retriever P

Dec 6, 2022

Multi type list view - A flutter customer ListView that displays multiple widget types.

Multi type list view - A flutter customer ListView that displays multiple widget types.

MultiTypeListView A light weight flutter customer ListView that displays multiple widget types. Screenshot home chat Getting Started dependencies: m

Jun 28, 2022

This application displays the characters of the series Breaking Bad, has been used Cubit state and API .

breaking_bad A new Flutter project using bloc. Getting Started This project is a starting point for bloc state_management. A few resources to get you

Dec 24, 2021

SoundVolumeView that displays general information and the current volume level for all active sound components in your system, and allows you to instantly mute and unmute them

SoundVolumeView that displays general information and the current volume level for all active sound components in your system, and allows you to instantly mute and unmute them

SoundVolumeView that displays general information and the current volume level for all active sound components in your system, and allows you to instantly mute and unmute them

Mar 4, 2022

Here is an application project that displays a list of products from the Elevenia API called STORE.

Here is an application project that displays a list of products from the Elevenia API called STORE.

Here is an application project that displays a list of products from the Elevenia API called STORE.

May 18, 2022

A text field that displays text on different languages based on your selection.

translatable_text_field A text field that displays text on different languages based on your selection. Its basic idea is that you place this fields i

Mar 13, 2022

State Persistence - Persist state across app launches. By default this library store state as a local JSON file called `data.json` in the applications data directory. Maintainer: @slightfoot

State Persistence Persist state across app launches. By default this library store state as a local JSON file called data.json in the applications dat

Sep 28, 2022

Local data hive - Local data hive for flutter

Local data hive - Local data hive for flutter

local_data_hive A new Flutter application. ScreenShot

Jan 8, 2022
Comments
  • Logo Design Proposal

    Logo Design Proposal

    hello @itzmeanjan Here's what I came up with SensorZ.. I hope you like it!

    • Simple and Uniform to the other Z project logos of yours. The design is a combination of the Sensor symbol and Z initial.. Colors are based from the actual projects screenshots

    PRES-01-01-19

    opened by Tobaloidee 4
Owner
Anjan Roy
Learning :)
Anjan Roy
Teach you some of the popular sensor controlling packages that are available in pub.dev

Sensor Packages Introduction to sensor packages: This repo will teach you some of the popular sensor controlling packages that are available in pub.de

Md. Siam 20 Nov 23, 2022
Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Tanner Meade 77 Jan 2, 2023
Brands info app - Simple app that displays information about brands

brands_info_app Simple app that displays information about brands UI

Bunyod 0 Jan 6, 2022
ITS A SIMPLE CRYPTO APP THAT GIVES OR DISPLAYS PRICES - %CHANGE AND CHANGE VALUE OF TICKER (VARIOUS CRYPTO ASSERTS)

btcpricetracker A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

jatin upadhyay 0 Dec 28, 2021
Simple project that consumes the World Time APi and displays the time for the chosen location.

World Time App Simple project that consumes the World Time APi and displays the time for the chosen location. Web Api WorldTime Technologies Flutter A

Mario Vieria 1 Jan 20, 2022
Ali Türkay AVCI 1 Jan 20, 2022
A Flutter app that displays superheroes and villains from different universes

?? FlutterSuperHeroes A Flutter app that displays superheroes and villains from different universes ?? ScreenShots 1 2 3 4 5 6 ✨ Requirements Any Oper

Festus Olusegun 100 Dec 27, 2022
A Flutter widget that checks and displays the version status of application and you can easily guide user to update your app

A most easily usable Flutter widget about application version check! 1. About 1.

Kato Shinya 1 Dec 16, 2021
World_holidays - #1 A mobile app built with Flutter that displays the various holidays

World Holidays Mobile App World Holidays is a mobile app built with Flutter that displays the various holidays in a year across the countries of the w

Victor Eronmosele 29 Oct 7, 2022
Neumorphic style - Example app with Flutter that displays a neumorphic style container

Flutter Neumorphic Style Example App Example app with Flutter that displays a ne

Piyush Nagpal 2 Mar 24, 2022