0

I am using this example to lean about AIDL:

https://github.com/xamarin/monodroid-samples/tree/master/AIDLDemo/AIDLDemo

The example is fairly simple, and it runs on Android 4.4, but I must run it on Android 9+. So I modified it a little.

For example, the addition of the package name to the intent for the BindingService in Activity1.cs:

private void InitService ()
{
    _serviceConnection = new AdditionServiceConnection (this);
    var additionServiceIntent = new Intent ("com.xamarin.additionservice");
    additionServiceIntent.SetPackage("AIDLDemo.AIDLDemo");      //<--------------- Added it
    _serviceConnection = new AdditionServiceConnection (this);
    ApplicationContext.BindService (additionServiceIntent, _serviceConnection, Bind.AutoCreate);
    Log.Debug (Tag, "Service initialized");
}

I want to add some attributes to the service:

In AndroidService.cs class, there were no attributes for the Service, I added the following:

[Service(Name = "Xamarin.AidlDemo.AdditionService", 
        Exported = true, 
        Enabled = true, 
        Process = ":mf_background_process")]

But, once I add the last attribute, Process, the app won't work anymore, it throws the following error:

The AdditionService is not bound

It is an error caught in the Activity1.cs class, while checking if the binding was successful. This is caused because I added the Process attribute in the Service.

Can you help me solve this issue? Why won't the service bind anymore while it's in another thread?

Thank you for your time.

Shalu T D
  • 3,921
  • 2
  • 26
  • 37
Elydasian
  • 2,016
  • 5
  • 23
  • 41
  • As i know in Android 8 and higher you suppose to create a notification for user if your app works in background – Alex Rmcf Jun 26 '20 at 11:40
  • aee....that would be a problem for me, bc I work on an Android TV, where is much more difficult to generate a notification, as opposed to a Mobile phone. Are you sure, those things r connected? – Elydasian Jun 26 '20 at 11:45

0 Answers0