Android One button lock screen

Source: Internet
Author: User

Original address: http://www.fengfly.com/plus/view-209437-1.html

The following two classes are used:

DeviceadminreceiverDevice Management components. This class provides a convenient action to explain the intent that is emitted by the system. Your device management application must contain a deviceadminreceiver subclass. In this program, it represents a Device manager on a mobile phone.Devicepolicymanager A class that manages a specification on a device. Most clients must declare a deviceadminreceiver that is currently enabled by a user. This Devicepolicymanager manages these specifications for one or more deviceadminreceiver instances.  the Devicepolicymanager instance has a method called Locknow can lock the screen directly. But before this, you need to activate the Device Manager in your program.here is the main class lockactivityThe following is the Device Manager class Lockreceiver, which is a class inherited from the Deviceadminreceiver, you can receive activation/contact activation of the broadcast, the next step, in this program, just a simple print information.master configuration file:where Lock_screen is the permission declaration for Device Manager and needs to be defined as an XML file in the Res/xml directoryOK. Now you can also do a button lock screen. Don't go online to find all kinds of ads with the push.

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.