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?
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?