Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid RemoteExceptions and Services
    primarykey
    data
    text
    <p>So I've written a Service and an Activity for the Android OS.</p> <p>My service is running in it's own process, so all the communication between my Activities and the Service happens via IPC. I use the standard Android .aidl mechanism for this. </p> <p>So far everything works fine. However, the AIDL generates all method stubs using "throws RemoteException" so I have to handle them. </p> <p>I did a quick grep on the entire Android source-code and only found three cases where this exception is ever thrown. These are in a different service that I don't connect with.</p> <p>I checked the C-sources as well because in theory RemoteExceptions can be generated using the JNI interface.. Nothing turned up.</p> <p>I have the impression that everyone just handles them like this:</p> <pre><code> try { mService.someMethodCall (someArguments); } catch (RemoteException e) { e.printStackTrace(); } </code></pre> <p>This is not solid code, and I don't want something like this in my code-base. </p> <p>Besides that: I tried to throw a RemoteException via IPC myself and all I got was a stack-trace and a system log message that tells me that exceptions aren't supported yet. My application never saw the exception and the services that threw the exception ended up in a very strange state (halfway working) :-(</p> <p>The questions are:</p> <ul> <li><p>Do these exceptions ever get thrown? </p></li> <li><p>Has anyone ever seen such a try-catch block catching a RemoteException?</p></li> <li><p>Could it be that they don't exist and that we are just forced to deal with them because the "throws RemoteException" is dead code or a left-over inside the AIDL compiler?</p></li> </ul> <p>Disclamer: I haven't read the entire source-code. I used Grep to find the occurrences of RemoteException, so I may have missed some due to different whitespace usage. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload