Android - 拨号器图标在完成()后被放置在最近使用的应用程序中

发布于 2024-08-20 10:46:02 字数 2690 浏览 3 评论 0原文

在我的应用程序中,当从拨号器或联系人拨打电话时,我会检测到拨出呼叫。

这工作正常,然后我弹出一个对话框,说我已检测到该调用,然后用户按下按钮关闭该活动上调用 finish() 的对话框。

一切正常,除了当我按住主页键调出最近使用的应用程序时,拨号器图标就在那里。

当单击它时,对话框将重新回到前台焦点,而对话框活动应该已经消失并且无法返回到前台。

这是我的意思的图片。

拨号器错误 http://img515.imageshack.us/img515/8505/devicev.png< /a>

因此出现了两个问题,为什么拨号器图标会被放置在那里以及为什么它会将我的活动召回到前台?

以下是具有对话框主题的 Activity 的代码:

 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 受保护无效 onResume() { super.onResume();

  }

  @Override
  protected void onPause() {

      super.onPause();
  }

  public void onCofigurationChanged(Configuration newConfig) { 

   super.onConfigurationChanged(newConfig); 

   }

调用一个服务,该服务使用 AudioRecord 从 Mic 和 AudioTrack 进行录音,以便在耳机上播放,该服务与拨号器无关。

有谁知道为什么会发生这种情况?

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.

Dialer error http://img515.imageshack.us/img515/8505/devicev.png

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

今天小雨转甜 2024-08-27 10:46:02

最近使用的应用程序菜单并不关心应用程序是否已完成。如果是这样,它只会重新启动它。它显示的是最近使用过的东西,而不是当前正在运行的东西。

The recently used apps menu doesn't care if the app has been finished. It just restarts it if so. It is showing things that have been recently used, not things that are currently running.

や三分注定 2024-08-27 10:46:02

经过一些研究,HTC 的拨号器实现似乎存在一些错误,拨号器图标不应该出现,因为手机应该覆盖它。

After some research it seems HTC's implementation of the dialer has some bugs in it, the dialer icon should never appear as the phone should be overriding it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文