如何检测在android手机SIM卡的变化? [英] How to detect the SIM card change in android phone?
问题描述
它非常令人沮丧的项目现在的局面。我在一个点上卡住了。我希望做一个简单的任务如下:
Its very much frustrating situation now in project. I am stuck up at one point. I want do a simple task as follows
- 当有人改变SIM卡,检测到这一事件,并检查是否这个新的SIM卡是从previous不同的SIM卡,并采取相应的行动。
- 我不想通过定时器或任何定期检查SIM_STATE ..
- 请安卓通知SIM卡的状态变化?如果是,请让我知道我可以检测SIM卡改变?
我也问过这个问题之前也,但没有坚实的回答我。这似乎是一个非常重要的API和它没有人照顾。请提供我一些code片段,如果你有,请...
I have asked this question before also but no solid answer I got. It seems a very important API and no one care about it. Please provide me some code snippet if you have please...
我坚持在这里和android电话服务文档中我不能够理解什么...这将非常有帮助,如果任何人都可以提供一些code的上方。
I am stuck up here and in the android telephony service documentation I don't able to understand anything... It will very helpful if anyone can provide some code for the above.
推荐答案
在启动应用程序保存 SIM(用户ID)
。
然后每次重新启动取SIM(用户ID),并用previous其中一个保存比较。
Then every restart fetch SIM(Subscriber ID) And Compare with previous one which you save.
和查找SubscriberID号 -
And for Finding SubscriberID number --
IMSI = m_telephonyManager.getSubscriberId();
IMSI = m_telephonyManager.getSubscriberId();
这篇关于如何检测在android手机SIM卡的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!