Android - dialer icon gets placed in recently used apps after finish()
Posted
by Donal Rafferty
on Stack Overflow
See other posts from Stack Overflow
or by Donal Rafferty
Published on 2010-02-04T16:48:51Z
Indexed on
2010/04/08
10:03 UTC
Read the original article
Hit count: 198
In my application I detect the out going call when a call is dialled from the dialer or contacts.
This works fine and I then pop up a dialog saying I have detected the call and then the user presses a button to close the dialog which calls finish() on that activity.
It all works fine except that when I then hold the home key to bring up the recently used apps the dialer icon is there.
And when it is clicked the dialog is brought back into focus in the foreground when the dialog activity should be dead and gone and not be able to be brought back to the foreground.
Here is a picture of what I mean.
So two questions arise, why would the dialer icon be getting placed there and why would it be recalling my activity to the foreground?
Here is the code for that Activity which has a dialog theme:
public class CallDialogActivity extends Activity{
boolean isRecording; AudioManager audio_service;
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog); audio_service = (AudioManager) getSystemService(Context.AUDIO_SERVICE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
Bundle b = this.getIntent().getExtras();
String number = b.getString("com.networks.NUMBER");
String name = b.getString("com.networks.NAME");
TextView tv = (TextView) findViewById(R.id.voip) ;
tv.setText(name);
Intent service = new Intent(CallAudio.CICERO_CALL_SERVICE);
startService(service);
final Button stop_Call_Button = (Button) findViewById(R.id.widget35);
this.setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
stop_Call_Button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent service = new Intent(CallAudio._CALL_SERVICE);
//this is for Android 1.5 (sets speaker going for a few seconds before shutting down)
stopService(service);
Intent setIntent = new Intent(Intent.ACTION_MAIN);
setIntent.addCategory(Intent.CATEGORY_HOME);
setIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(setIntent);
finish();
isRecording = false;
}
});
final Button speaker_Button = (Button) findViewById(R.id.widget36);
speaker_Button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
if(true){
audio_service.setSpeakerphoneOn(false);
}
else{
audio_service.setSpeakerphoneOn(true);
}
}
});
}
@Override protected void onResume() { super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
public void onCofigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
}
It calls a service that uses AudioRecord to record from the Mic and AudioTrack to play it out the earpiece, nothing in the service to do with the dialler.
Has anyone any idea why this might be happening?
© Stack Overflow or respective owner