:iphone: [Android Library] Get device information in a super easy way.

Overview

EasyDeviceInfo

Android library to get device information in a super easy way.

The library is built for simplicity and approachability. It not only eliminates most boilerplate code for dealing with device information, but also provides an easy and simple API to retrieve them


Built with ❤︎ by Nishant Srivastava and contributors


Note

EasyDeviceInfo is split into multiple module-libraries , v2.2.0 onwards. Use the appropriate one as per your requirement.

Changelog

Starting with 1.1.8, Changes exist in the releases tab.

Including in your project

EasyDeviceInfo is available in the Jcenter, so getting it as simple as adding it as a dependency.

dependencies {
    def easyDeviceInfoVersion = {latest version}

    // Base + Ads Bundled Library
    implementation "com.github.nisrulz:easydeviceinfo:$easyDeviceInfoVersion"

    // Base Composite
    implementation "com.github.nisrulz:easydeviceinfo-base:$easyDeviceInfoVersion"

    // Ads Composite
    implementation "com.github.nisrulz:easydeviceinfo-ads:$easyDeviceInfoVersion"
}

where {latest version} corresponds to published version in Jcenter

  • easydeviceinfo - Jcenter
  • easydeviceinfo-ads - Jcenter
  • easydeviceinfo-base - Jcenter

Usage Docs/Wiki

Introducing Mods in EasyDeviceInfo v2!

Mods or Modules are the new way to retrieve information. They let you get information in a very segmented manner and the best part is you only initialize the Mods you need in your project. Pretty rad , eh ? I know.

The whole api has been reworked in v2.x.x , however the functions remain the same, hence now you need to migrate to v2.x.x from 1.x.x.

Simple example

Now to use them, create an instance of one of the Mods ( Easy*Mod class ), i.e EasyConfigMod

EasyConfigMod easyConfigMod = new EasyConfigMod(context);

Next call an available function on the easyConfigMod instance such as

String time_in_ms= String.valueOf(easyConfigMod.getTime());

Now each Mods has a certain set of functions you can call on them to retrieve device information. i.e for EasyConfigMod

Value functionName returns
Is running on emulator isRunningOnEmulator() boolean
Time (ms) getTime() long
Formatted Time (24Hr) getFormattedTime() String
Up Time (ms) getUpTime() long
Formatted Up Time (24Hr) getFormattedUpTime() String

Android Studio support

  • Include a required permission check

    PermissionCheck

  • Setup all constants returned in a switch statement

    SetupSwitch

    This applies to all annotations bundled with easydeviceinfo. Checkout the wiki to see where these annotations can be applied.

    • @RingerMode
    • @DeviceType
    • @PhoneType
    • @OrientationType
    • @NetworkType
    • @BatteryHealth
    • @ChargingVia

📃 For more info , check the Wiki Docs

Pull Requests

I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (Reformat code) on Mac (not sure for Windows) with Android Studio defaults. This project uses a modified version of Grandcentrix's code style, so please use the same when editing this project.
  2. If its a feature, bugfix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing an issue.
  6. Have fun!

Apps using EasyDeviceInfo

If you are using EasyDeviceInfo in your app and would like to be listed here, please let me know by opening a new issue!

Other apps using EasyDeviceInfo, via AppBrain Stats

Author & support

This project was created by Nishant Srivastava but hopefully developed and maintained by many others. See the the list of contributors here.

If you appreciate my work, consider buying me a cup of to keep me recharged 🤘

  • PayPal
  • Bitcoin Address: 13PjuJcfVW2Ad81fawqwLtku4bZLv1AxCL

I love using my work and I'm available for contract work. Freelancing helps to maintain and keep my open source projects up to date!

Comments
  • Error:(75, 0) Could not get unknown property 'GROUP' for object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension.

    Error:(75, 0) Could not get unknown property 'GROUP' for object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension.

    Do you want to request a feature or report a bug?

    What is the current behavior? Error:(75, 0) Could not get unknown property 'GROUP' for object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension. Open File If the current behavior is a bug, please provide the steps to reproduce.

    Any logs, error output, bugreport etc?

    What is the expected behavior?

    Any other comments?

    ALSO POM VALUES ARE MISSING <-- developerId = POM_DEVELOPER_ID developerName = POM_DEVELOPER_NAME developerEmail = POM_DEVELOPER_EMAILID

    licenseName = POM_LICENCE_NAME licenseUrl = POM_LICENCE_URL allLicenses = [POM_ALL_LICENCES] --> sims like maven dependency missing how to resolve What versions of software are you using?

    • Device Information:

    • Android Version:

    • Configuration Information:

    • Misc:

    opened by MantraUser 4
  • Get Android Advertiser ID issue

    Get Android Advertiser ID issue

    Hello. There is a mistake in the next code:

    easyIdMod.getAndroidAdId(MainActivity.this, new EasyIdMod.AdIdentifierCallback() {
        @Override
        public void onSuccess(String adIdentifier, boolean adDonotTrack) {
            // Do something with the advertiser's ID
        }
    });
    

    you have easyIdMod here, but it doesn't have function getAndroidAdId. Maybe here should be easyAdsMod?

    opened by trafficteam7 3
  • Add number of apps shield

    Add number of apps shield

    What does this implement/fix? Explain your changes AppBrain provides a shield that shows how many apps on Google Play we know are using EasyDeviceInfo (currently 161), maybe cool to show next to the other shields?

    opened by mathijs81 3
  • App gives carrier info about sim1 only

    App gives carrier info about sim1 only

    My mobile is dual sim, all the features are working fine but it only shows carrier info for sim1 automatically. It would be great if shows the number of sim present and carrier info for each of the available sim.

    opened by vjs3 3
  • Can not build project from console

    Can not build project from console

    I've got the following error during gradlew build:

    Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
    

    It looks like gradle wrapper jar file was missed in "gradle/wrapper".

    opened by vbauer 3
  • app start err

    app start err

    java.lang.RuntimeException: Unable to start activity ComponentInfo{in.excogitation.deviceinfo/in.excogitation.deviceinfo.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2466)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2528)
        at android.app.ActivityThread.access$800(ActivityThread.java:169)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5552)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
    Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference
        at in.excogitation.a.a.I(Unknown Source)
        at in.excogitation.deviceinfo.MainActivity.onCreate(Unknown Source)
        at android.app.Activity.performCreate(Activity.java:5975)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
        ... 10 more
    
    opened by jp1017 3
  • [Feature Req] Monitor values for change and emit the updated value

    [Feature Req] Monitor values for change and emit the updated value

    @nisrulz

    Clarification-will it monitor and give json of each module? It will be good it can deliver device info whenever changes happening. Thank you!

    Do you want to request a feature or report a bug? feature What is the current behavior? need to call function and get info. but it would be nice if i can info whenever the changes happening.. let us say my device switched from mobile data to wifi , then the library will notify me about that event so that I can update my UI

    If the current behavior is a bug, please provide the steps to reproduce.

    similar to this library https://github.com/appzy/DeviceInfo

    enhancement 
    opened by vijayakumarmariyappan 2
  • Add missing zero for device time

    Add missing zero for device time

    Please add the missing zero for the device time.

    E.g if it's 04:09:42 o'clock the method getFormatedTime() will return 4:9:42

    It would be better to have it correctly formatted to return 04:09:42

    opened by PDDStudio 2
  • build error

    build error

    hi i can't build check this error Error:Execution failed for task ':app:processDebugResources'.

    Error: more than one library with package name 'com.google.android.gms' in my gradle

    compile 'com.google.android.gms:play-services-maps:7.8.0'

    opened by amorenew 2
  • Migrate to Maven Central

    Migrate to Maven Central

    JFrog just announced that they'll be shutting down JCenter: https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

    Key dates are:

    February 28th: No more submissions will be accepted to Bintray, JCenter May 1st: Bintray, JCenter services will no longer be available

    Hence need to migrate to another maven repository like Maven central.

    critical 
    opened by nisrulz 1
  • get real MAC address in Android 6+

    get real MAC address in Android 6+

    Offical document : https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html?hl=zh-cn#behavior-hardware-id

    Android 6+ cann't get real MAC address by call wm.getConnectionInfo().getMacAddress();

    opened by EdenStack 1
  • Create testing.txt

    Create testing.txt

    What does this implement/fix? Explain your changes

    Does this close any currently open issues?

    Any relevant logs, error output, bugreport etc?

    Any other comments?

    • Where has this been tested?

    • Device Information:

    • Android Version:

    • Target Platform:

    • SDK Version:

    • Configuration Information:

    • Misc:

    opened by venkatsai517 1
  • Create testing.txt

    Create testing.txt

    What does this implement/fix? Explain your changes

    Does this close any currently open issues?

    Any relevant logs, error output, bugreport etc?

    Any other comments?

    • Where has this been tested?

    • Device Information:

    • Android Version:

    • Target Platform:

    • SDK Version:

    • Configuration Information:

    • Misc:

    opened by venkatsai517 0
  • Migrate old support libraries to AndroidX

    Migrate old support libraries to AndroidX

    Hi there!

    First of all your library is very handy, thank you for that! But there is one thing, I would already like to get rid of Android jetifier which transforms support libraries to the AndroidX ones.

    easydeviceinfo-base contains a dependency com.android.support:support-annotations:27.0.2 - could we get rid of it and replace it to the androidx.annotations?

    opened by edgar-zigis 0
  • 📖 Guest Book 🙇🏻‍♂️

    📖 Guest Book 🙇🏻‍♂️

    This "issue" serves as a guest book. You're welcome to write nice things about this project, share how it's helped you out, or name drop companies using it.

    Idea came from this tweet.

    opened by nisrulz 0
  • import this into android studio

    import this into android studio

    hi, when import this into studio,have a mistake groovy.lang.MissingPropertyException: Could not get unknown property 'GROUP' for object of type org.gradle.internal.extensibility.DefaultExtraPropertiesExtension.

    can you please tell me how to do?thanks very much

    opened by linzblinzb 3
Releases(2.4.1)
  • 2.4.1(Dec 21, 2017)

    Changelog

    • Updated dependencies
    • Fixed dependency chain of sub modules
    • Added isWifiAwareAvailable() method in EasyNetworkMod
    • Code cleanup and bug fixes
    Source code(tar.gz)
    Source code(zip)
  • 2.4.0(Jul 29, 2017)

  • 2.3.3(Mar 6, 2017)

    Changelog

    • updated dependencies
    • added EasySensorMod and EasyFingerprintMod
    • added more functionality to EasyBluetoothMod and EasyNetworkMod
    • code cleanup and refactoring
    Source code(tar.gz)
    Source code(zip)
  • 2.3.2(Nov 30, 2016)

  • 2.3.1(Nov 6, 2016)

    Changelog

    • updated google play services to v9.8.0
    • replaced google play services base with basement dependency to reduce the method count
    • added check for BluetoothLE
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Oct 22, 2016)

    Changelog

    • Added support for api 25 (Android 7.1)
    • Added annotation support to generate the specific constants that are returned and checked against. Checkout the wiki for more info
    • Added multi sim support for API 21+
    • Updated gradle wrapper to v3.1
    • Updated support libs to v25.0.0
    • Better IDE support for required permissions
    • More functions in EasyDisplayMod
    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Sep 4, 2016)

    Changelog

    • Split the whole library into multiple libraries base,ads and easydeviceinfo (which includes both base and ads)
    • code cleanup
    • published to Jcenter
    • added more helper functions to EasyConfigMod, EasyAppMod
    • moved getAdID to newly added EasyAdsMod
    Source code(tar.gz)
    Source code(zip)
  • 2.1.1(Aug 19, 2016)

    Changelog

    • code cleanup and refactoring
    • updated google play services base dependency to v9.4.0
    • added util functions to handle EasyMemoryMod information conversions
    • added isPermissionGranted to EasyAppMod
    • Enabled modifying the not found value returned as result
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jul 12, 2016)

    Changelog

    • code cleanup and refactoring
    • fixed issue with hardware id in android 6+
    • added EasyNfcMod
    • added OSCodename for Android N
    • updated base google play services to v9.2.0
    Source code(tar.gz)
    Source code(zip)
  • 2.0.2(Jun 24, 2016)

    Changelog

    • Added support for api 24
    • Updated getLatLong() to work with Coarse/Fine permissions, based on whichever is provided.
    • Code cleanup and reformatting
    Source code(tar.gz)
    Source code(zip)
  • 2.0.1(Jun 15, 2016)

  • 2.0.0(Jun 14, 2016)

    Changelog

    • Major release v2.0.0
    • Introduced Mods , which are segmented device info retrieval units
    • Added a lot of new device information functions
    • Code cleanup, refactored and reformatted
    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Jun 4, 2016)

  • 1.2.0(Jun 2, 2016)

    Changelog

    • replaced play-services-ads:8.4.0 with play-services-base:9.0.1, as Ad ID classes have been moved into the base module dependency
    • Added getDeviceType method
    Source code(tar.gz)
    Source code(zip)
  • 1.1.9(May 14, 2016)

  • 1.1.8(May 14, 2016)

Owner
Nishant Srivastava
non-GDE Android Engineer crushing code 👨🏻‍💻
Nishant Srivastava
This is a easy way to publish MQTT message and receive MQTT message

SMQ-CLIENT This is a easy way to publish MQTT message and receive MQTT message This is provider a spring stater for quick use Recive message form the

SUDA 1 Apr 25, 2022
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt

Motion An Android library allowing images to exhibit a parallax effect. By replacing static pictures and backgrounds with a fluid images that reacts t

Nathan VanBenschoten 781 Nov 11, 2022
Android library for checking the internet connectivity of a device.

ConnectionChecker Android library for checking the internet connectivity of a device. Used in https://play.google.com/store/apps/details?id=com.muddas

Muddassir Ahmed Khan 34 Dec 24, 2022
Get a unique ID for Android devices without any permissions.

Java and Kotlin Android library. Uniquely identify an Android device without any permissions and API restrictions. The recommended approach using DRM API.

Eyosiyas Bereketab 9 Aug 25, 2022
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

null 1.4k Jan 9, 2023
Android device shake detection.

Seismic Android device shake detection. Download Download the latest .jar or depend via Maven: <dependency> <groupId>com.squareup</groupId> <artif

Square 1.2k Dec 27, 2022
A small utility to record Android device screen to a GIF

RoboGif A small utility to record Android device screen to an optimized GIF so you can paste it to GitHub or a similar service. Requirements Python 2.

Jernej Virag 526 Dec 9, 2022
adds an option to the Android Sharesheet that allows you to save files to your device.

Save On Device adds an option to the Android Sharesheet that allows you to save files to your device. Download Get the app from the Google Play Store

null 24 Nov 29, 2022
Android tiny device flow client

OAuth 2.0 Device Flow Example Setup Create an Auth0 application Enable Device Code Grants in Advanced settings Disable Client Credentials Enable Devic

Kenji Saito 0 May 15, 2022
[Deprecated] Sexy way to execute async/background tasks on Android

Groundy library for Android @Deprecated Unfortunatenly this library is no longer maintained, we encourage you to use other widely supported solutions

Telly 228 Nov 14, 2022
A compose friendly way to deal with in app updates on android

In-App update compose A way to make in app updates in compose How to include in your project The library is available via MavenCentral: allprojects {

Stefan Wärting 25 Dec 31, 2022
learn RxJava in new way!

RxLab amazing tool to learn ReactiveX Programming with animation, schedulers and time project on GitHub. this is an open source Android application wr

Anas Altair 70 Oct 21, 2022
TSBattery a new way to save your battery avoid cancer apps hacker it.

TSBattery TSBattery a new way to save your battery avoid cancer apps hacker it. TSBattery 是一个旨在使 QQ、TIM 变得更省电的开源 Xposed 模块 Get startted 此模块支持原生 Xposed

Fankesyooni 375 Jan 2, 2023
Keep data as a linked list on disk. A alternative way to reduce redundant operation for DiskLruCache

DiskLinkedList Keep data as a linked list on disk. An alternative way to reduce redundant operation for DiskLruCache Use-case Android have build-in Di

Cuong V. Nguyen 6 Oct 29, 2021
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
Very easy to use wrapper library for Android SharePreferences

Treasure English document Treasure是一个Android平台上基于SharePreferences的偏好存储库,只需要定义接口,无需编写实现,默认支持Serializable和Parcelable。运行时0反射,不仅使用方便而且性能和原生写法几乎无差别。 使用方法 1

星一 507 Nov 12, 2022
A simple and easy to use stopwatch and timer library for android

TimeIt Now with Timer support! A simple and easy to use stopwatch and timer library for android Introduction A stopwatch can be a very important widge

Yashovardhan Dhanania 35 Dec 10, 2022
Compose easy forms validation library

Compose EasyForms Focus on building your form UI while the library do the heavy work for you. Features Built in support for most of the Form widgets i

Kosh Sergani 24 Jul 18, 2022
[] Easy async loading for Android's ListView/GridView

NOTE: Smoothie's API is not final yet. Although the library is fairly funcional, this is still beta-quality code. Do not rely on it for production cod

Lucas Rocha 988 Dec 22, 2022