avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
563 stars 291 forks source link

Chrome OS #19

Open jmoseley opened 5 years ago

jmoseley commented 5 years ago

I'm using https scheme and am testing on my Google Pixelbook, which is running Chrome OS v73.0.3683.88.

I am unable to get the app to open in response to a link when it is running on Chrome OS.

I'm not sure this issue necessarily falls in the scope of this library, but I imagine it is not super hard to fix. I have found what I think is a related issue for React Native, but I am new to developing Android apps, so at the moment I am not able to figure out the right way to trigger/handle the intent.

jmoseley commented 5 years ago

For anyone else coming into this thread, I fixed it the same as the linked issue, by adding the following overrides to MainActivity in MainActivity.java:

    @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);
        }
    }