访问标准android设置:SIM卡的PIN码
这是我的第一个问题! 我想知道如何使用android的标准设置,特别是SIM卡功能。 开机时,我的三星i-9000只显示了插入PIN码的窗口几秒钟,然后消失了,所以我想自己开发一个启动标准窗口插入PIN码的主屏幕小部件,但我不知道怎么做 或者以某种方式更改该窗口的屏幕超时访问标准android设置:SIM卡的PIN码,android,android-widget,Android,Android Widget,这是我的第一个问题! 我想知道如何使用android的标准设置,特别是SIM卡功能。 开机时,我的三星i-9000只显示了插入PIN码的窗口几秒钟,然后消失了,所以我想自己开发一个启动标准窗口插入PIN码的主屏幕小部件,但我不知道怎么做 或者以某种方式更改该窗口的屏幕超时 多谢各位 在Android中使用TelephonyManager。 您不直接实例化这个类;相反,您可以通过Context.getSystemService(Context.TELEPHONY\u服务)检索对实例的引用 这可能会
多谢各位 在Android中使用TelephonyManager。
您不直接实例化这个类;相反,您可以通过Context.getSystemService(Context.TELEPHONY\u服务)检索对实例的引用
这可能会帮助您……如果您想在Android 2.3以上版本中应用PIN,您必须将应用程序作为系统应用程序安装,在这两种情况下,您都应该使用以下代码:
TelephonyManager tm=(TelephonyManager)getSystemService(电话服务);
Class c=Class.forName(tm.getClass().getName());
方法m=c.getDeclaredMethod(“getITelephony”);
m、 setAccessible(true);
ITelephony电话服务;
电话服务=(ITelephony)m.invoke(tm);
//提供SIM PIN码
SharedReferences prefs=GetSharedReferences(OrangeSignalMeterLoop.class.getCanonicalName()+“x”,Context.MODE_PRIVATE);
if(prefs.getBoolean(context.getString(R.string.whetherAutoCompletePIN),false)){
String sim_pin=prefs.getString(context.getString(R.String.pinCode),“1111”);
电话服务提供pin(sim_pin);
}
您可能无法使用Internal class,您可以在此处找到如何使用它的最佳教程:非常感谢您的回答,但问题是另一个问题。我在另一个问题中看到了您的解决方案,但这个解决方案只告诉我是否需要PIN,而不告诉我如何设置它!:)
TelephonyManager manager = (TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE);
int state = manager.getSimState();
if(state == TelephonyManager.SIM_STATE_PIN_REQUIRED || state == TelephonyManager.SIM_STATE_PUK_REQUIRED)
{
//PIN/PUK is required
}