是否有可能将 TELEPHONY_SERVICE 设置为 null ?
TelephonyManager teleman = (TelephonyManager) getBaseContext()
.getSystemService(Context.TELEPHONY_SERVICE);
我的意思是有没有可能在上面的行中将 teleman 设置为 null ?
预先感谢您的回复。
最佳答案
是的,它可以。作为getSystemService()的手册说:
Returns
The service or null if the name does not exist.
对于一些基本服务来说,这是不太可能的,但电话不是其中之一。不要指望它会出现在 GoogleTV 或某种平板电脑上。您可以使用 hasSystemFeature() 检查某些功能是否可用
关于android - TELEPHONY_SERVICE 返回 null 的机会,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13050292/