androidkindle

MissingResourceException in Amazon Kindle due to Context.TELEPHONY_SERVICE


I'm getting a java.util.MissingResourceException due to the below code in Amazon Kindle Fire, which otherwise works perfectly fine ->

TelephonyManager tm = (TelephonyManager) cntx.getSystemService(Context.TELEPHONY_SERVICE);

Any insights please if I'm missing something, which can be rectified?


Solution

  • The Kindle Fire is a tablet, so there isn't any available telephony service.

    If you look at the documentation for getSystemService() it has this:

    Returns

    The service or null if the name does not exist.