Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Development

Reply
Contributor
Posts: 22
Registered: ‎02-26-2013
My Device: Z10
My Carrier: None
Accepted Solution

Q10 TELEPHONY_SERVICE getDeviceId() is NULL

Hello,

 

After running my Z10 ported app on the Q10 I was extremely shocked to see change in functionality (let alone assets and screen size, etc..). 

 

This 1 liner no longer works:

return ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();

 

I have even tried:

return ((TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceSoftwareVersion();

 And no luck.

 

 What is the deal with that and is there a fix? (Scratch that, I just want the fix, don't care for bug definitions)

 

 

It would be very nice to have the same API calls work on both devices the same way.

Retired
Posts: 140
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: Q10 TELEPHONY_SERVICE getDeviceId() is NULL

You may or may not like this, but here's a complete history of getDeviceId() and why it's all messed up / broken.  Smiley Happy

 

In the early days of Android Player (Playbook), there were many apps that relied on getDeviceId returning something valid.  But Playbook didn't have a cellular stack, so returning an IMEI was impossible.  So there was a decision to return the serial instead.

 

10.0, BB10 launch comes around, and this part is mistakenly omitted.  So it still returns serial no.

 

10.1 on Q10 comes around, and we've realized our mistakes (we've had numerous devs point out that it's returning the serial no and not the imei and so we should fix it).  So it's changed to return IMEI.

 

Unfortunately, there's a bug in the 10.1 initial release.  getDeviceId will only return the IMEI if there's a SIM card installed.  Otherwise it's going to return null.  Oops!  However Build.SERIAL should continue to return the serial no bug free.

 

Upcoming 10.1 maintainence releases will address this problem.  It will return the IMEI on phones, regardless of sim status.

Contributor
Posts: 22
Registered: ‎02-26-2013
My Device: Z10
My Carrier: None

Re: Q10 TELEPHONY_SERVICE getDeviceId() is NULL

Thanks for the clarification!

 

Has it ever been a priority for BB devices to return BB PIN / BBID to Android VM? Is it because of the whole PIN to BBID conversion? Thanks again!

Retired
Posts: 140
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: Q10 TELEPHONY_SERVICE getDeviceId() is NULL

Not for getDeviceId.  If it was exposed it'd be exposed via a different API.

Contributor
Posts: 22
Registered: ‎02-26-2013
My Device: Z10
My Carrier: None

Re: Q10 TELEPHONY_SERVICE getDeviceId() is NULL

No I meant in general, as a different API call