[Android] mobile guard binding SIM card

to update:

You can't receive the startup broadcast. Check it. It seems that the higher version of the system is prohibited

You can also send a startup broadcast through the ADB

adb shell am broadcast -a android.intent.action.BOOT_ COMPLETED

Not tested yet. Go back and test again

==========================

Read the serial number of the SIM card and save it. Once the SIM card is changed, it is considered to be the SIM card of the thief and give a warning

Read SIM card serial number

Get the telephonymanager object through getsystemservice (telephony_service)

Call the getsimserialnumber () method of the telephonymanager object to get the serial number of string type

Save the serial number in sharedpreences

Need to add permission android.permission.read_ PHONE_ STATE

Check whether the SIM card is changed

Use the broadcast receiver to monitor the mobile phone's startup broadcast

Create a new package xxx.receiver and a new class bootcompletereceiver.java

Register the manifest file, add the < receiver > node, and set the name Android: name = "XXX"

Add intent filter < intent Filter > node

Add an action < action / > node and set the listening action name android.intent.action.boot_ COMPLETED

In the onReceive () method of the bootcompletereceiver class, after receiving the broadcast, read the current SIM card serial number, compare the previously saved SIM card serial number, and send a short message to the security number if it is different

Monitoring boot requires permission Android: permission.receive_ BOOT_ COMPLETED

BootCompleteReceiver.java

SecGuide2Activity.java

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>