-3

I'm developing an android anti theft application using SMS and I'm on the point to detect if there's a SIM card change by the thief and then send the new SIM card number that have been inserted to the alternative number so they can send commands to that new number.
My question is: how can I know the new number inserted or how to develop a code to know the number of newly inserted SIM?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
fatima
  • 33
  • 1
  • 6

2 Answers2

2

Store previous sim card number(imsi number) on server and each time anyone insert new sim card get sim_state_reciever (by using reciever for android.intent.action.SIM_STATE_CHANGED) and get new sim card number and compare previous sim card number with new one and as soon as you detect sim card change then fire query to get phone number and store that phone number on server.

Ashish Garg
  • 162
  • 1
  • 11
  • sim_state_receiver ? does it get information about the new sim inserted ? such as the number of the sim and imsi number ?? or should i get back to the service provider company of the sim to get its number ?? – fatima Apr 27 '17 at 10:20
  • you get imsi number by using telephony manager class via TelephonyManager.getSubscriberId() but this sim state reciever call on every boot of device – Ashish Garg Apr 27 '17 at 10:38
  • i have another question > what's much reliable for using anti theft apps ( SMS or internet ) ?? – fatima May 21 '17 at 12:21
  • Make your own because i don't think any app can fulfill all your condition/requirement – Ashish Garg May 25 '17 at 11:28
0
TelephonyManager myTelManager=(TelephonyManager)myContext.getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = myTelephonyManager.getLine1Number();

also you should add this permission to your manifest file.

<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 

store that phone number and check everytime sim state_changed.

P.S : It sometimes sending "null" as response.

for more information about sim state changed BroadcastReceiver

Community
  • 1
  • 1
Utku Cansever
  • 180
  • 2
  • 16