Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Contributor
Posts: 2
Registered: ‎03-17-2014
My Device: Q10

Having trouble getting recent call number

[ Edited ]

I have written an Android app designed for BB10 / Android systems and I have run into a problem with getting the most recent call's number on the system. I am currently using a PhoneStateListener to notify and open the app when a call has ended. Here is the PhoneStateListeners code:

 

public class PhoneStateManager extends PhoneStateListener{
	
	public static Boolean usingPhone = false;
	private MainActivity mainactivity;
	private String mIncomingNumber;
	
	public PhoneStateManager(MainActivity main){
		mainactivity = main;
	}
	
	@Override
	public void onCallStateChanged(int state, String incomingNumber) {
		switch (state) {
        case TelephonyManager.CALL_STATE_IDLE:
            Log.d("DEBUG", "IDLE");
            if(usingPhone){
            	Log.d("DEBUG", "number (PSM): " + mIncomingNumber);
                mainactivity.askQuestion(mIncomingNumber);
            }
            usingPhone = false;
            break;
        case TelephonyManager.CALL_STATE_OFFHOOK:
            Log.d("DEBUG", "OFFHOOK");
mIncomingNumber = incomingNumber; usingPhone = true; break; case TelephonyManager.CALL_STATE_RINGING: Log.d("DEBUG", "RINGING"); usingPhone = false; mIncomingNumber = incomingNumber; break; } } }

 

This code works fine for the askQuestion() call, but it does not receive any information about incomingNumber (which is null). I have also tried using Android's android.provider.CallLog to access call logs, but to no avail. Will this only work on an actual phone and not a simulator? Is there any way to access an incoming / recent call's phone number on a Android Runtime Application?

BlackBerry Development Advisor
Posts: 140
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: Having trouble getting recent call number

This API is currently unsupported.

 

Appologies for this not being mentioned in the unsupported APIs list.

New Contributor
Posts: 2
Registered: ‎03-17-2014
My Device: Q10

Re: Having trouble getting recent call number

Ah, that's unfortunate. Is there any possible way on the Android Runtime to get a recent calls number? 

Thank you for the information regardless