Pro Android with Kotlin


CHAPTER 6: Content Providers


Download 5.42 Mb.
Pdf ko'rish
bet84/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   80   81   82   83   84   85   86   87   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

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.



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   80   81   82   83   84   85   86   87   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling