I've implemented this solution to start a specified Activity from a web browser.
The official Android docs only talk about Activity's as well.
However, the requests are growing and depending on the request, a different Activity needs to be started. I was thinking of an IntentService
that figures out what message and based on that, starts a specified Activity
. What is the correct way to implement this? Because I tried an IntentService
and it doesn't get triggered:
public class APIService extends IntentService {
public APIService(String name) {
super(name);
}
public APIService() {
super("");
}
@Override
public void onCreate() {
super.onCreate();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
Log.d(TAG, "onBind: ");
return null;
}
@Override
protected void onHandleIntent(Intent intent) {
Log.d(TAG, "onBind: ");
}
}
But this solution does not trigger the App anymore.
<service
android:name=".services.APIService"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="qkey"/>
</intent-filter>
</service>