I need to specify my login activity with intent filter:
<activity
android:name=".view.LoginActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.example.sdk.LOGIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
The reason why I want to do it that way is that I am developing an SDK that I want to use in few projects and this is the best way I could figure out of how to notify the SDK which is the login activity, while it is defined only in the app module.
After I do such declaration I start the login activity like so (both in library and app):
Intent intent = new Intent();
intent.setAction("com.example.sdk.LOGIN");
context.startActivity(intent);
There is the possibility that two or more applications relying on the same SDK will be installed simultaneously on the same device. If I get it correctly, in such case in each of these applications the Activity start will launch a random login activity (with the possibility of the call in application A launching the login of application B).
- Am I correct in my understanding of how custom intent filters work?
- Is there a way to tell the call in application A to use only intent filter declarations in application A
Suggestions of alternative approaches to reusing the login-related logic, not relying on intent filters are also welcome.