Phone

Phone Introduction

Phone is the object that performs the dialing function of the mobile device.

Dialing

The makeCall method of the Phone object makes a call to the phone number transmitted as the argument. When making a call, you can set the automatic dialing option, and then depending on the option setting, you can select whether to open only the dialing screen or proceed to dial. If you do not set the automatic dialing option, then the user must manually touch the call button as it will only be processed to the dialing screen with the phone number set.

${sample}

After entering the phone number, touch the Call button to make a call.

On devices that do not have SIM cards or call functions, it follows the error processing method of the mobile device. Therefore, it may not proceed to the dialing screen, may output a warning message, or may be processed slowly as if it was temporarily stopped.

Screenshot_20180718-181943

${sample_element}

Phone > makeCall

This is the method that dials the phone number transmitted as the argument. You can receive two arguments, and the first argument must be input as a phone number. The second argument is the option to set the automatic dial function. The default value is 'false', which proceeds only to the dialing screen of the mobile device. When set to 'true', the number is dialed directly.

${sample_step}

1

Configuring the Screen

Add the Phone object. The added Phone object can be checked in the Invisible Object window.

Place the Static and Button components to configure the screen and the Edit component to receive the phone number appropriately as shown in the example figure.

Components and objects used to configure the screen are as follows.

Component / Object

ID

Phone

Phone00

Edit

edt_phonenumber

Button

btn_call

Static

stt_result

ImageViewer

ImageViewer00

2

Writing the Call Button Event Function

Write the onclick event of the Call button as follows. Check if the phone number is not entered and make a call by calling the makeCall method.

this.btn_call_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var strPhoneNumber = this.edt_phonenumber.value;
	
	if(nexacro._isNull(strPhoneNumber) || strPhoneNumber == "")
	{
		this.edt_phonenumber.setFocus();
	}
	else
	{
		if(this.Phone00.makeCall(strPhoneNumber, true))
		{
			this.stt_result.set_text("makeCall() succeed.");
		}
		else
		{
			this.stt_result.set_text("makeCall() failed.");
		}
	}
};

3

Writing the Edit Component Event Function

Write the onkeydown event function of the Edit component as follows. Process the enter key input of the virtual keyboard.

this.edt_phonenumber_onkeydown = function(obj:nexacro.Edit,e:nexacro.KeyEventInfo)
{
	if(e.keycode == "13")
	{			
		this.btn_call_onclick();
		this.btn_call.setFocus();
	}	
};

4

Writing the ImageViewer Component Event Function

Write the onclick event function of the ImageViewer component. Touching the X button of the phone number input field will delete the phone number entered in the Edit component.

this.ImageViewer00_onclick = function(obj:nexacro.ImageViewer,e:nexacro.ClickEventInfo)
{
	this.edt_phonenumber.set_value("");
	this.edt_phonenumber.setFocus();
};

5

Checking on the Mobile Device

Enter the phone number and touch the Call button to check if the call is dialed.

sample_phone_01_02