远程服务崩溃时活动崩溃 [英] Activity crashes when remote service crashes

查看:234
本文介绍了远程服务崩溃时活动崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解远程服务,一切都很好,我可以启动服务,知道如何通过AIDL接口与它通信。我的问题是,服务似乎仍然运行在相同的过程,像从它开始的活动,因为活动崩溃,如果在服务中引发错误。

I'm trying to understand remote services at the moment and everything works fine, i can start the service and know how to communicate with it through the AIDL-interface. My problem is that the service seems to still run in the same process like the activity it was started from, because the activity crashes too, if there is an error thrown in the Service.

我将服务进程设置为远程(android:process =:remote),所以我做错了什么?

I set the service process to remote ( android:process=":remote" ) so what am i doing wrong? Or what do i have to do to unbind the service-process completely from the activity-process?

推荐答案

发布代码,但如果你从你的Activity开始你的服务,然后他们在同一个进程中运行,你不需要使用AIDL。我发布了一个使用服务在几天前做一些后台工作的例子。

Post the code but if you are starting your service from your Activity, then they are running in the same process and you don't need to use AIDL. I posted an example of using a Service to do some Background work a few days ago.

Restful API服务

这篇关于远程服务崩溃时活动崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆