chromeview icon indicating copy to clipboard operation
chromeview copied to clipboard

Cordova/Phonegap integration

Open gen-failure opened this issue 11 years ago • 5 comments

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

gen-failure avatar Jul 05 '13 02:07 gen-failure

+1

kevin-smets avatar Jul 30 '13 10:07 kevin-smets

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

vzaidman avatar Aug 08 '13 09:08 vzaidman

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?

Spittal avatar Aug 23 '13 06:08 Spittal

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

kevin-smets avatar Aug 23 '13 06:08 kevin-smets

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.

Spittal avatar Aug 24 '13 18:08 Spittal