Note that there are some explanatory texts on larger screens.

plurals
  1. POeverytime End phone Call come back to my activity even if i have not make a phone call from my application android
    primarykey
    data
    text
    <p>i have created application into which user can make a call on button click. </p> <p>i have found below code which is working fine to make call and come back to my activity when phone call end. but i have one problem in this application that is once i make a phone call from my application and end that phone call, after completing this whole cycle,i have press home button or back button. i will call some one from my phone directory and when end a call it will come back to my application not in phone directory.</p> <pre><code>public void imgbtnCallPhone_Click(View view) { EditText txtBusinessPhone = (EditText) findViewById(R.id.txtPhone); try { final Intent callIntent = new Intent(android.content.Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+ txtBusinessPhone.getText())); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { //Log.e("Calling a Phone Number", "Call failed", activityException); } } private class PhoneCallListener extends PhoneStateListener { private boolean isPhoneCalling = false; String LOG_TAG = "LOGGING 123"; @Override public void onCallStateChanged(int state, String incomingNumber) { if (TelephonyManager.CALL_STATE_RINGING == state) { // phone ringing //Log.i(LOG_TAG, "RINGING, number: " + incomingNumber); } if (TelephonyManager.CALL_STATE_OFFHOOK == state) { // active //Log.i(LOG_TAG, "OFFHOOK"); isPhoneCalling = true; } if (TelephonyManager.CALL_STATE_IDLE == state) { // run when class initial and phone call ended, // need detect flag from CALL_STATE_OFFHOOK //Log.i(LOG_TAG, "IDLE"); if (isPhoneCalling) { //Log.i(LOG_TAG, "restart app"); // restart app Intent i = getBaseContext().getPackageManager() .getLaunchIntentForPackage( getBaseContext().getPackageName()); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); isPhoneCalling = false; } } } } </code></pre> <p>i want a code that will check phone call is related to my application or not, if phone call done by my application then after end phone call it will come back to my application activity otherwise don't come back to my activity, do it default.</p> <p>Thanks,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload