Android implements SMS encryption function (sending encrypted SMS and decrypting local SMS)

SMS encryption is such a function. Due to the small demand for novice learning, there are few simple demos on the Internet for novice reference. Xiaobian also spent a lot of time on self conceiving here. The specific process is not described. Let's talk about the content of the demo.

Demo function:

1. SMS can be sent and encrypted (by changing the char in the string)

2. Can view SMS in mobile phone

3. Can decrypt the received encrypted SMS.

Knowledge points involved:

1. Intent bundle delivery

2. Contentresolver get SMS

3. Listveiw and simpleadapter

4. Send SMS and set the broadcast to be monitored for sending SMS

Problems encountered:

1. Sending SMS with too long characters will cause sending failure

Solution: set sending each SMS to less than 70 words.

Principle: Each SMS is limited to 160 characters, and each Chinese character is 2 characters. Usually we send short messages with almost unlimited length, because once the length of a single short message is exceeded, the mobile phone will automatically send multiple messages, and then the receiver will receive multiple messages and display them together.

code:

MainActivity:

SendActivity:

ReceiveActivity:

ReceiveActivity_ show:

activity_ main:

activity_ send:

activity_ receive:

activity_ receive_ show:

The above is the whole content of this article. Android implements SMS encryption, sends encrypted SMS and decrypts local SMS. I hope it will be helpful to everyone's learning.

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
分享
二维码
< <上一篇
下一篇>>