I have seen some examples of starting a Service from an Activity and passing data to the Service via Intent. However this seems to imply that you have the Service class or that they are in the same language since you have to start the service from the Activity. I am wondering if it is possible to start a Service that is written in Java from an Activity that is written with C# (Xamarin)? Or if it is possible to send the Intent to the Java service from the Xamarin Activity?
Please read this.
In the Intent
:
Intent intent = new Intent(); intent.setComponent(new ComponentName("The package name of the activity that you wish to launch","Its fully qualified class name")); startActivityForResult(intent);
Use setComponent
to decide which component will be fired.
Answers
If I am right, you want to use an Activity (C#) to start a Service (Java) and pass data.
If you want to do this, you need put them into different project C# and Java. We can't use java in a C# project. But you can start AppB's Service in AppA.
Thanks for the reply? Do you know of any code samples that show this? I'm not sure how you are supposed to reference AppB that is in a separate project from AppA.
Please read this.
In the
Intent
:Use
setComponent
to decide which component will be fired.