Demo app to showcase Sensor data using AIDL bound services.

Overview

AIDLServices

Displays data related to TYPE_ROTATION_VECTOR sensor using AIDL

  • Consist of aidlsdk module that expose sensor data
  • Sample app to show the sensor data

Usage

aidlsdk module

  • Bind Service
class SensorService : LifecycleService() //Bound Sevice with exposes sensor data using liveData

 val sensorData = MutableLiveData<FloatArray>() //Exposes rotational vector sensor data to the observer.

App usage

  • Add in your apps AndroidManifest.xml
<service
       android:name="com.vikasmane.aidlsdk.SensorService"
       android:enabled="true"
       android:exported="true" />
  • To use the service in your app bind to the service
private fun bindService() {
        rotationalServiceIntent = Intent(this, SensorService::class.java)
        rotationalServiceConnection = object : ServiceConnection {
            override fun onServiceConnected(componentName: ComponentName?, binder: IBinder?) {
                val orientationInterface = RotationalDataInterface.Stub.asInterface(binder)
                sensorDataText.text = orientationInterface?.rotationalData
                isServiceConnected = true
                updateButtonText()
            }

            override fun onServiceDisconnected(componentName: ComponentName?) {
                isServiceConnected = false
                updateButtonText()
            }
        }
        bindService(
            rotationalServiceIntent,
            rotationalServiceConnection,
            Context.BIND_AUTO_CREATE
        )
    }
  • The actual sensor listener is attached on calling rotationalData of orientationInterface after service is connected
orientationInterface?.rotationalData //Starts the sensor listener
  • This will start pushing the sensor data into the sensorData liveData
SensorService.sensorData.observe(this, {
            sensorDataText.text = it.contentToString()
        })

App screenshot

You might also like...
PokeCard Compose is a demo app 100% write in Compose, Flow and Koin based on MVI Clean Architecture 🐱⚡️
PokeCard Compose is a demo app 100% write in Compose, Flow and Koin based on MVI Clean Architecture 🐱⚡️

A Pokemon Card demo app using Jetpack Compose and Koin based on MVI architecture. Fetching data from the network with Ktor and integrating persisted data in Room database with usecase/repository pattern.

A sample Grocery Store app built using the Room, MVVM, Live Data, Rx Java, Dependency Injection (Kotlin Injection) and support Dark Mode
A sample Grocery Store app built using the Room, MVVM, Live Data, Rx Java, Dependency Injection (Kotlin Injection) and support Dark Mode

Apps Intro A sample Grocery Store app built using the Room, MVVM, Live Data, Rx Java, Dependency Injection (Kotlin Injection) and support Dark Mode In

A simple chat demo for socket.io and Android

socket.io-android-chat This is a simple chat demo for socket.io and Android. You can connect to https://socket-io-chat.now.sh using this app. Installa

Android common lib demo, include ImageCache, HttpCache, DropDownListView, DownloadManager, install apk silent and so on, you can find description
Android common lib demo, include ImageCache, HttpCache, DropDownListView, DownloadManager, install apk silent and so on, you can find description

android-demo 关于我,欢迎关注 微博:Trinea 主页:trinea.cn 邮箱:trinea.cn#gmail.com 微信:codek2 依赖:trinea-android-common android-auto-scroll-view-pager viewpager-indica

A demo of the power menu with Reveal and other animations
A demo of the power menu with Reveal and other animations

MaterialPowerMenu A demo of the power menu with Reveal and other animations Some days ago, I saw a gif on Google+ demonstating a concept of Android Po

Restaurant is a demo application based on modern Android application tech-stacks and MVVM architecture
Restaurant is a demo application based on modern Android application tech-stacks and MVVM architecture

Restaurant is a demo application based on modern Android application tech-stacks and MVVM architecture. Fetching data from the network via repository pattern.

an easy to use android library to let devs know how much internet-data their app is consuming
an easy to use android library to let devs know how much internet-data their app is consuming

EasyAnalytics! an easy to use android library to let developers know how much internet-data their app is consuming. We can identify this as we want ba

A sample app showing how to build an app using the MVI architecture pattern.
A sample app showing how to build an app using the MVI architecture pattern.

MVI Example This application was streamed live on Twitch to demonstrate how to build an application using MVI. You can find the VOD here for now: http

🎥 Android App using Kotlin, MVVM, ViewModel and LiveData, RxJava, Retrofit, REST API, OkHttp, Gson, Glide, Paging library and Material Design. In the app you can see a list of popular movies and additional info about every movie.
🎥 Android App using Kotlin, MVVM, ViewModel and LiveData, RxJava, Retrofit, REST API, OkHttp, Gson, Glide, Paging library and Material Design. In the app you can see a list of popular movies and additional info about every movie.

Movies 🎥 Android App using Kotlin, MVVM, ViewModel and LiveData, RxJava, Retrofit, REST API (https://www.themoviedb.org), OkHttp, Gson, Glide, Paging

Owner
Vikas Mane
Android developer offering more than seven years’ experience in mobile application development from planning, requirement gathering, development, testing
Vikas Mane
A Demo App which demonstrate the capabilities for BeVigil OSINT demo API

BeVigil-OSINT-Demo A Demo App which demonstrate the capabilities for BeVigil OSINT demo API Functionalities Firebase Authentication

Daniel Dominic 0 May 17, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Mike Penz 1.8k Nov 10, 2022
Google Play game services - Android samples

Google Play game services - Android Samples Copyright (C) 2014 Google Inc. Contents These are the Android samples for Google Play game services. Colle

Google Play Game Services 952 Dec 27, 2022
RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.

RoboDemo RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works. A sample is available in the download area of

Stéphane Nicolas 220 Nov 25, 2022
A demo app to show how to detect screenshots taken by the user while using the app

Screenshot Detector A demo app to show how to detect screenshots taken by the user while using the app. Blog link Detect Screenshots in Android Screen

Nikit Bhandari 77 Dec 9, 2022
🧸 A demo Disney app using Jetpack Compose and Hilt based on modern Android tech stacks and MVVM architecture.

DisneyCompose A demo Disney app using compose and Hilt based on modern Android tech-stacks and MVVM architecture. Fetching data from the network and i

Jaewoong Eum 791 Dec 30, 2022
A demo application that uses TMDB APIs to fetch the movie details and cache it using the Room DB.

TMDB App Tmdb sample project is a demo application that is based on modern Android architectures. It will fetch the data from the network and cache it

Clint Paul 38 Nov 28, 2022
Demo Android application using Gradle. Project is written entirely in Kotlin with MVVM architecture

Demo Android application using Gradle. Project is written entirely in Kotlin with MVVM architecture, Dagger / Hilt Dependency Injection, Room Database and Retrofit API Calls

Dejan Radmanovic 1 Apr 6, 2022
A simple notes app to demo Room + LiveData implementation in Android

RoomDb-Sample This is a demo app on how to implement Room persistance library, making use of LiveData in Android app How to implement Room: a SQLite o

Anitaa Murthy 117 Dec 23, 2022