Android 应用程序在从呼叫返回时冻结

问题描述

由于我的android应用经常使用以下代码打开拨号应用

if (!String.IsNullOrWhiteSpace(number))
{
    var context = Android.App.Application.Context;
    if (context == null)
         return;

    var intent = new Intent(Intent.ActionDial,Android.Net.Uri.Parse("tel:" + number));
    intent.SetFlags(ActivityFlags.NewTask);
    context.StartActivity(intent);
}

问题是应用在第二次从呼叫中返回时会冻结。 在第一次通话时,即使在从通话中返回后,应用程序也能正常工作,但是当用户返回我们的应用程序以开始使用应用程序时再次拨号时应用程序会冻结。 我对 OnResume 和 OnPause 什么也没做,只是调用了基本函数

用户声称他们在 android 10 或 11 的最新更新后面临此问题。

我已经修复了一些内存泄漏问题,但用户没有观察到任何改进

任何帮助都是可观的。顺便说一句,我正在使用 Xamarin.forms,此代码用于实现依赖项服务。

已编辑: 此问题不会在所有设备上重现,因为我有日志文件,其中在崩溃期间记录了错误

04-01 14:13:51.843 W Inputdispatcher: channel '8f6beaa com.example.app/.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0xd,fd=469
04-01 14:13:51.843  3612  5985 E Inputdispatcher: channel '8f6beaa com.example.app/crc64dc2be0a4ecbe1a27.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)