Android Phone Defender-stage summary 1

Source: Internet
Author: User

This article address: http://www.cnblogs.com/wuyudong/p/5904528.html, reprint please indicate source address.

This article is a summary of the previous mobile phone defender development.

1, Splashactivity
Version name display, get the version name from the manifest configuration file, Packagemanager
Detection of new versions of the server (local version number < version number)
Display logo

2, mobile phone anti-theft
SIM card binding: Each phone will have the corresponding card serial number, once replaced the original calling card, the serial number will change

3, mobile phone Guardian sub-package
Basic course subcontracting, each class package name,
Com.itheima.db
Com.itheima.db.dao Component Mode

Business logic Division

For example, ICBC

Com.icbc.money
Com.icbc.meeting
Com.icbc.travel

Component Partitioning (four components: Activity, service, broadcast, content provider (content resolver))

Mobilesafe

Com.wuyudong.mobilesafe.activity
Com.wuyudong.mobilesafe.service

Database operations
Com.wuyudong.mobilesafe.db
Com.wuyudong.mobilesafe.db.dao

Tool class
Com.wuyudong.mobilesafe.utils

Custom Controls (Android legacy controls, not required), custom combo controls
Com.wuyudong.mobilesafe.view
Com.wuyudong.mobilesafe.ui.widget

4, apply to head
Method One: Each class needs to add this code
In Setcontentview (R.layout.activity_splash);
Before setting the following code
Requestwindowfeature (Window.feature_no_title);

Way two: Unify remove all activity's head

@android: Style/theme.light.notitlebar way to head, use old version theme style
Modify the default style file to
<style name= "Apptheme" parent= "Appbasetheme" >
<!--also retains a high version of the style theme while going to the head--
<item name= "Android:windownotitle" >true</item>
</style>

5, Packagemanager get the current app version name, version number
Version name: For display (shadow effect, color)

Version number: For the APK comparison to the server,

If the server-side version number > local version number pop-up dialog box prompts the user to update
Server version number <= local version number directly into the application main interface

6, Network request send

The client sends the request
The server returns data as a stream, and the data is converted to a string, (JSON)

7. JSON parsing

See what to parse, when parsing the corresponding fields, be sure to copy not handwriting

8. JSON parsing exception condition

JSON once parsing error, debugging through breakpoints is the best way to adjust the wrong
Breakpoint Debugging Common buttons:
Green: Jumps to the next breakpoint
Red: Disconnect this breakpoint debug
Next: Execute the current code and proceed to the next step
Jump to method internal execution

9. Xutils Use Process

(1) Import the Xutils jar package
(2) Add the permissions that xutils need to use
<uses-permission android:name= "Android.permission.INTERNET"/>
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
(3) Get Httputils object, download apk with specified link address
(4) Httputils object call Download (download link address, the path of the file after download, the callback of the method during the download process)
OnStart ()
Onloading ()
ONSUCCESD ()
Onfail ())
(5) After downloading the APK installation process,

10. Package Build APK Process
(1) Generate signature file and specify location
(2) Use the generated signature file to create an APK for the project package
11. Installation APK Precautions
Upgrade
1, note: Overwrite the original application, the package name is consistent

2, Signature consistent???
Apps running from Eclipse to your phone, using apps in the Bin directory, using the Debug.keystore signature app

Mobile defender version One, right button to run to the phone, so use the signature is Debug.keystore
Mobile defender version Two, packaged separately, generates the corresponding signature file Heima74keystore

Generate an Heima74keystore as a signature file apk

Signature is the same, package name is different: build two mobile defender apk, package name is the unique symbol of the app
Different signatures, package name consistent: Overwrite installation failed

The version update process is as follows:

Android Phone Defender-stage summary 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.