[android-developers] Re: Access a Service across multiple Applications

2010-04-20 Thread madmax
Thanks a lot Mark! And sorry about the package thingy... Since the
names were the same i thought they were the same packages. Making a
new package with the SAME NAME as the AIDL was in in the previous
application and copying the AIDL file in to that package solves the
problem. Thanks again for the help.

  Cheers!
   Prafull.

On Apr 20, 4:50 pm, Mark Murphy  wrote:
> madmax wrote:
> > The interface (AIDL) for
> > communication between the activity and theserviceis defined in
> > another package in another application. How can i now access this SAME
> > interface for communicating with theservicefrom my new application?
>
> You copy the AIDL file, put it in the same package as in the old
> project, and use it in your new project. In the links I provided
> earlier, you will see that the IScript AIDL file resides in both projects.
>
> > Here Mark has given some examples, but am not very clear as to how the
> > same interface will be used "across"applications. The examples above
> > have the client in another package and theservicein the other but
> > both packages in the SAME application.
>
> No, they don't. They are two separate Androidapplications, with two
> separate APK files, two separate manifests, two separate source trees,
> and two separate copies of the same AIDL file in the same package.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.0
> Available!
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Access a Service across multiple Applications

2010-04-20 Thread Mark Murphy
madmax wrote:
> The interface (AIDL) for
> communication between the activity and the service is defined in
> another package in another application. How can i now access this SAME
> interface for communicating with the service from my new application?

You copy the AIDL file, put it in the same package as in the old
project, and use it in your new project. In the links I provided
earlier, you will see that the IScript AIDL file resides in both projects.

> Here Mark has given some examples, but am not very clear as to how the
> same interface will be used "across" applications. The examples above
> have the client in another package and the service in the other but
> both packages in the SAME application.

No, they don't. They are two separate Android applications, with two
separate APK files, two separate manifests, two separate source trees,
and two separate copies of the same AIDL file in the same package.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.0
Available!

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


[android-developers] Re: Access a Service across multiple Applications

2010-04-20 Thread madmax
Hi,
   A li'l update since the last post, the problem regarding the
SecurityException is now resolved(i had to put intent-filters in the
manifest where the Service was defined) but now another problem
regarding the interface has risen. The interface (AIDL) for
communication between the activity and the service is defined in
another package in another application. How can i now access this SAME
interface for communicating with the service from my new application?
Any pointers? I searched through the forum and found this thread
http://groups.google.com/group/android-developers/browse_thread/thread/71ebbb00d6e2b67c/814f65ba19b5e33e?lnk=gst&q=unable+to+bind+to+a+service#814f65ba19b5e33e

Here Mark has given some examples, but am not very clear as to how the
same interface will be used "across" applications. The examples above
have the client in another package and the service in the other but
both packages in the SAME application. I also understand having access
to the service across applications the way i want poses a huge
security risk but we intend to build a very robust design to counter
those security threats.

   Thanks,
   Prafull.

On Apr 20, 11:34 am, madmax  wrote:
> Hi,
>     I have been trying out the same things that you mentioned in your
> post. I've created aservicefrom an application and on the
> "onDestroy()" of that application i'm "unbinding" theservice. Now
> when i want to "bind" to the sameservicefrom another application, i
> get a SecurityException. The actual error log is as below.
>
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228): Caused by:
> java.lang.SecurityException: Not allowed to bind toserviceIntent
> { cmp=aexp.dualservice/.DualService }
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> android.app.ApplicationContext.bindService(ApplicationContext.java:
> 807)
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> android.content.ContextWrapper.bindService(ContextWrapper.java:337)
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> com.vignet.serviceDemo1.ConnectToService.initService(ConnectToService.java:
> 48)
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> com.vignet.serviceDemo1.ConnectToService.onCreate(ConnectToService.java:
> 35)
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1047)
> 04-20 11:38:40.231: ERROR/AndroidRuntime(228):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2459)
>
> Is it because while defining myservicei have given the package name
> of that application and now when i'm trying to "bind" to theservice
> from another app. its giving me a SecurityException that i'maccessing
> something from another package altogether?
>
>  Thanks,
>   Prafull.
>
> On Apr 19, 9:12 pm, Mark Murphy  wrote:
>
>
>
>
>
> > madmax wrote:
> > > Hey Folks,
> > >                  I have aservicethat i need to accessacross
> > >multipleApplications. Can anyone tell me how this can be done?
>
> > Create a remoteserviceand expose an interface through AIDL. Here is a
> > pair of sampleapplicationsdemonstrating the technique:
>
> >http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/Re..
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Development Wiki:http://wiki.andmob.org
>
> > --
> > 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 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Access a Service across multiple Applications

2010-04-19 Thread madmax
Hi,
I have been trying out the same things that you mentioned in your
post. I've created a service from an application and on the
"onDestroy()" of that application i'm "unbinding" the service. Now
when i want to "bind" to the same service from another application, i
get a SecurityException. The actual error log is as below.

04-20 11:38:40.231: ERROR/AndroidRuntime(228): Caused by:
java.lang.SecurityException: Not allowed to bind to service Intent
{ cmp=aexp.dualservice/.DualService }
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
android.app.ApplicationContext.bindService(ApplicationContext.java:
807)
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
android.content.ContextWrapper.bindService(ContextWrapper.java:337)
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
com.vignet.serviceDemo1.ConnectToService.initService(ConnectToService.java:
48)
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
com.vignet.serviceDemo1.ConnectToService.onCreate(ConnectToService.java:
35)
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
04-20 11:38:40.231: ERROR/AndroidRuntime(228): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)


Is it because while defining my service i have given the package name
of that application and now when i'm trying to "bind" to the service
from another app. its giving me a SecurityException that i'm accessing
something from another package altogether?


 Thanks,
  Prafull.

On Apr 19, 9:12 pm, Mark Murphy  wrote:
> madmax wrote:
> > Hey Folks,
> >                  I have aservicethat i need to accessacross
> >multipleApplications. Can anyone tell me how this can be done?
>
> Create a remoteserviceand expose an interface through AIDL. Here is a
> pair of sampleapplicationsdemonstrating the technique:
>
> http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/Re...http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/Re...
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Development Wiki:http://wiki.andmob.org
>
> --
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

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