Some examples of use in Android Java

Source: Internet
Author: User

connectivity= connectivityservice.getinstance (context);

Servicemanager.addservice (context.connectivity_service,connectivity);

Among them connectivityservice.getinstance (context); Corresponds to Frameworks/base/services/java/com/android/server/connectivityservice.java

Now look at the Connectivityservice.java in the

for (int nettype:mprioritylist) {
Switch (Mnetattributes[nettype].mradio) {
Case Connectivitymanager.type_wifi:
SLOG.V (TAG, "Startingwifi Service.");
Wifistatetracker WST = Newwifistatetracker (context, Mhandler);
Wifiservice Wifiservice = Newwifiservice (context, WST);
Servicemanager.addservice (Context.wifi_service,wifiservice);

Wifiservice.startwifi ();//Start Wifiservice
Mnettrackers[connectivitymanager.type_wifi] = WST;
Wst.startmonitoring ();//Start monitoring

Mwifienabler = new Wifienabler (this, (checkboxpreference) findpreference ("Enable_wifi"));

Mnotifyopennetworks =(checkboxpreference) findpreference ("Notify_open_networks");

Mnotifyopennetworks.setchecked(secure.getint (getcontentresolver (),secure.wifi_ Networks_available_notification_on, 0) = = 1);

Some examples of use in Android Java

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.