سؤال

I'm currently working on an application where the code uses the device IMEI number as a variable to store something in the DB. We need to see what device the reading originated from.

ie: String IMEI = telephonyManager.getDeviceId();

However, I'm not sure how this will behave on phones without network access, such as a wifi only tablet. Will is return a unique value? Will it return null?

I know there are alternatives to using IMEI, and I don't need any explanation on what alternative values I can use. I only need to know what will happen when I call this on a phone with no network access. Please do not provide suggestions on alternative IDs or anything other than what I have asked. I appreciate you taking the time to read this question.

Thanks, -Mark

هل كانت مفيدة؟

المحلول

You get null.

Just ran into this on an app I wrote 3 years ago, and only just converted to tablet format. I had forgotten we were using IMEI (against the advice you and I both received ;-) ) and we started sending a whole bunch of null device IDs to the server.

Sadly it took a whole lot of network logs before I tracked it down to that little hack.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top