Alex
Alex

Reputation: 3381

Send raw RIL request

I would like to know if someone has some example of how I can send RIL request for android using the RIL constants like

RIL_REQUEST_GET_SIM_STATUS
RIL_REQUEST_DIAL
RIL_REQUEST_SEND_SMS

and how to get the results from request using Android java base API.

Upvotes: 2

Views: 1547

Answers (1)

yummy
yummy

Reputation: 580

Methods can be found in RIL.java

Example to send RIL request:

import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneBase;

PhoneBase phone = (PhoneBase)PhoneFactory.getDefaultPhone();//or PhoneFactory.getPhone(SIM_ID);
//RIL_REQUEST_GET_SIM_STATUS    
phone.mCi.getIccCardStatus(result);
//RIL_REQUEST_DIAL
phone.mCi.dial (address, clirMode, result);
//RIL_REQUEST_SEND_SMS
phone.mCi.sendSMS (smscPDU, pdu, result);

The result is a Message which binded with Handler before calling above method, and once complete the corresponding result Message would be sent to the Handler, get it from result.obj. Samples to decode result can be found in following files,

RIL_REQUEST_GET_SIM_STATUS : UiccController.java

RIL_REQUEST_DIAL: GsmCallTracker.java

RIL_REQUEST_SEND_SMS: GsmSMSDispatcher.java

Upvotes: 2

Related Questions