UserInfo

2017/08/08

Building Apps with UserInfo & Sign-In

1 Accessing Contacts Data

  1. user’s contacts information
  2. the data by calling ContentResolver methods or by sending intents to apps

1.1 Retrieving a List of Contacts

  1. match by contact name
  2. match any type of contact data
  3. math a specific type of contact data, such as a phone number

1.1.1 Request Permission to Read the Provider

  1. to do any type of search of the Contacts Provider, request READ_CONTACTS permission

<uses-permission android:name="android.permission.READ_CONTACTS">

1.1.2 Match a Contact by Name and List the Results

  1. ContactsContract.Contacts
Define ListView and item layouts

@android:id/list, @android:id/text1

1.1.2.1 Define a Fragment that displays the list of contacts
  1. ContactContract defines useful constacts and methods for accessing the provider
  2. define your own constants for content URIs, table names or columns
  3. use a CursorLoader to retrieve data from the provider, implement LoaderManager.LoaderCallbacks
  4. implement the adapter interface AdapterView.onItemClickListener
1.1.2.2 Define global variables
1.1.2.3 Initialize the Fragment

inflater.inflate(R.layout.contact_list_fragment, container, false);

1.1.2.4 Set up the CursorAdapter for the ListView
contactsList = (ListView) getActivity().findViewById(R.layout.contact_list_view);
cursorAdapter = new SimpleCursorAdapter(getActivity(), R.layout.contact_list_item, null, FROM_COLUMNS, TO_IDS, 0);
contactsList.setAdapter(cursorAdapter);

1.2 Retrieving Details for a Contact

1.3 Modifying Contacts Using Intents

1.4 Displaying the Quick Contact Badge

2 Adding Sign-In

  1. 相同凭证登录googleGoogle Android API
  2. 将登录和社交功能整合到app中。

2.1 Key Developer Features

  1. Trusted authentication,google登录是一个简单,可信安全的方式。Add Sign-in
  2. Access the profile and social graph.

2.2 Get Started

  1. Start Integrating

文内导航