[Android] mobile guard turns off automatic updates

There are four ways to save data: network, broadcast provider, shared preferences and database

Get the SharedPreferences object through getsharedpreferences() method. Parameters: name, mode

For example, config, mode_ PRIVATE

Call the edit () method of the SharedPreferences object to get the editor object

Call the putboolean () method of the editor object to put Boolean data. Parameters: key value pair, "update" false

Call the commit () method of the editor object to submit the data

View / data / data / package name / shared_ Perfs / config.xml is the generated XML file

Use the command line ADB shell CD to the above directory, and use the cat command to view the files

Call the getboolean () method of the SharedPreferences object to get the saved data. Parameters: key, default value

Judge, set the status to true, and set the text content

Setup check download section

Get the status of whether the saved is automatically updated, and judge the status

If the update is automatic, call the code that detects the automatic update

If you do not update automatically, delay two seconds and automatically jump to the home page

Call the postdelayed() method of the handler object. Parameters: runable object, the number of milliseconds delayed

Use the anonymous inner class to inherit the runable object, override the run () method, and jump to the home page

The textview part of the upgrade progress is hidden by default. Android: visibility = "gone" gone is the hidden and empty position

This moment is displayed in the callback function during the download process

Call setvisibility (view. Visible) of textview object

SettingActivity:

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