Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7649283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:55:35+00:00 2026-05-31T10:55:35+00:00

call.java: public class Call extends Activity{ boolean timerhasstarted; Intent callIntent; public void onCreate(Bundle savedInstanceState)

  • 0

call.java:

   public class Call extends Activity{
boolean timerhasstarted;
Intent callIntent;
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        call();
    }
    void  call()
    {
        String num="7829893070";
     callIntent=new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:"+num));
        if(!timerhasstarted)
        {
        startActivity(callIntent);
        ct.start();
        timerhasstarted=true;
        }
        else {
            ct.cancel();
            timerhasstarted=false;
            Toast.makeText(getApplicationContext(), "timer not started ",Toast.LENGTH_SHORT ).show();
        }
       }
   CountDownTimer ct=new CountDownTimer(10000,1000) {
    @Override
    public void onTick(long millisUntilFinished) {
        Toast.makeText(getApplicationContext(), "time: "+millisUntilFinished/1000, Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onFinish() {
        Toast.makeText(getApplicationContext(), "time over ..",Toast.LENGTH_SHORT ).show();
        OutgoingCallReceiver out=new OutgoingCallReceiver();
        out.onReceive(getApplicationContext(),callIntent);
    }
     };
      }

OutgoingCallReceiver.java :

 public class OutgoingCallReceiver extends BroadcastReceiver { 

     public static final String ABORT_PHONE_NUMBER = "7204230210";

     private static final String OUTGOING_CALL_ACTION = "android.intent.action.NEW_OUTGOING_CALL";
     private static final String INTENT_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";
     String TAG="EMERGENCY";
     @Override
    public void onReceive(final Context context, final Intent intent) {
    Log.v(TAG, "OutgoingCallReceiver .. : onReceive");
    Log.i( "l", "onReceive()" );
    Log.i( "l", "context: " + context );
    Log.i( "l", "intent: " + intent ); 
    String getphoneNumber = this.getResultData();
    Log.i(TAG,"getphnum "+getphoneNumber);

     String phoneNumber1 = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
     Log.i(TAG,"PHONE_NUMBER  "+phoneNumber1);
    Toast.makeText(context, "PHONE_NUMBER  "+phoneNumber1, Toast.LENGTH_LONG).show();
    if (intent.getAction().equals(OutgoingCallReceiver.OUTGOING_CALL_ACTION)) {
    Log.v(TAG, "OutgoingCallReceiver NEW_OUTGOING_CALL received");
     Toast.makeText(context, "OutgoingCallReceiver NEW_OUTGOING_CALL received", Toast.LENGTH_SHORT).show();  

        // get phone number from bundle
       String phoneNumber = intent.getExtras().getString("android.intent.action.NEW_OUTGOING_CALL");
        if ((phoneNumber != null) && phoneNumber.equals(OutgoingCallReceiver.ABORT_PHONE_NUMBER)) {
            Toast.makeText(context, "NEW_OUTGOING_CALL intercepted to number 123-123-1234 - aborting call",
                Toast.LENGTH_LONG).show();
            abortBroadcast();
           // this.setResultData(ABORT_PHONE_NUMBER);
        }
    }
}

phone number

  • String phoneNumber = intent.getExtras().getString(“android.intent.action.NEW_OUTGOING_CALL”); //getting null number
  • String phoneNumber =
    intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); //getting null number

  • here of both which statement is write to get phonenumber?

  • want to get the outgoing phone number ,but in logcat and in my phone i checked, it is showing null value. why?

  • what statement that i have to write to hold the outgoing caall phonenum?(single call only i have placed).

setResultData(null)

  • with this method, have to end the call,but not ending the call..in my
    phone? what i have to do to end call in my phone?

logcat

 03-15 11:50:06.062: V/EMERGENCY(490): OutgoingCallReceiver .. : onReceive
 03-15 11:50:06.082: I/l(490): onReceive()
 03-15 11:50:06.082: I/l(490): context: android.app.Application@44f3f8b0
 03-15 11:50:06.082: I/l(490): intent: Intent { act=android.intent.action.CALL dat=tel:7829893070 }
03-15 11:50:06.113: I/EMERGENCY(490): getphnum null
03-15 11:50:06.122: I/EMERGENCY(490): PHONE_NUMBER  null
03-15 11:50:10.522: D/dalvikvm(264): GC_EXPLICIT freed 71 objects / 3424 bytes in 189ms
03-15 11:50:15.653: D/dalvikvm(166): GC_EXPLICIT freed 4298 objects / 244840 bytes in 218ms

here getphnum & PHONE_NUMBER shows null. by toast also i an knowing null in phone device also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:55:36+00:00Added an answer on May 31, 2026 at 10:55 am

    you can try this for activity then after do this for background service

    public void outgoingRecord() 
      { 
              Cursor c = getContentResolver().query( 
                  android.provider.CallLog.Calls.CONTENT_URI, 
                  null, 
                  null, 
                  null, 
                  android.provider.CallLog.Calls.DATE+ " DESC"); 
              startManagingCursor(c); 
      int numberColumn = c.getColumnIndex( 
              android.provider.CallLog.Calls.NUMBER); 
    int dateColumn = c.getColumnIndex( 
              android.provider.CallLog.Calls.DATE); 
    // type can be: Incoming, Outgoing or Missed 
    int typeColumn = c.getColumnIndex( 
              android.provider.CallLog.Calls.TYPE); 
    int durationColumn=c.getColumnIndex( 
            android.provider.CallLog.Calls.DURATION); 
    // Will hold the calls, available to the cursor 
    ArrayList<String> callList = new ArrayList<String>(); 
    try{ 
    boolean moveToFirst=c.moveToFirst(); 
    Log.e("MOVETOFIRST", "moveToFirst="+moveToFirst); 
    } 
    
    catch(Exception e) 
    { 
              Log.e("MOVETOFIRSTERROR","MOVETOFIRST Error="+e.toString()); 
    } 
    
             String callerPhoneNumber = c.getString(numberColumn); 
             int callDate = c.getInt(dateColumn); 
             int callType = c.getInt(typeColumn); 
             int duration=c.getInt(durationColumn); 
             Log.d("CALLS", "callDate="+callDate); 
                 switch(callType){ 
                  case android.provider.CallLog.Calls.INCOMING_TYPE: 
                              Log.d("INCOMINGCALLLOG", "CallerPhoneNum="+ 
    callerPhoneNumber+" "+"Duration="+duration); 
                                    break; 
                  case android.provider.CallLog.Calls.MISSED_TYPE: 
                                      break; 
                  case android.provider.CallLog.Calls.OUTGOING_TYPE: 
                                 Log.d("OUTGOINGCALLLOG", 
    "CallerPhoneNum="+ callerPhoneNumber+" "+"Duration="+duration); 
                                     break; 
    } 
    
      } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got 2 java files app.java and gallaery.java App.java public class App extends Activity
Hi Friends i have written an Activity like below. SplashScreen.java public class SplashScreen extends
I have an Android activity called main.java and BPMClass.java class. I need to call
I have a one android class which extends Activity. public class MainAct extends Activity{
As title says, how do I call a java class method from a jsp,
When do you call super() in Java? I see it in some constructors of
My current activity class TimerAct.java makes use of a timer of 30secs. Upon the
package com.Project_recording; import java.io.File; import java.io.IOException; import android.app.Activity; import android.media.MediaPlayer; import android.media.MediaRecorder; import android.os.Bundle;
I got the following code inside my templateApp.java: package com.android.templateApp; import android.app.Activity; import android.os.Bundle;
I have main activity which call other object, for example GPS class. This GPS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.