You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Capacitor's App plugin's deep linking with appUrlOpen events works well for standard Android, but it seems the addListener appURLOpen event is never triggered when the Android app is running on Chromebook. This was causing issues for some deep linking flows where our user authenticates through OAuth using a Browser.open() flow, which on completion returns the user to the app through an app link (com.domain.app://etc).
The root cause is that Android Chromebook app links trigger an intent of org.chromium.arc.intent.action.VIEW instead of the standard Intent.ACTION_VIEW. This causes the AppPlugin's handleOnNewIntent function to ignore the intent, see AppPlugin.java L126:
Capacitor App plugin could be extended to handle org.chromium.arc.intent.action.VIEW intents
Override MainActivity onNewIntent() and getIntent() to convert org.chromium.arc.intent.action.VIEW intents into standard ACTION_VIEW intents
Current Workaround
We've done option 2 with the below overrides in our app's MainActivity.java and it's working well. It would be nice to see either of the above options in a future Capacitor update. In any case, I wanted to share this workaround for anyone else trying to do deep linking for Android Chromebook users.
@Override
public Intent getIntent() {
Intent intent = super.getIntent();
if (intent!=null && intent.getAction().equals("org.chromium.arc.intent.action.VIEW")) {
return new Intent(intent).setAction(Intent.ACTION_VIEW);
}
return intent;
}
@Override
public void onNewIntent(Intent intent) {
if (intent!=null && intent.getAction().equals("org.chromium.arc.intent.action.VIEW")) {
super.onNewIntent(new Intent(intent).setAction(Intent.ACTION_VIEW));
} else {
super.onNewIntent(intent);
}
}
Additional Details
These results are on a Lenovo Chromebook Duet, Chrome OS 120, Android version 11 and Capacitor Android 5.0.7.
The text was updated successfully, but these errors were encountered:
Feature Request
Capacitor's App plugin's deep linking with
appUrlOpen
events works well for standard Android, but it seems the addListener appURLOpen event is never triggered when the Android app is running on Chromebook. This was causing issues for some deep linking flows where our user authenticates through OAuth using a Browser.open() flow, which on completion returns the user to the app through an app link (com.domain.app://etc).The root cause is that Android Chromebook app links trigger an intent of
org.chromium.arc.intent.action.VIEW
instead of the standardIntent.ACTION_VIEW
. This causes the AppPlugin'shandleOnNewIntent
function to ignore the intent, see AppPlugin.java L126:capacitor-plugins/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java
Line 126 in 0ccb9c4
There's some great background and a MainActivity.java workaround for this at facebook/react-native#20301.
Possible Solutions
Current Workaround
We've done option 2 with the below overrides in our app's MainActivity.java and it's working well. It would be nice to see either of the above options in a future Capacitor update. In any case, I wanted to share this workaround for anyone else trying to do deep linking for Android Chromebook users.
Additional Details
These results are on a Lenovo Chromebook Duet, Chrome OS 120, Android version 11 and Capacitor Android 5.0.7.
The text was updated successfully, but these errors were encountered: