I am developing an android app which can able to get push notifications. But I need to have a deviceId to make it successful and as I don't have any android phone, I used to test the app in emulator. So my question is, can I get a deviceId for my emulator.
you can't get device id in android but you can get IMEI number for push notification. bcoz all devices has different IMEI number. In Emulator you get by default 0000000000000 As your IMEI but in device you get perfect number. below is the code to get IMEI number
TelephonyManager telephonyManager1 = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imei = telephonyManager1.getDeviceId();
The command 'adb devices' also lists the active emulators, which can give the device id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With