'Examplecall
GetAllContacts("WhatsApp")
''
Sub GetAllContacts(source As String)
Dim projection() As String = Array As String(rawcon.CONTACT_ID,rawcon.ACCOUNT_NAME,rawcon.ACCOUNT_TYPE,rawcon.ACCOUNT_TYPE_AND_DATA_SET,rawcon.DISPLAY_NAME,rawcon.DISPLAY_NAME_ALTERNATIVE,rawcon.DISPLAY_NAME_PRIMARY,rawcon.DISPLAY_NAME_SOURCE)
Dim selectionArgs() As String = Array As String(source)
Dim selection As String = $"${rawcon.ACCOUNT_NAME} = ?"$
cr.QueryAsync(rawcon.CONTENT_URI,projection, selection,selectionArgs,rawcon.ACCOUNT_NAME&" ASC")
wait for CR_QueryCompleted(Success As Boolean, Crsr As Cursor)
Log($"QueryCompleted(${Success})"$)
If LastException.IsInitialized Then
Log(LastException)
End If
If Crsr.IsInitialized Then
If Crsr.RowCount > 0 Then
Dim Cursor As Cursor
Cursor = Crsr
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
'calcon.ACCOUNT_TYPE,calcon.OWNER_ACCOUNT)
Log($"CR --------------------------------------"$)
Log(Cursor.GetString(rawcon.CONTACT_ID)) ' You can use the constants you used for the projection. But remember: only the ones you defined in the projection are available in the Result.
Log(Cursor.GetString(rawcon.ACCOUNT_NAME))
Log(Cursor.GetString(rawcon.ACCOUNT_TYPE))
Log(Cursor.GetString(rawcon.DISPLAY_NAME))
Log(Cursor.GetString(rawcon.DISPLAY_NAME_ALTERNATIVE))
Log(Cursor.GetString(rawcon.DISPLAY_NAME_SOURCE))
'Log(Cursor.GetString(rawcon.DATA4))
'Log(Cursor.GetString(rawcon.DATA5))
Next
Cursor.Close
Else
' No rows
End If
Else
'
End If
End Sub