Android Training Course (21)

Source: Internet
Author: User

I learned how to initialize and load the property system and save it to the property file. Next I will learn about the Attribute Service. It is mainly used to provide a service for the upper layer of the Java Virtual Machine, or use java applications. The code for the start_property_service function is as follows:

#001 int start_property_service (void)

#002 {

#003 int fd;

#004

#005 load_properties_from_file (PROP_PATH_SYSTEM_BUILD );

#006 load_properties_from_file (PROP_PATH_SYSTEM_DEFAULT );

#007 load_properties_from_file (PROP_PATH_LOCAL_OVERRIDE );

This code is used to load the following default attribute files:

/System/build. prop

/System/default. prop

/Data/local. prop

 

#008/* Read persistent properties after all default values have been loaded .*/

#009 load_persistent_properties ();

This line of code is used to load attributes saved as attribute files.

 

#010

#011 fd = create_socket (PROP_SERVICE_NAME, SOCK_STREAM, 0666, 0, 0 );

#012 if (fd <0) return-1;

#013 fcntl (fd, F_SETFD, FD_CLOEXEC );

#014 fcntl (fd, F_SETFL, O_NONBLOCK );

This code is used to create a service socket and set the corresponding attributes.

 

#015

#016 listen (fd, 8 );

This line of code enables the property service to enter the listening status.

 

#017 return fd;

#018}

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.