Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How to create and display all the group from the android device/emulator?

$
0
0

I tried the below code

var g = Ti.Contacts.getAllGroups( );//Getting all the groups on the contacts table
 
    var m = g[0].members();//select a group and check if it has members
    Ti.API.info(m)// my group was empty so i have to add people
 
    var p = Ti.Contacts.getAllPeople( )// get all the contacts
    for (var i in p){//group and add people to your group
        g[0].add(p[i]);
        Ti.API.info(p[i].firstName);
        Titanium.Contacts.save()// you have to save new changes in IOS
    }
    g[0].sortedMembers(Ti.Contacts.CONTACTS_SORT_FIRST_NAME);// FINALLY WE CAN SORT
 
    m = g[0].members();//   get the members 
 
    for (var i in m){// verify they are in order
        Ti.API.info(m[i].firstName);
    }
But when i run it on emulator it displays error as like below: [object Contacts] has no method 'getAllGroups'

may i know why this is happening and kindly replay

Thank you in advance


Viewing all articles
Browse latest Browse all 8068

Trending Articles