Dale,

Here is a few ideas:

- A service-specific singleton *should* work, along the lines of setting a static to "this" in the service's onCreate or onBind and resetting to null in onDestroy.

- You could add a method in the primary AIDL interface that obtains the administration interface. The service's implementation of the primary AIDL interface would check who's calling the method (e.g. with getCallingUid) before returning either the administration interface or null.

- The above could probably be implemented by leveraging IBinder.queryLocalInterface.

- You could implement the management interface (which supposedly only has a few methods, like stop/getState/getOption/setOption) by means other than AIDL. For example, startService with specific intents, or custom command values for IBinder.transact().

- For the latter, IBinder defines a constant, LAST_CALL_TRANSACTION, as "The last transaction code available for user commands", so it seems like it's a valid use case for IBinder.

-- Kostya

28.01.2011 13:44, Dale Harvey пишет:
onBind only gets called once when the service is started, subsequent
bindServices reuse the same IBinder

This isnt particularly well documented, but confirmed after numerous
attempts to debug and
http://groups.google.com/group/android-developers/browse_thread/thread/d887a04a0b46c721/475755b074aa8a4e?show_docid=475755b074aa8a4e

On Jan 27, 7:49 pm, Mark Murphy<mmur...@commonsware.com>  wrote:
Use two different AIDL files and two different binders returned by
onBind(). Use something in the Intent (e.g., custom action) to
distinguish which one to return for a given bind request.



On Wed, Jan 26, 2011 at 12:39 AM, Dale Harvey<d...@arandomurl.com>  wrote:
I have an application that provides a remoteService that is defined
through an .aidl generated interface, this all works great, completely
seperate applications just need to bundle the .aidl and they can
control the service in a specific way
However I want the sevice to provide an extra API when it is bound to
the application that it ships with, which is an administrative
interface.
The administrative interface still needs to perform the usual
bidirectional communication that remoteService lets me use but with
additional calls in the api that arent provided to other packages
Since the service and activity that starts it are in the same package
I have tried various setups of singletons and static interfaces to no
avail (there is state involved so a pure static interface isnt enough)
however none of these have worked, I can get round it with various
nasty ways through Application variables / talk through the filesystem
however I was wondering if it was possible in a cleaner way.
Thanks
Dale Harvey
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Mark Murphy (a Commons 
Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

Android Training in London:http://bit.ly/smand1andhttp://bit.ly/smand2


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to