tkbabu405 / krvarma-android-samples

Automatically exported from code.google.com/p/krvarma-android-samples
0 stars 0 forks source link

Outgoing Call not Working.. #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

Hi,
Incoming Call is working properly.
But when I tested Out Going call than It shows me Null Number in the Toast.

I tried to find out the solution but dont find any. Please suggest.

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by kruti7...@gmail.com on 20 May 2011 at 5:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

package com.Service.child;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.database.ContentObserver;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.telephony.TelephonyManager;
import android.telephony.gsm.SmsManager;
import android.util.Log;
import android.widget.Toast;

public class CallReceiveObserver extends BroadcastReceiver {
    String id;
    static long start_time,end_time,total_time;
    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub

        Bundle bundle = intent.getExtras();
        Log.i("hellooooooooooooooooooooo","hai");
        if(null == bundle)
                return;

        String phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

        Log.i("OutgoingCallReceiver",phonenumber);
        Log.i("OutgoingCallReceiver",bundle.toString());

        String info = "Detect Calls sample application\nOutgoing number: " + phonenumber;
        TelephonyManager telephonyManager=(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        id=telephonyManager.getDeviceId();
        start_time=System.currentTimeMillis();
        Toast.makeText(context, start_time+"", Toast.LENGTH_LONG).show();
        Toast.makeText(context, info, Toast.LENGTH_LONG).show();
        Toast.makeText(context, id, Toast.LENGTH_LONG).show();

        if( bundle.getString(TelephonyManager.EXTRA_STATE).equalsIgnoreCase(TelephonyManager.EXTRA_STATE_IDLE))
        {
            end_time=System.currentTimeMillis();
            total_time=end_time-start_time;

        }

    }
    }

Original comment by lachul...@gmail.com on 24 May 2013 at 7:40