The DialNumber
RPC allows you make a phone call via the user's phone. Regardless of platform (Android or iOS), you must be sure that a device is connected via Bluetooth (even if using USB) for this RPC to work. If the phone is not connected via Bluetooth, you will receive a result of REJECTED
from Core.
DialNumber
is an RPC that is usually restricted by OEMs. As a result, the OEM you are connecting to may limit app functionality if not approved for usage.
DialNumber
is a newer RPC, so there is a possibility that not all head units will support it. To find out if the RPC is supported by the head unit, check the system capability manager's hmiCapabilities.isPhoneCallAvailable()
property after the manager has been started successfully.
HMICapabilities hmiCapabilities = (HMICapabilities)sdlManager.getSystemCapabilityManager().getCapability(SystemCapabilityType.HMI); if (hmiCapabilities.isPhoneCallAvailable()) { // DialNumber supported } else { // DialNumber is not supported }
DialNumber
strips all characters except for 0
-9
, *
, #
, ,
, ;
, and +
.
DialNumber dialNumber = new DialNumber(); dialNumber.setNumber("1238675309"); dialNumber.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { Result result = response.getResultCode(); if(result.equals(Result.SUCCESS)){ // `DialNumber` was successfully sent, and a phone call was initiated by the user. }else if(result.equals(Result.REJECTED)){ // `DialNumber` was sent, and a phone call was cancelled by the user. Also, this could mean that there is no phone connected via Bluetooth. }else if(result.equals(Result.DISALLOWED)){ // Your app does not have permission to use DialNumber. } } @Override public void onError(int correlationId, Result resultCode, String info){ Log.e(TAG, "onError: "+ resultCode+ " | Info: "+ info ); } }); sdlManager.sendRPC(dialNumber);
DialNumber
has 3 possible results that you should expect: