Languages

Menu
Sites
Language
how to open contact app and get contact name and phone number ?

Hello Everybody !

in my tizen web app, i want to open contact app for user select contact name and phone number.

Example open and get image : https://developer.tizen.org/dev-guide/2.2.1/org.tizen.web.device.apireference/tizen/application.html#findAppControlidp164264

How can i do this ?

thanks and best regard !

Responses

7 Replies
daniel kim

Hi,

This article has the details what you want. so I suggest you to visit this link.

 https://developer.tizen.org/documentation/tutorials/native-application/social/contacts

I wish this will help you.

Marco Buettner
try
    		{
				var data1 = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/social/result_type", ["item_id"]);
				var data2 = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/social/item_type", ["person"]);
				var data3 = new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selection_mode", ["single"]);
				var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/social/pick", null, "vnd.tizen.item.type/vnd.tizen.contact", null, [data1, data2, data3]);

				var serviceReplyCallback =
				{
					onsuccess: function(reply)
					{
						var contactId = reply[0].value[0],
							addressbook;

						// Define the error callback.
						function errorCB(err)
						{
							alert(err.message);
						}

						// Define the contact search success callback.
						function contactsFoundCB(contacts)
						{
							var selectedPerson = '',
                                contact = null;

							for(var i = 0; i < contacts.length; i++)
							{
                                contact = contacts[i]
								if(contactId === (contact.id || contact.personId))
								{
									//TODO: What did you want to do with the data
								}
							}
						}

						addressbook = tizen.contact.getDefaultAddressBook();
						addressbook.find(contactsFoundCB, errorCB);
					},

					onfailure: function(err) {
						alert(err.message);
					}
				};

				function onSuccess()
				{
					console.log("success");
				}

				function onError(e)
				{
					alert(e.message);
				}

				tizen.application.launchAppControl(service, null, onSuccess, onError, serviceReplyCallback);
			}
			catch(e)
			{
				alert("Error#1 ("+e.name+") : " + e.message);
			}

 

Marco Buettner

Instead to iterate the whole contactlist, you can use AbstractFilter and search directly for the contact.

 

nguyen ba

thank you, it work on tizen mobile device but not work on gear S :((

Marco Buettner

Yeah, because Wearables have no Social APIs like Calendar, Contact

AVSukhov

Hello,

You can use AppControl functionality with PICK opearation and input data (selection_mode, item_type and result_type)

For more info:

AppControl functionality:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.guides/html/web/tizen/application/application_w.htm#launch

Contact AppControl:

https://developer.tizen.org/dev-guide/2.2.0/org.tizen.native.appprogramming/html/guide/app/appcontrol_contact.htm#PICK

this is doc for native app, but you can use common info like operatopn and data for web app.

nguyen ba

thanks, but i want make web app on gear S, i dont know what "input data" to select contact with PICK operation