Good day developers,

I am trying to get the phone number of the outgoing call. Used the
following classes. I am not able to print the dialed number :(  Is
there a way how I can extract the dialed number?

Thanks.

package com.call.simulation;

import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class PhoneIntent extends Activity {
    private static final String LOG_TAG = "PhoneIntent";

    protected final IntentFilter outCallFilter=new
IntentFilter("android.intent.action.CALL");
    protected final IntentFilter inCallFilter=new
IntentFilter("android.intent.action.ANSWER");
    private MyBroadcastReceiver broadcastRec = new
MyBroadcastReceiver();

    /** Called with the activity is first created. */
    @Override
    public void onCreate(Bundle icicle)
    {
        super.onCreate(icicle);
        setContentView(R.layout.main);

        registerReceiver(this.broadcastRec, outCallFilter);

        Log.e(LOG_TAG, "Preparing to make a call");
        Intent mIntent = new Intent("android.intent.action.DIAL");
        startActivity(mIntent);
    }

        @Override
        public void onDestroy() {
                super.onDestroy();
                unregisterReceiver(this.broadcastRec);
        }
}


// MyBroadcastReceiver class

package com.call.simulation;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyBroadcastReceiver extends BroadcastReceiver {
    private static final String LOG_TAG = "BroadcastReceiver";

    @Override
    public void onReceive(Context context, Intent intent) {

        Log.e(LOG_TAG, "myBroadcastReceiver() ...");

        if(intent.getAction() != null) {
                Log.e(LOG_TAG, "Action:" + intent.getAction());
        }

        if(intent.getData() != null) {
                Log.e(LOG_TAG, "Uri:" + intent.getData().toString());
        }
        }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to