I'm currently implementing an Android Service which is to be consumed by another application of a partner company. They implement the frontend GUI, we do the business logic inside the Service.
The Service is declared like this:
[Service]
[IntentFilter(new[] { "PsiServiceHost" })]
public class PsiServiceHost : Service
{
...
}
The consuming application (optionally) starts the service and connects to it using this Intent:
serviceIntent = new Intent("PsiServiceHost");
Starting the service using ...
ApplicationContext.StartService(serviceIntent);
... results in the following log output:
08-16 10:38:17.182 3429 3429 W ContextImpl: Implicit intents with startService are not safe: Intent { act=PsiServiceHost } android.content.ContextWrapper.startService:581 md5db25c5914f35662b07cd28205cc94074.MainActivity.n_onCreate:-2 md5db25c5914f35662b07cd28205cc94074.MainActivity.onCreate:29
According to this answer on SO, starting Services using implicit intents is no longer possible even though it works fine in my case on Android 6.0 running on the Emulator.
Anyway, just to be safe I would like to use the recommended approach of constructing my Intent using a ComponentName. This would be no problem for code residing in the same project as the service as I could do this and be done with it:
Java.Lang.Class.FromType(typeof(PsiServiceHost)).CanonicalName
But unless the result from the above line of can be considered to be stable and safe to be included as string in another App, I don't know how provide the consuming App with the component Name of our Service.