• Stars
    star
    207
  • Rank 189,769 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Access sensor data for any Android device easily using Jetpack Compose 🌑️ 🧲 🧭

Compose Sensors

Accessing sensor data of your Android devices just became quick and easy ⚑️

This library provides a convenience wrapper over the Sensor APIs for Android to be used with Jetpack Compose.

Demo ❀️

Because A picture is worth a thousand words

Screen Recording 2023-04-03 at 1 00 08 PM

Usage πŸš€

Install dependency πŸ“²

Kotlin build.gradle.kts (:module-name)

dependencies {
    ...
    implementation("com.mutualmobile:composesensors:x.y.z")
}

Groovy build.gradle (:module-name)

dependencies {
    ...
    implementation 'com.mutualmobile:composesensors:x.y.z'
}

The library provides straightforward state methods for multiple sensors like Accelerometer, Gyroscope, etc (more mentioned below). Following is an example on how to get the current values from the Accelerometer:

val accelerometerState = rememberAccelerometerSensorState()

Use it in an example:

val accelerometerState = rememberAccelerometerSensorState()
// Optional: You could also write: rememberAccelerometerSensorState(sensorDelay = SensorDelay.Fastest) for fetching sensor data faster

Text(
    text = "Force X: ${accelerometerState.xForce}" +
    "\nForce Y: ${accelerometerState.yForce}" +
    "\nForce Z: ${accelerometerState.zForce}" +
    "\nIs Available?: ${accelerometerState.isAvailable}"
)

Sensors Supported πŸ“±

ComposeSensors supports the following Android sensors:

Sensor Composable
Accelerometer rememberAccelerometerSensorState()
Magnetic Field rememberMagneticFieldSensorState()
Gyroscope rememberGyroscopeSensorState()
Light rememberLightSensorState()
Pressure rememberPressureSensorState()
Proximity rememberProximitySensorState()
Gravity rememberGravitySensorState()
Linear Acceleration rememberLinearAccelerationSensorState()
Rotation Vector rememberRotationVectorSensorState()
Relative Humidity rememberRelativeHumiditySensorState()
Ambient Temperature rememberAmbientTemperatureSensorState()
Magnetic Field (Uncalibrated)️ rememberUncalibratedMagneticFieldSensorState()
GameRotation Vector rememberGameRotationVectorSensorState()
Gyroscope (Uncalibrated) rememberUncalibratedGyroscopeSensorState()
Significant Motion rememberSignificantMotionSensorState(onMotionEvent = {})
Step Detector rememberStepDetectorSensorState()
Step Counter rememberStepCounterSensorState()
Geomagnetic Rotation Vector rememberGeomagneticRotationVectorSensorState()
Heart Rate rememberHeartRateSensorState()
Pose6DOF rememberPose6DOFSensorState()
Stationary Detect rememberStationaryDetectSensorState()
Motion Detect rememberMotionDetectSensorState()
Heart Beat rememberHeartBeatSensorState()
Low Latency Off-Body Detect rememberLowLatencyOffBodyDetectSensorState()
Accelerometer (Uncalibrated) rememberUncalibratedAccelerometerSensorState()
Hinge Angle rememberHingeAngleSensorState()
Head Tracker rememberHeadTrackerSensorState()
Accelerometer Limited Axes rememberLimitedAxesAccelerometerSensorState()
Gyroscope Limited Axes rememberLimitedAxesGyroscopeSensorState()
Accelerometer Limited Axes (Uncalibrated) rememberUncalibratedLimitedAxesAccelerometerSensorState()
Gyroscope Limited Axes (Uncalibrated) rememberUncalibratedLimitedAxesGyroscopeSensorState()
Heading rememberHeadingSensorState()

License πŸ”–

Copyright 2023 MutualMobile

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

MMDrawerController

A lightweight, easy to use, Side Drawer Navigation Controller
Objective-C
6,760
star
2

MMWormhole

Message passing between iOS apps and extensions.
Objective-C
3,926
star
3

MMProgressHUD

An easy-to-use HUD interface with personality.
Objective-C
705
star
4

MMRecord

Seamless Web Service Integration and Core Data Model Population
Objective-C
691
star
5

VIPER-SWIFT

An example Todo list app written in Swift using the VIPER architecture.
Swift
502
star
6

CardStackUI

An iOS Healthbook-like highly customisable stack of cards implementation for Android
Kotlin
465
star
7

Praxis

Example Android project using MVVM, DaggerAndroid, Jetpack Compose, Retrofit, Coroutines and Multi module architecture ✌🏽
Kotlin
353
star
8

Counter

A simple example of the VIPER architecture for iOS apps
Objective-C
351
star
9

MMBarricade

Runtime configurable local server for iOS apps.
Objective-C
350
star
10

compose-animation-examples

Compose Animation Examples. Useful Jetpack Compose animations including Loading/progress, Looping, On-off, Enter, Exit, Fade, Spin and Background animations that you can take inspiration from.
Kotlin
203
star
11

MMSpreadsheetView

Objective-C
193
star
12

lavaca

A modern framework for client-side MVC web applications
JavaScript
105
star
13

AFHARchiver

An AFNetworking extension to automatically generate HTTP Archive files of all of your network requests!
Objective-C
102
star
14

gradle-dexinfo-plugin

Java
71
star
15

VIPER-TODO

Example project architected using VIPER
Objective-C
70
star
16

PraxisKMP

A Kotlin multiplatform base project
Kotlin
49
star
17

HarvestTimeKMP

A Kotlin multiplatform playground project for getharvest time logger clone.
Kotlin
44
star
18

Barricade

⛔️ DEPRECATED (Click on the link below to check out Barricade2) - Runtime configurable local server for Android apps.
Java
42
star
19

SeatLayout

A seat selection library for Android with an example for selecting seats for flights, sports venue, theatres, etc
Java
39
star
20

lavaca-starter

A starter app for lavaca
CSS
34
star
21

PraxisFlutter

Example Flutter Project using Clean Architecture
Dart
29
star
22

FitWatchCompose

Kotlin
21
star
23

MMKeystore

A Keystore library for Android apps that allows you to encrypt sensitive information, The encryption uses the Android KeyStore to generate RSA and AES keys for encryption operations.
Kotlin
13
star
24

UberBookingClone

Kotlin
13
star
25

cordova-bluetoothle

Cordova Bluetooth Low Energy plugin for iOS and Android
Objective-C
12
star
26

Barricade2

Runtime configurable local server for Android apps.
Kotlin
9
star
27

flutter_animations_example

Flutter Animation Examples. Useful Flutter animations including Loading/progress, Looping, On-off, Enter, Exit, Fade, Spin and Background animations that you can take inspiration from.
Dart
8
star
28

react-native-barricade

A local server configurable at runtime to develop, test, and prototype your React Native app.
TypeScript
8
star
29

HolidayCard

Build a Holiday Card for Hour of Code in Swift!
Swift
8
star
30

Brazos

A React web React Native starter with tooling for large scale projects
JavaScript
7
star
31

MM-Dribbble

A fun app to use at Dribbble meetups across the world!
4
star
32

clover-reporting

A reporting tool using the Clover REST API
HTML
3
star
33

dust_compiler

A simple Node command line tool that watches and compiles dust templates recursively from one directory to another
JavaScript
3
star
34

XcodeSortInstaller

A simple gem to install a new build phase on your Xcode project file to (on modification) sort itself on build.
Ruby
2
star
35

Google-Analytics

Storing Google Analytics Source Code for Cocoa Pods
Objective-C
2
star
36

SwiftUIAnimations

Playground for swiftui animations
Swift
2
star
37

Library

Library App that holds a shelf of books, and a detail view of each book that shows information about it like the book's Author, Publisher, Book ID/ISBN number and so on.
Objective-C
2
star
38

HarvestAPISpring

Kotlin
1
star
39

ReactFirebaseAuthComponent

Reusable code for simple authentication and integration with Firebase
JavaScript
1
star
40

ZomatoClone

Kotlin
1
star
41

clover.mutualmobile.com

CSS
1
star
42

seven68

Seven68 is a Objective-C library for iPad developers.
1
star