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.
EasyDeviceInfo is split into multiple module-libraries , v2.2.0 onwards. Use the appropriate one as per your requirement.
-
- Main library which transitively includes both
easydeviceinfo-ads
andeasydeviceinfo-base
.
- Main library which transitively includes both
-
- EasyDeviceInfo Ads, which facilitates information regarding ads. Has a dependency on
play-services-base
. - Supported Mods
- EasyDeviceInfo Ads, which facilitates information regarding ads. Has a dependency on
-
- EasyDeviceInfo Base, which facilitates information regarding the device.
- Supported Mods + EasyAppMod + EasyBatteryMod + EasyBluetoothMod + EasyConfigMod + EasyCpuMod + EasyDeviceMod + EasyDisplayMod + EasyIdMod + EasyLocationMod + EasyMemoryMod + EasyNetworkMod + EasyNfcMod + EasySimMod
Starting with 1.1.8
, Changes exist in the releases tab.
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
compile "com.github.nisrulz:easydeviceinfo:$easyDeviceInfoVersion"
// Base Composite
compile "com.github.nisrulz:easydeviceinfo-base:$easyDeviceInfoVersion"
// Ads Composite
compile "com.github.nisrulz:easydeviceinfo-ads:$easyDeviceInfoVersion"
}
where {latest version}
corresponds to published version in Jcenter
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.
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 |
📃 For more info , check the Wiki Docs
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:
- 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. - If its a feature, bugfix, or anything please only change code to what you specify.
- Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
- Pull requests must be made against
develop
branch. Any other branch (unless specified by the maintainers) will get rejected. - Check for existing issues first, before filing an issue.
- Have fun!
If you are using EasyDeviceInfo in your app and would like to be listed here, please let me know by opening a new issue!