user3782524
user3782524

Reputation: 1

detect a sim card change using alarm manager

I am developing an android app to detect a SIM change in the device on clicking a button. I want the app to execute the checksimstate() method every 5 minutes using alarm manager. I am using getSimSerialNumber() and getSubscriberId() to detect old sim and new sim.

Where should I call the method checksimstate() so that it gets executed every 5 minutes?

Upvotes: 0

Views: 402

Answers (1)

Sunil Kumar Sahoo
Sunil Kumar Sahoo

Reputation: 53657

It is not good idea to check for sim state every 5 minutes. instead you can listen to ACTION_SIM_STATE_CHANGED broadcast receiver and write your code to detect sim changed or not.

Upvotes: 1

Related Questions