pwnall / chromeview

Proof of concept Android WebView implementation based on Chromium code
1.69k stars 435 forks source link

Cordova/Phonegap integration #14

Open gen-failure opened 10 years ago

gen-failure commented 10 years ago

Hi,

I am really curious, this project looks great. Did you try to replace webview in phonegap apps with chromeview? Any ideas?

Thank for your answer

Michael

kevin-smets commented 10 years ago

+1

vzaidman commented 10 years ago

check this out: https://github.com/thedracle/cordova-android-chromeview

Spittal commented 10 years ago

Hey,

I'm fairly new to Android, but am I able to reference chromeview in a phonegap project that's already built with phonegap 3.0.0?

For Example:

Can I initialize it then replace the current super.loadUrl that Phonegap makes in the main class (well the only class in the project, I assume I initialize Chromeview this in the same method as onCreate is called) with chromeview.loadUrl?

kevin-smets commented 10 years ago

Here's my onCreate, the Toast is entirely optional of course.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chromeview);
        chromeView = (ChromeView)findViewById(R.id.chrome_view);
        chromeView.getSettings().setJavaScriptEnabled(true);
        preferences = PreferenceManager.getDefaultSharedPreferences(this); 
        preferences.registerOnSharedPreferenceChangeListener(spChangedMain);  
        String url = preferences.getString("pref_Urlkey", "file:///android_asset/www/index.html");
        Toast.makeText(MainActivity.this, "URL to display: " + url, Toast.LENGTH_SHORT).show();
        chromeView.loadUrl(url);
    }
Spittal commented 10 years ago

That's awesome, just for a quick reference are you able to post your layout XML file? I can't seem to get the chromeview loading in the palette so I'm just curious how to correctly format the view.