I believe you should always code Service.onBind to return an IBinder object. But, yes, you can create some public methods in your service to check things out. You'll call those methods on mBoundService after it's been set. Notice in the example the service is cast to a LocalService instance (see below).
It's safe to do that because when you unbind the service it can go away. http://developer.android.com/reference/android/app/Service.html public void onServiceConnected(ComponentName className, IBinder service) { // This is called when the connection with the service has been // established, giving us the service object we can use to // interact with the service. Because we have bound to a explicit // service that we know is running in our own process, we can // cast its IBinder to a concrete class and directly access it. *mBoundService* = ((LocalService.LocalBinder)service).getService(); // Tell the user about this for our demo. Toast.makeText(Binding.this, R.string.local_service_connected, Toast.LENGTH_SHORT).show(); } What On Sunday, October 6, 2013 10:03:25 AM UTC-7, bsd_mike wrote: > > I have an activity that binds to an AIDL service. > > The way the AIDL service is constructed, sometimes a IBinder is never > returned.. > When that happens onServiceConnected is not called. Seems obvious. > > But is there a way to detect that has happened? Is there another > callback I am missing? > > Or is it better to always return a IBinder and give the user a method to > determine if things on the service end are messed up. > > Otherwise the activity sits their happily for something that never arrives. > > Thank you. > -Mike > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

