由于不在Android设备中检查活动,因此视频通话已断开连接

时间:2015-09-16 15:07:59

标签: android

正在进行的视频通话在暂停时因为不在Android设备中的开发者选项下检查活动而断开连接如何检查用户是否保留视频而不是检查该选项

2 个答案:

答案 0 :(得分:0)

您可以使用以下行检查“不保持活动是否已被检查”

int value = Settings.System.getInt(getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);

如果它返回一个,请创建一个AlertDialog并要求用户先禁用它,如果用户点击了肯定按钮,那么为下面的设置创建一个意图,

int value = Settings.System.getInt(getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
if (value == 1)
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                context);

            // set title
            alertDialogBuilder.setTitle("");

            // set dialog message
            alertDialogBuilder
                .setMessage("You need to disable `do not keep activities` option, press YES")
                .setCancelable(false)
                .setPositiveButton("Yes",new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,int id) {
                        dialog.dismiss();
startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));

                    }
                  })
                .setNegativeButton("No",new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,int id) {
                        dialog.cancel();
                    }
                });

                // create alert dialog
                AlertDialog alertDialog = alertDialogBuilder.create();

                // show it
                alertDialog.show();
}

答案 1 :(得分:0)

我完全不确定我是否正确找到你。 但这样做:https://developer.android.com/training/scheduling/wakelock.html 回答你的问题?

当语音聊天正在进行时,它会阻止您的应用进入暂停状态。