Android project mobile guard caller ID number home

Yesterday, the 360 mobile phone guard's Caller ID home location function was realized. The specific function is to display the home location of the current number when calling, and find the operation after learning

It is very simple. The specific implementation code is as follows:

AddressService. java

Set the center to configure whether to turn on the caller home display

Directly use the composite control we defined before

Get the settingitemview object, our custom control, and set the state

Call setonclicklistener() method of settingitemview object, set click event and override onclick method

Call the ischecked () method of settingitemview object to get whether it is currently selected or not

Judge the status, call the setchecked () method of settingitemview object, and set the status. Parameter: Boolean value

Call the startservice () method to start the service for monitoring the mobile phone status. Parameters: intent object,

Call the stopservice () method to close the service

Judge whether the current service is enabled, and set the default selected state of the control

Create a new tool class servicesutils java

Define a static method isservicerunning(), and pass in parameters: context, string, service name

Call the getsystemservice () method of the context object to obtain the activitymanager object. Parameter: context ACTIVITY_ SERVICE

Call the getrunningservices() method of the activitymanager object to get the list collection of running services. Parameter: int max

For loop list collection, each of which is a runningserviceinfo object

Call runningserviceinfo servie. Getclassname(), get the string service class name, judge it, and return true if it is equal

SettingActivity. java

ServicesUtils. java

The setting effect is as follows:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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