Code example for Account

0
    public void testForwardingToLocalInvisibleContacts() { 
 
        // Visible because there is no account 
        long contactId1 = queryContactId(createRawContactWithName("Bob", "Parr"));
 
        Account account = new Account("accountName", "accountType");
        long groupId = createGroup(account, "sid", "def",
                0 /* visible */,  true /* auto-add */, false /* fav */); 
        long contactId2 = queryContactId(createRawContactWithName("Helen", "Parr",
                account));
 
        Uri contentUri = Contacts.CONTENT_URI.buildUpon().appendQueryParameter(
                ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(Directory.LOCAL_INVISIBLE))
                .build();
 
        Cursor cursor = mResolver.query(contentUri,
                new String[]{Contacts._ID, Contacts.DISPLAY_NAME}, null, null, null);
        assertEquals(0, cursor.getCount());
        cursor.close();
 
        // Hide by removing from the default group