On Nov 24, 2011, at 9:50 AM, Venky wrote:
> I search a lot and found this example.
> http://stackoverflow.com/questions/6365273/monodroid-for-android-service
> 
> How can another apk consume the music service?

Depends on how, exactly, you want to consume the Service. For the sample code 
at [0], you can use strings instead of `typeof` in the `new Intent(...)` call, 
which will allow you to start and stop Services located in a different .apk.

If you want to do anything with that Service...things get more interesting. You 
can subclass existing services such as SpellCheckerService [1], which would 
allow other apps to communicate through predefined interfaces (e.g. 
ISpellCheckerSessionListener [2, 3]. If you need to use a new interface, then  
you're entering the world of AIDL, for which there is currently no C# support. 
To use AIDL, you'll need to include the .java sources into your project (Build 
action: AndroidJavaSource) and you may need to write some custom Java "glue" 
code to facilitate things.

 - Jon

[0] 
https://github.com/gshackles/Sample-Projects/blob/master/MonoDroid/MonoDroidSamples/MonoDroidSamples/DemoActivities/Services/ServiceActivity.cs

[1] 
http://androidapi.xamarin.com/?link=T:Android.Service.Textservice.SpellCheckerService

[2] 
http://androidapi.xamarin.com/?link=T%3aAndroid.Views.TextService.SpellCheckerSession.ISpellCheckerSessionListener

[3] 
http://developer.android.com/resources/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.html

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to