Get the Android Device hardware information


#1

I want to get the hardware information of the android device that running the application like the serial number, MAC address and IMEI. Is there any way to get it with BASIC code?


#2

You’ll have to use cordova-plugin-device and JavaScript.


#3

The cordova-plugin-device “device.serial” is working, but it is not the same as the serial number that I can found from under the “Settings”-“General Information”. My device is Honeywell mobile computer, should I need another way to capture the device serial number?


#4

Does it sound like the problem described here?


#5

I don’t think I can get the correct hardware serial from the android device. Instead, I will hard code the serial number onto a TXT file located somewhere in the device. Can I use the ReadFile() or FileReader() from cordova-plugin-file to get the content of the TXT file in the android native app?

I have another question about the icon & splashscreen for phonegap build android native app. Can I just select the PNG file for “iconAndroid” under the “Project Properties and Global Code” or I should use the cordova-plugin-SplashScreen?


#6

For file I/O, I imagine the standard FileReader will be fine. Second question I don’t know. Yet. :slight_smile:


#7

For the second question, I would like to add a custom icon for the android native app with phonegap build. Do you have any tutorial or sample the I can follow?


#8

Have a look at the PhoneGapAPI sample - it has a compete set of icons.

Here’s more info on Splash screens:
https://wiki.appstudio.dev/SplashScreens

and here
https://wiki.appstudio.dev/Submitting_to_the_Google_Play_and_Amazon_Stores

and here
https://wiki.appstudio.dev/Submitting_to_the_iOS_App_Store

There are a lot of different sizes which are needed. A utility like https://pgicons.abiro.com/ can help generate them all.


#9

I put the .png icon files under the project directory (project directory\icon\android) and modify the config.xml file. After deploy to PhoneGap Build, the apk file is generated. When I install the apk in the android device, the icon is still the default “AppStudio” icon.


#10

Delete the old one from the device first, to make sure nothing is being cached.

Otherwise, you need to double check that everything is correct in config.xml.


#11

OK. It work now. Thanks.