[Solved] automatically sms read not working in android


For Xiaomi Permission Dialog Use this Read all SMS

   private void displaySmsLog() {
        Uri allMessages = Uri.parse("content://sms/");
        //Cursor cursor = managedQuery(allMessages, null, null, null, null);  Both are same
        Cursor cursor = getActivity().getContentResolver().query(allMessages, null,
                null, null, null);

   if (cursor!=null) {

    while (cursor.moveToNext()) {
        for (int i = 0; i < cursor.getColumnCount(); i++) {
            Log.d(cursor.getColumnName(i) + "", cursor.getString(i) + "");
        }
        Log.d("One row finished",
                "**************************************************");
    }
}
        else {


}

    }

Hope this helps.:)

2

solved automatically sms read not working in android