Extract contact number from sms

Post your questions and help other users.

Moderator: Martin

User avatar
TheBrain1984
Posts: 137
Joined: 07 Aug 2013 08:17
Location: Germany

Re: Extract contact number from sms

Post by TheBrain1984 » 26 Jan 2015 16:21

Oh, ok. Sorry for that I've no idea.

You need to import the phonebook somehow, but I don't know how.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Extract contact number from sms

Post by anuraag » 05 Feb 2015 03:23

Bump

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Extract contact number from sms

Post by Martin » 05 Feb 2015 18:55

Not sure if I understood your question. You could query the contacts database with action Query Content Provider to get a list of phone numbers and then pick one randomly.
The content URI to get the phone numbers is content://com.android.contacts/data/phones
Projection: data1 (column with the phone number)
Result Type: List
Variable: number_list

You can then use a script to pick a random number with function number = getRandomElement(number_list);

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Extract contact number from sms

Post by anuraag » 06 Feb 2015 01:52

Thanks martin
But I want phone numbers from a contact group.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Extract contact number from sms

Post by Martin » 06 Feb 2015 20:28

Unfortunately that's quite a complicated to achieve with action Query Content Provider since the contacts database is quite complicated by itself.

Here's a flow that might work: Phone of random coworker

-the first action determines the ID of the group called 'Coworker' of the defined google account (edit the action to use your account)
-the second action provides a list of all contact IDs in the group
-the third action picks a random contact from the list of contact IDs
-the fourth action reads the phone number of the contact and stores the number in variable contact
-the condition displays the variables created by the flow (group_id, contact_ids, random_contact_id, contact)

Note that the flow does not include any error handling so the flow will fail when the mail account or group does not exist.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Extract contact number from sms

Post by anuraag » 07 Feb 2015 02:22

Excellent. Thats what i need.
Thanks a lot Martin.

Post Reply