gpt4 book ai didi

android - ActivityManager 不再需要我的应用

转载 作者:行者123 更新时间:2023-11-29 00:27:21 26 4
gpt4 key购买 nike

我正在开发一个 Android 应用程序,它需要在 Android 设备上连续运行大约 12 个小时。该设备除了使用这个应用程序外什么都不做,所以它总是在前台。经过可变延迟后,我的应用程序被操作系统杀死并显示以下消息:

I/ActivityManager(  360): No longer want com.my.app (pid 1234): empty for 10292s
I/qtaguid ( 360): Failed write_ctrl(s 0 10066) res=-1 errno=1
W/NetworkManagementSocketTagger( 360): setKernelCountSet(10066, 0) failed with errno -1
I/WindowState( 360): WIN DEATH: Window{415f9718 u0 SurfaceView}
I/WindowState( 360): WIN DEATH: Window{415b8f08 u0 com.my.app/com.my.app.MainActivity}
W/WindowManager( 360): Force-removing child win Window{415cc938 u0 SurfaceView} from container Window{415b8f08 u0 com.my.app/com.my.app.MainActivity}

我的应用程序正在显示带有 VideoView 的本地 html 文件,并使用服务与服务器保持实时连接。我认为这可能与服务有关,但我找不到相关线索。有没有办法获取有关此类错误的堆栈信息?

编辑:

我尝试在没有任何服务的情况下运行我的应用程序,但问题仍然存在,所以它与服务无关。

编辑 2:

这是我启动服务的代码。

Activity

     private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className,IBinder binder) {

Log.d("ServiceConnection", "Service connected");

SocketClientBinder rmBinder = (SocketClientBinder) binder;
socketService = rmBinder.getService();
isBound = true;

}

public void onServiceDisconnected(ComponentName className) {
isBound = false;
}
};

public void onDestroy() {
//we unbind our service to avoid keeping the connection
if (isBound) {
unbindService(mConnection);
isBound = false;
}
super.onDestroy();
}

public void onStart() {
super.onStart();
if( ! isBound) {
//We bind our activity with our service
Intent intent = new Intent(this, SocketClientService.class);
bindService(intent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY | Context.BIND_ADJUST_WITH_ACTIVITY | Context.BIND_IMPORTANT);
}
}

最佳答案

Empty process

A process that doesn't hold any active application components. The only reason to keep this kind of process alive is for caching purposes, to improve startup time the next time a component needs to run in it. The system often kills these processes in order to balance overall system resources between process caches and the underlying kernel caches.

http://developer.android.com/guide/components/processes-and-threads.html

关于android - ActivityManager 不再需要我的应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18445393/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com