Open GoogleCodeExporter opened 8 years ago
[deleted comment]
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
Original issue reported on code.google.com by
kruti7...@gmail.com
on 20 May 2011 at 5:32