Display Random Entry from Contacts
Greetings!
I want to display a button on the start screen that will pull up a random person from the contacts. Having trouble seeing how to implement it. Any suggestions?
Thanx.
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Greetings!
I want to display a button on the start screen that will pull up a random person from the contacts. Having trouble seeing how to implement it. Any suggestions?
Thanx.
Can you show us what you tried? Are you able to load the list of contacts?
I think I want to take the ContactService and map it to a text area or list item. But I don't want to load all of the contacts just 1 random one.
I'm not sure if PhoneGap has that specific API -- to get a random contact. You can always double check http://docs.phonegap.com/.
You will probably need to load the contacts and then pick one randomly in your code.
Thanks. Doesn't look like PhoneGap has the random function built in. I will need to do some more research. If anyone could point me in the right direction, I'd be appreciative. I am a beginner-intermediate level coder.
Thanks.
One option is to load all contacts and then pick a random one with JavaScript.
So I would want to use: contacts.find
And then maybe set up an array, and pull a random number?