Hello i have created an android app that uses a custom content provider named CustomCP, it implements all methods and everything works fine while managing data inside the ap
You can use below code to get the content provider data in other app.. You need to use content resolver to fetch the data..
try {
//URL provided in first app while creating the content provider
val URL = "content://com.test.localstorage.MyContentProvider/authentication"
val data = Uri.parse(URL)
val cursor: Cursor? = contentResolver.query(data, null, null, null, "user_id")
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
return cursor.getString(cursor.getColumnIndex("user_id")).toString()
} while (cursor.moveToNext())
}
}
} catch (ex: Exception) {
ex.printStackTrace()
}