The file name doesn't matter, is completely irrelevant, and ignored.  The
identity of your app is the package name you declare in the manifest.  As I
said, you need to give them different package names for them to actually be
different apps.

On Fri, May 22, 2009 at 1:25 AM, dev_rob <[email protected]> wrote:

>
> I am still hanging on this issue,
>
> maybe there is someone, who has played around with service and can
> provide me some example code, where it works that a service, lying in
> one eclipse project is successfully bound to and called maybe by an
> activity, which resides lying in another eclipse project??
>
> I hope that I can figure out, what I'm doing wrong by comparison then.
>
> You can contact me directly, if you don't want to post any example
> code here..
>
> I'd really appreciate any help, cause I am really stuck, thank you so
> much in advance!
>
> regards
>
> On 18 Mai, 09:00, dev_rob <[email protected]> wrote:
> > Hey Dianne,
> >
> > thanks a lot for your answer.
> >
> > The package names are the same, but not the app-names.
> >
> > The .apks are called
> >
> > New_RPC_Client.apk
> >
> > and
> >
> > New_RPC_Server.apk
> >
> > inside both apks thenamespace/package name is
> >
> > de.roberlin.new_rpc
> >
> > This is the same in both apps, because the package has to be declared
> > in TestInterface.aidl, which resides in both projects.
> >
> > I wondered, if those namespaces can be the reason for the fact, that
> > the system cannot find theserviceanymore, when I execute the
> > client??
> >
> > When I execute theservicefirst it gets correctly installed as
> >
> >  "ServiceResolver Table:
> >   Non-Data Actions:
> >       ...
> >       de.roberlin.new_rpc.TestStringService:
> >         43731670 de.roberlin.new_rpc/.TestStringService"
> >
> > To be clear on that, here are both manifest-files:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> >       package="de.roberlin.new_rpc"
> >       android:versionCode="1"
> >       android:versionName="1.0">
> >     <application android:icon="@drawable/icon" android:label="@string/
> > app_name">
> >         <activity android:name=".New_RPC_Client"
> >                   android:label="@string/app_name">
> >             <intent-filter>
> >                 <action android:name="android.intent.action.MAIN" />
> >                 <category
> > android:name="android.intent.category.LAUNCHER" />
> >             </intent-filter>
> >         </activity>
> >     </application>
> >     <uses-sdk android:minSdkVersion="3" />
> > </manifest>
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> >       package="de.roberlin.new_rpc"
> >       android:versionCode="1"
> >       android:versionName="1.0">
> >     <application android:icon="@drawable/icon" android:label="@string/
> > app_name">
> >         <serviceandroid:name=".TestStringService"
> >             android:exported="true"
> >             android:process=":remote">
> >             <intent-filter >
> >                 <action
> > android:name="de.roberlin.new_rpc.TestStringService"/>
> >             </intent-filter>
> >         </service>
> >     </application>
> >     <uses-sdk android:minSdkVersion="3" />
> > </manifest>
> >
> > Then I execute the Client app, in which I try to bind to theService
> > with
> >
> > "String intentAction = "de.roberlin.new_rpc.TestStringService";
> >                 Intent iService = new Intent(intentAction);
> >                 bindService(iService, myService,
> > Context.BIND_AUTO_CREATE);"
> >
> > but it only leads to DDSM telling me
> >
> > "05-18 06:46:00.623: WARN/ActivityManager(567): Unable to
> startserviceIntent { action=de.roberlin.new_rpc.TestStringService }: not
> > found"
> >
> > But as it was registered correctly, it should be found here?!
> >
> > And if I do  "adb shell dumpsys package" now again, it does not list
> > theserviceanymore as described...
> >
> > Is there any hint for this behaviour and how to solve this?!
> >
> > Can thenamespace"de.roberlin.new_rpc" in both apps (even if the app-
> > names are different) be an issue? as theservicecallcomes from
> > inside the client app, maybe it just looks there under
> > "de.roberlin.new_rpc" for theservice? if so, how can I put
> > TestInterface.aidlin both projects without having the same
> > "de.roberlin.new_rpc" in both projects?
> >
> > Thanks again for any pointers!
> >
> > On 18 Mai, 04:19, Dianne Hackborn <[email protected]> wrote:
> >
> > > If you have give the .apks the same name, you can't have them both
> installed
> > > at the same time, because they are both effectively the same app.
> >
> > > You can have classes in whatevernamespaceyou want inside of the .apk
> (and
> > > even publish these in the manifest via fully qualified class names).
> >
> > > On Sun, May 17, 2009 at 8:37 AM, dev_rob <[email protected]>
> wrote:
> >
> > > > I think it's rather a problem with namespaces. And the package names
> > > > in both projects are indeed identical!
> >
> > > > But as (one of my original questions) both projects have to contain
> > > > the TestInterface.aidlthe package names must be the same, because
> > > > otherwise there is a different package name in TestInterface.aidland
> > > > then it's not the same interface anymore and enforceInterface()
> > > > complains about that...
> >
> > > > If you have a suggestion for this issue, it would be great (I guess
> > > > there is a simple solution for this)! I could see then, if that has
> > > > something to do with the fact, that theserviceseems not to be
> > > > registered after executing the calling activity (project 1).
> >
> > > > Thanks again!
> >
> > > > On 17 Mai, 17:21, Dianne Hackborn <[email protected]> wrote:
> > > > > Er... you are sure that both .apks have different package names?
>  Anyway
> > > > it
> > > > > sounds like whatever problem you have has nothing to do with
> services
> > > > > themselves, but just getting both apps installed at the same time?
> >
> > > > > On Sun, May 17, 2009 at 7:35 AM, dev_rob <
> [email protected]>
> > > > wrote:
> >
> > > > > > I now have the TestInterface.aidlin both eclipse projects and
> project
> > > > > > 2 (theserviceproject) is added to project 1's build path.
> >
> > > > > > I declared theservicein the manifest-file with:
> >
> > > > > > <serviceandroid:name=".TestStringService"
> > > > > >        android:exported="true"
> > > > > >        android:process=":remote">
> > > > > >        <intent-filter >
> > > > > >                <action
> > > > android:name="de.roberlin.new_rpc.action.NEW_RPC"/>
> > > > > >        </intent-filter>
> > > > > > </service>
> >
> > > > > > and "adb shell dumpsys package" shows it successfully registered
> to
> > > > > > the emulator.
> >
> > > > > > I try to bind to theservicewith:
> >
> > > > > > "String intentAction = "de.roberlin.new_rpc.action.NEW_RPC";
> > > > > >                        Intent iService = new
> Intent(intentAction);
> > > > > > bindService(iService, myService, Context.BIND_AUTO_CREATE);
> >
> > > > > > DDMS won't stop telling me:
> >
> > > > > > "05-17 14:14:34.285: WARN/ActivityManager(567): Unable to start
> > > > > >serviceIntent { action=de.roberlin.new_rpc.action.NEW_RPC }: not
> > > > > > found"
> >
> > > > > > In fact, after running project 1 (the activity binding to
> theservice)
> > > > > > and getting the error message, when I do
> >
> > > > > > "adb shell dumpsys package"
> >
> > > > > > again, it does not list myserviceanymore. how can this be???
> >
> > > > > > the steps were:
> >
> > > > > > 1.) installing theserviceonto a new emulator ("adb shell dumpsys
> > > > > > package" lists it then correctly)
> >
> > > > > > 2.) installing/running project 1 (leads to the error message
> above)
> >
> > > > > > 3.) now "adb shell dumpsys package" does not list
> theserviceanymore.
> > > > > > even if i reinstall it, it won't be listed anymore until I start
> a new
> > > > > > emulator and intall it freshly.
> >
> > > > > > I really do not know, how to deal with this and would be really
> > > > > > thankful for any help!!
> >
> > > > > > best regards!
> >
> > > > > > On 17 Mai, 08:25, Dianne Hackborn <[email protected]> wrote:
> > > > > > > For the secondquestion, you'll either want to define an
> abstract
> > > > action
> > > > > > in
> > > > > > > an intent-filter for theserviceand 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 theservicebeing 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 firstquestion, since I
> don't
> > > > know
> > > > > > > ADT that well.  Basically you will need to have both
> applications
> > > > like
> > > > > > the
> > > > > > > generatedaidlcode 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
> > > > > > > >aidland 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 aservicefrom project
> 2
> > > > on a
> > > > > > > > button click (all just for testing).
> >
> > > > > > > > 1. issue:
> >
> > > > > > > > How can I make project 1 know (import) my TestInterface (from
> > > > > > > > TestInterface.aidlout 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
> > > > > > > > installedservicewithout the project code, I couldn't do it
> this
> > > > way,
> > > > > > > > too...??
> > > > > > > > I read in one thread that TestInterface.aidlshould 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 systemservice, i can simply do something like
> >
> > > > > > > > bindService(new Intent(com.android.A_SERVICE);
> >
> > > > > > > > but if i have my ownservicein project 2, something like
> >
> > > > > > > > bindService(new Intent(com.project2.A_SERVICE);
> >
> > > > > > > > does not work (of course,service2 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
> >
> > ...
> >
> > Erfahren Sie mehr ยป
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to