Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to make it work under Crosswalk webview #1

Open
renandecarlo opened this issue Nov 17, 2014 · 8 comments
Open

Trying to make it work under Crosswalk webview #1

renandecarlo opened this issue Nov 17, 2014 · 8 comments

Comments

@renandecarlo
Copy link

I have little knowledge to native Java itself. I'm trying to make this plugin work with Cordova + Crosswalk, can you help me out? I think it's a 1-2 line thing, but I've no idea where could it be.

@Shilo
Copy link

Shilo commented Feb 6, 2015

It also doesn't work for me with Ionic (which uses Crosswalk). I am not sure if the issue is due to Crosswalk though.

@renandecarlo
Copy link
Author

I've contacted this plugin's developer, and it seems he couldn't get Crosswalk to work under his Linux machine. I think he was trying to use Crosswalk itself, instead of Crosswalk for Cordova.

Anyway, I found this plugin which does similar to Cordova, but it works with Cordova plugins. Haven't tested it yet, but it's worth a shot: http://plugins.cordova.io/#/package/com.ludei.webview.plus

Let me know if you have any update.

@Shilo
Copy link

Shilo commented Feb 6, 2015

@renandecarlo Thank you for the reply. That looks like a great plugin, but I will continue to use Crosswalk with Ionic. I will keep you updated if I get this plugin to work, or if I create my own.

@renandecarlo
Copy link
Author

Did you get it to work @Shilo?

@Shilo
Copy link

Shilo commented Feb 24, 2015

@renandecarlo Sorry, no updates. I haven't had a need to implement this feature, so I haven't done any future testing.

I also believe I was wrong in my previous post. I don't think Ionic uses Crosswalk by default unless I enable it, since the feature is still in beta. So maybe the problem isn't linked to Crosswalk, in my case.

@renandecarlo
Copy link
Author

Right, thanks.

@Psiloscop
Copy link

Any updates?

@ragcsalo
Copy link

ragcsalo commented Apr 17, 2018

To detect and process volume button presses, I use this code in MainActivity.java:

import android.view.KeyEvent;

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');");
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
            this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');");
            return true;
        }
    }

Then I listen for volume button presses with this Javascript code:

document.addEventListener("volumeupbutton", function (e) {e.preventDefault(); volButtonUp();}, false);  
document.addEventListener("volumedownbutton", function (e) {e.preventDefault(); volButtonDown();}, false);

This also works with Crosswalk perfectly. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants