0

I am trying to make a request to another service (another app), but getting exception:

java.lang.IllegalArgumentException: 
Service Intent must be explicit: Intent { act=com.myApp.DoAction }

I did some readings and still confused:
Here, it's written: Since Android 5.0 (Lollipop) bindService() must always be called with an explicit intent.
Here, it's written: Implicit intents do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it

What will be the right intent? What will be the right example? I am doing:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setAction("com.anotherApp.MyService");
// binding to remote service
bindService(intent, AddServiceConnection, Service.BIND_AUTO_CREATE);

Many many thanks for help.

Community
  • 1
  • 1
Tigran
  • 1,049
  • 3
  • 15
  • 31

2 Answers2

1

I believe that this Intent intent = new Intent(Intent.ACTION_SEND);

line of code says that intent action is implicit. It declares intent with abstract SEND action. try removing Intent.ACTION_SEND

0

After trying some tutorials: Intent is implicit and this nice example shows how to deal with it

Intent intent = new Intent("com.anotherapp.MyService");
intent.setPackage("com.anotherapp");
bindService(intent, AddServiceConnection, Service.BIND_AUTO_CREATE);
Tigran
  • 1,049
  • 3
  • 15
  • 31