{"id":18407176,"url":"https://github.com/kl3jvi/sysinfo","last_synced_at":"2025-08-01T03:33:35.462Z","repository":{"id":51412656,"uuid":"404118785","full_name":"kl3jvi/sysinfo","owner":"kl3jvi","description":"📖 This library is a set of simple wrapper classes that are aimed to help you easily access android device information.","archived":false,"fork":false,"pushed_at":"2022-08-02T09:04:11.000Z","size":281,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T15:51:41.161Z","etag":null,"topics":["android","androidlibrary","deviceinformation","hardware","kotlin","kotlin-library","library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kl3jvi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-07T20:49:06.000Z","updated_at":"2025-03-12T14:41:22.000Z","dependencies_parsed_at":"2022-09-25T01:42:09.438Z","dependency_job_id":null,"html_url":"https://github.com/kl3jvi/sysinfo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kl3jvi%2Fsysinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kl3jvi%2Fsysinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kl3jvi%2Fsysinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kl3jvi%2Fsysinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kl3jvi","download_url":"https://codeload.github.com/kl3jvi/sysinfo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247620543,"owners_count":20968232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","androidlibrary","deviceinformation","hardware","kotlin","kotlin-library","library"],"created_at":"2024-11-06T03:12:52.005Z","updated_at":"2025-04-07T08:32:34.274Z","avatar_url":"https://github.com/kl3jvi.png","language":"Kotlin","readme":"# SysInfo\n\nSimple, single class wrapper to get device information from an android device.\n\n![](static/sysinfo_banner.png)\n\nThis library provides an easy way to access all the device information without having to deal with all the boilerplate stuff going on inside.\n\n\nLibrary also provides option to ask permissions for Marshmellow devices! \n\n\n\u003ch2\u003eHow to integrate the library in your app?\u003c/h2\u003e\n\u003cb\u003eGradle Dependecy\u003c/b\u003e\u003c/br\u003e\n\n```gradle\ndependencies {\n    implementation 'com.github.kl3jvi:sysinfo:1.0.0'\n}\n```\n\n\u003cb\u003eMaven Dependecy\u003c/b\u003e\u003c/br\u003e\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.an.deviceinfo\u003c/groupId\u003e\n  \u003cartifactId\u003edeviceinfo\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.5\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n\u003ch2\u003eDownloads\u003c/h2\u003e\nYou can download the aar file from the release folder in this project.\u003c/br\u003e\nIn order to import a .aar library:\u003c/br\u003e\n1) Go to File\u003eNew\u003eNew Module\u003c/br\u003e\n2) Select \"Import .JAR/.AAR Package\" and click next.\u003c/br\u003e\n3) Enter the path to .aar file and click finish.\u003c/br\u003e\n4) Go to File\u003eProject Settings (Ctrl+Shift+Alt+S).\u003c/br\u003e\n5) Under \"Modules,\" in left menu, select \"app.\"\u003c/br\u003e\n6) Go to \"Dependencies tab.\u003c/br\u003e\n7) Click the green \"+\" in the upper right corner.\u003c/br\u003e\n8) Select \"Module Dependency\"\u003c/br\u003e\n9) Select the new module from the list.\u003c/br\u003e\n\n\u003ch2\u003eUsage\u003c/h2\u003e\nFor easy use, I have split up all the device information by the following:\u003c/br\u003e\n1. Location\u003c/br\u003e\n2. Ads\u003c/br\u003e\n3. App\u003c/br\u003e\n4. Battery\u003c/br\u003e\n5. Device\u003c/br\u003e\n6. Memory\u003c/br\u003e\n7. Network\u003c/br\u003e\n8. User Installed Apps\u003c/br\u003e\n9. User Contacts\u003c/br\u003e\n\n\n\u003ch2\u003eLocation\u003c/h2\u003e\n\n```\nval locationInfo = LocationInfo(this)\nval location: DeviceLocation = locationInfo.location\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| Latitude      | ```getLatitude()``` | Double |\n| Longitude      | ```getLongitude()``` | Double |\n| Address Line 1      | ```getAddressLine1()``` | String |\n| City      | ```getCity()``` | String |\n| State      | ```getState()``` | String |\n| CountryCode      | ```getCountryCode()``` | String |\n| Postal Code      | ```getPostalCode()``` | String |\n\n\n\u003ch2\u003eAds\u003c/h2\u003e\nNo Google play services needed!\n\n```\n val ad = AdInfo(this)\n        ad.getAndroidAdId(object:AdInfo.AdIdCallback{\n            override fun onResponse(context: Context, ad: Ad) {\n                TODO(\"Not yet implemented\")\n            }\n\n            override fun onError(context: Context, message: String) {\n                TODO(\"Not yet implemented\")\n            }\n        })\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| AdvertisingId      | ```getAdvertisingId()``` | String |\n| Can Track ads      | ```isAdDoNotTrack()``` | boolean |\n\n\n\u003ch2\u003eApp\u003c/h2\u003e\n\n```\nval app = App(this)\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| App Name      | ```getAppName()``` | String |\n| Package Name      | ```getPackageName()``` | String |\n| Activity Name      | ```getActivityName()``` | String |\n| App Version Name      | ```getAppVersionName()``` | String |\n| App Version Code      | ```getAppVersionCode()``` | Integer |\n\n\n\u003ch2\u003eBattery\u003c/h2\u003e\n\n```\nval battery = Battery(this)\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| Battery Percent      | ```getBatteryPercent()``` | int |\n| Is Phone Charging      | ```isPhoneCharging()``` | boolean |\n| Battery Health      | ```getBatteryHealth()``` | String |\n| Battery Technology      | ```getBatteryTechnology()``` | String |\n| Battery Temperature      | ```getBatteryTemperature()``` | float |\n| Battery Voltage      | ```getBatteryVoltage()``` | int |\n| Charging Source      | ```getChargingSource()``` | String |\n| Is Battery Present   | ```isBatteryPresent()``` | boolean |\n\n\n\u003ch2\u003eDevice\u003c/h2\u003e\n\n```\nval device = Device(this)\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| Release Build Version      | ```getReleaseBuildVersion()``` | String |\n| Build Version Code Name      | ```getBuildVersionCodeName()``` | String |\n| Manufacturer      | ```getManufacturer()``` | String |\n| Model      | ```getModel()``` | String |\n| Product      | ```getProduct()``` | String |\n| Fingerprint      | ```getFingerprint()``` | String |\n| Hardware      | ```getHardware()``` | String |\n| Radio Version      | ```getRadioVersion()``` | String |\n| Device      | ```getDevice()``` | String |\n| Board      | ```getBoard()``` | String |\n| Display Version      | ```getDisplayVersion()``` | String |\n| Build Brand      | ```getBuildBrand()``` | String |\n| Build Host      | ```getBuildHost()``` | String |\n| Build Time      | ```getBuildTime()``` | long |\n| Build User      | ```getBuildUser()``` | String |\n| Serial      | ```getSerial()``` | String |\n| Os Version      | ```getOsVersion()``` | String |\n| Language      | ```getLanguage()``` | String |\n| SDK Version      | ```getSdkVersion()``` | int |\n| Screen Density      | ```getScreenDensity()``` | String |\n| Screen Height      | ```getScreenHeight()``` | int |\n| Screen Density      | ```getScreenWidth()``` | int |\n\n\n\u003ch2\u003eMemory\u003c/h2\u003e\n\n```\nval memory = Memory(this)\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| Has External SD Card      | ```isHasExternalSDCard()``` | boolean |\n| Total RAM      | ```getTotalRAM()``` | long |\n| Available Internal Memory Size      | ```getAvailableInternalMemorySize()``` | long |\n| Total Internal Memory Size      | ```getTotalInternalMemorySize()``` | long |\n| Available External Memory Size      | ```getAvailableExternalMemorySize()``` | long |\n| Total External Memory Size      | ```getTotalExternalMemorySize()``` | String |\n\n\n\u003ch2\u003eNetwork\u003c/h2\u003e\n\n```\nval network = Network(this)\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| IMEI      | ```getIMEI()``` | String |\n| IMSI      | ```getIMSI()``` | String |\n| Phone Type      | ```getPhoneType()``` | String |\n| Phone Number      | ```getPhoneNumber()``` | String |\n| Operator      | ```getOperator()``` | String |\n| SIM Serial      | ```getsIMSerial()``` | String |\n| Network Class      | ```getNetworkClass()``` | String |\n| Network Type      | ```getNetworkType()``` | String |\n| Is SIM Locked      | ```isSimNetworkLocked()``` | boolean |\n| Is Nfc Present      | ```isNfcPresent()``` | boolean |\n| Is Nfc Enabled      | ```isNfcEnabled()``` | boolean |\n| Is Wifi Enabled      | ```isWifiEnabled()``` | boolean |\n| Is Network Available      | ```isNetworkAvailable()``` | boolean |\n\n\n\u003ch2\u003eUser Installed Apps\u003c/h2\u003e\n\n```\nval userAppInfo = UserAppInfo(this)\nval userApps:List\u003cUserApps\u003e  = userAppInfo.getInstalledApps(true);\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| App Name      | ```getAppName()``` | String |\n| Package Name      | ```getPackageName()``` | String |\n| Version Name      | ```getVersionName()``` | String |\n| Version Code      | ```getVersionCode()``` | int |\n\n\n\u003ch2\u003eUser Contacts\u003c/h2\u003e\n\n```\nval userContactInfo = UserContactInfo(this)\nval userContacts = userContactInfo.contacts\n```\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| Contact Name      | ```getDisplayName()``` | String |\n| Mobile Number      | ```getMobileNumber()``` | String |\n| Phone Type      | ```phoneType()``` | String |\n\n\n\u003ch2\u003eHow to get Permissions for android 6+\u003c/h2\u003e\nEasy! I have provided a small, easy wrapper for getting permissions for marshmellow devices.\n\nFirst, override onRequestPermissionsResult and call PermissionManager.handleResult(requestCode, permissions, grantResults);\n```\nprivate val permissionManager = PermissionManager(this)\n    override fun onRequestPermissionsResult(\n        requestCode: Int,\n        permissions: Array\u003cout String\u003e,\n        grantResults: IntArray\n    ) {\n        super.onRequestPermissionsResult(requestCode, permissions, grantResults)\n\n        permissionManager.handleResult(requestCode, permissions, grantResults);\n    }\n```\n\nNow you can ask permission:\n```\npermissionManager.showPermissionDialog(permission)\n            .withDenyDialogEnabled(true)\n            .withDenyDialogMsg(mActivity.getString(R.string.permission_location))\n            .withCallback(object : PermissionCallback {\n                override fun onPermissionGranted(\n                    permissions: Array\u003cString\u003e,\n                    grantResults: IntArray\n                ) {\n                    //you can handle what to do when permission is granted\n                }\n\n                override fun onPermissionDismissed(permission: String) {\n                    /**\n                     * user has denied the permission. We can display a custom dialog\n                     * to user asking for permission\n                     */\n                }\n\n                override fun onPositiveButtonClicked(dialog: DialogInterface, which: Int) {\n                    /**\n                     * You can choose to open the\n                     * app settings screen\n                     * *  */\n                    val permissionUtils = PermissionUtils(this)\n                    permissionUtils.openAppSettings()\n                }\n\n                override fun onNegativeButtonClicked(dialog: DialogInterface, which: Int) {\n                    /**\n                     * The user has denied the permission!\n                     * You need to handle this in your code\n                     * *  */\n                }\n            })\n            .build()\n```\n\n\u003ch3\u003eVarious options available in PermissionManager\u003c/h3\u003e\n\n| Value         | Function Name | Returns  |\n| ------------- |:-------------:| -----:|\n| To enable custom dialog when user has denied the permission    | ```withDenyDialogEnabled()``` | boolean |\n| To enable Rationale, explaining the need for the permission, the first time they have denied the permission    | ```withRationaleEnabled()``` | boolean |\n| Message to be displayed in the custom dialog   | ```withDenyDialogMsg()``` | String |\n| Title to be displayed in the custom dialog    | ```withDenyDialogTitle()``` | String |\n| Postive Button text to be displayed in the custom alert dialog    | ```withDenyDialogPosBtnText()``` | String |\n| Negative Button text to be displayed in the custom alert dialog    | ```withDenyDialogNegBtnText()``` | String |\n| Should display the negative button flag    | ```withDenyDialogNegBtn()``` | boolean |\n| Flag to cancel the dialog    | ```isDialogCancellable()``` | boolean |\n\n\nAuthor\n------\nKlejvi Kapaj - @kl3jvi on GitHub, @kl3jvi on Twitter\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkl3jvi%2Fsysinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkl3jvi%2Fsysinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkl3jvi%2Fsysinfo/lists"}