Binding to the service by applicationId

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

I have 2 applications: a client application and a server application. The server application contains the service to which the client is bound. Here's how the binding happens:

Intent start = new Intent("com.example.myservice.ACTION_BIND");
start.setPackage("com.example.myservice");
startService(start);
bindService(start, mConnection, Context.BIND_AUTO_CREATE);

Everything worked fine until I needed to add productFlavors to the server application. In productFlavors, I changed the applicationId and after that the client application stopped binding to the server application.

<service
android:name=".service.MyService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="${applicationId}.ACTION_BIND" />
</intent-filter>
</service>

The client application does not know with what ${applicationId} the server application is installed.

How can I get the applicationId of the server application programmatically? Or how else can I solve this problem?
 
I moved this to the Software Development forum for more specific traffic.
 

Latest posts

Trending Posts

Members online

No members online now.

Forum statistics

Threads
958,573
Messages
6,977,149
Members
3,164,100
Latest member
britnroberts2018