92
CHAPTER 6: Content Providers
Settings.System.putInt(contentResolver,
Settings.System.HAPTIC_FEEDBACK_ENABLED, 0)
SyncStateContract
This contract is used by the browser app, the contacts app, and the calendar app to help
synchronize user data with external servers.
UserDictionary
This refers to a content provider that allows you to administer and use predictive input based
on a word dictionary. As of API level 23, the user dictionary can be used only from input
method editors or the spelling checking framework. For modern apps you should not try to
use it from another place. This contract thus plays only an informational role.
VoicemailContract
This contract allows for accessing information referring to voicemail providers. It primarily
consists of two tables described by inner classes.
VoicemailContract.Status
A voicemail source app uses this contract to tell the system about its state.
VoicemailContract.Voicemails
This contains the actual voicemails.
You can list the contents of these tables. For example, for the Voicemails table, write the
following:
val uri = VoicemailContract.Voicemails.CONTENT_URI.
buildUpon().
appendQueryParameter(
VoicemailContract.PARAM_KEY_SOURCE_PACKAGE,
packageName)
.build()
showTable(uri)
fun showTable(tbl:Uri) {
Log.e("LOG", "####################################")
Log.e("LOG", tbl.toString())
val cursor = contentResolver.query(
tbl, null, null, null, null)
Caution While it is possible to acquire an individual URI for a certain setting, you should not use
the ContentResolver.update(), ContentResolver.insert(), and ContentResolver.
delete() methods to alter values. Instead, use the methods provided by the contract class.
Do'stlaringiz bilan baham: |