For the second question, you'll either want to define an abstract action in an intent-filter for the service and use that as the intent you bind to (typically the action is the name of the desired interface for binding to services), or create an explicit ComponentName with the package name + class name of the service being bound to and provide that to the Intent. For this latter, make sure you have set android:exported="true" for the service.
Sorry I can't really help you with the first question, since I don't know ADT that well. Basically you will need to have both applications like the generated aidl code into their app. On Sat, May 16, 2009 at 8:46 AM, dev_rob <[email protected]> wrote: > > Hi android developers, > > I'm new to the great android platform, trying to get into RPC with > aidl and services. > > I didn't find a sufficient answer to my problem in any posts, if there > already is one, please excuse and point me to it, thanks. > > I made 2 projects. > > project 1 hast an activity that binds to a service from project 2 on a > button click (all just for testing). > > 1. issue: > > How can I make project 1 know (import) my TestInterface (from > TestInterface.aidl out of project 2) for usage in: > > "TestInterface mService = (TestInterface) > TestInterface.Stub.asInterface(service);" > > without adding project 2 to the build path, because if I'd have an > installed service without the project code, I couldn't do it this way, > too...?? > I read in one thread that TestInterface.aidl should just be added to > project 1, too, but if I do this, in DDMS enforceInterface() complains > and seems to just see/use the interface from project 1 and it doesn't > work. > > 2. issue: > > (here i add project 2 to project 1's build path, which i still think > is not how it should work) > > If i bind to a system service, i can simply do something like > > bindService(new Intent(com.android.A_SERVICE); > > but if i have my own service in project 2, something like > > bindService(new Intent(com.project2.A_SERVICE); > > does not work (of course, service 2 is installed on the emulator at > that point, i provide an intent-filter an set the "android:exported"- > attribute to true). the error i get is: > > "05-16 15:06:06.384: ERROR/dalvikvm(820): Could not find method > de.roberlin.new_rpc.TestInterface$Stub.asInterface, referenced from > method de.roberlin.new_rpc.New_RPC_Client$2.onServiceConnected > " > > this error makes really no sense to me, any suggestions? > > btw: i ran "adb shell dumpsys package" and my Service is registered: > > "Service Resolver Table: > ... > Non-Data Actions: > ... > de.roberlin.new_rpc.action.NEW_RPC: > 436578f0 de.roberlin.new_rpc/.TestStringService" > > The code from both projects can be reviewed at > http://pastebin.com/f4bd0bc10 > > I hope my points (special concern lies on the error message..) are not > to nooby. > > I'd really appreciate any help! Thanks in advance! > > > > > > > > > > > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

