All Projects → slm → WebViewNativeBridge

slm / WebViewNativeBridge

Licence: MIT license
WebView bridge for android

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to WebViewNativeBridge

Easybridge
A design of easy js-bridge which provide the ability to communicate between java and javascript.It is based on the android webview's feature [addJavaScriptInterface]
Stars: ✭ 158 (+351.43%)
Mutual labels:  webview
Vscode Kanban
Kanban board for Visual Studio Code.
Stars: ✭ 191 (+445.71%)
Mutual labels:  webview
React Native Webview Messaging
✉️ Send/Receive data between React Native app and WebView
Stars: ✭ 251 (+617.14%)
Mutual labels:  webview
Webviewane
WebView Adobe Air Native Extension for macOS 10.10+, Windows Desktop, iOS 9.0+ and Android 19+. This ANE provides access to a more modern webview from AIR.
Stars: ✭ 169 (+382.86%)
Mutual labels:  webview
React Native Linkedin
🔗 React-Native LinkedIn, a simple LinkedIn login library for React-Native or Expo with WebView and Modal
Stars: ✭ 180 (+414.29%)
Mutual labels:  webview
Tauri
Build smaller, faster, and more secure desktop applications with a web frontend.
Stars: ✭ 25,383 (+72422.86%)
Mutual labels:  webview
Tether
🖥 A barebones Electron-ish library for Rust.
Stars: ✭ 151 (+331.43%)
Mutual labels:  webview
Android-WebView-in-Kotlin
Native Android WebView Example in Kotlin. Website to android app github open source template.
Stars: ✭ 87 (+148.57%)
Mutual labels:  webview
Os Fileup
Helper app to understand how to upload files and do basic image/video processing in hybrid android apps.
Stars: ✭ 190 (+442.86%)
Mutual labels:  webview
Cargo
🚂🚋🚋 A browser with almost no UI.
Stars: ✭ 221 (+531.43%)
Mutual labels:  webview
Slimsocial For Facebook
Light version of Facebook. Light both in the weight and in the use.
Stars: ✭ 171 (+388.57%)
Mutual labels:  webview
React Native Turbolinks
React Native adapter for building hybrid apps with Turbolinks 5
Stars: ✭ 177 (+405.71%)
Mutual labels:  webview
Recaptcha
[In]visible ReCaptcha v2 for iOS
Stars: ✭ 208 (+494.29%)
Mutual labels:  webview
Hybridfoundation
混合应用基础架构 跨平台热更新方案 Js双向通信 基础WebView
Stars: ✭ 164 (+368.57%)
Mutual labels:  webview
qml-webchannel-websockets
QML examples for WebChannel and WebSockets.
Stars: ✭ 26 (-25.71%)
Mutual labels:  webview
Electron Navigation
A Node.js module that adds a navigation interface to Electron which allows you to browse the internet or view local HTML files with tabs and webviews.
Stars: ✭ 156 (+345.71%)
Mutual labels:  webview
Android Youtube Player
YouTube Player library for Android and Chromecast, stable and customizable.
Stars: ✭ 2,510 (+7071.43%)
Mutual labels:  webview
vue-js-bridge
vue-js-bridge for Vue.js
Stars: ✭ 41 (+17.14%)
Mutual labels:  webview
Google-Docs-for-Mac
Native Google Docs app for Mac
Stars: ✭ 33 (-5.71%)
Mutual labels:  webview
React Native Webview Invoke
Invoke functions between React Native and WebView
Stars: ✭ 211 (+502.86%)
Mutual labels:  webview

WebViewNativeBridge

This library allows you to send simple data from WebView to Java. Sends the data via url.

Url Structure

nativebridge://functionName/paramter1/parameter2/parameter3
  • Your urls must be start with nativebridge://
  • Your functionName and parameters must be valid for url standards.
  • If you want to pass url as parameter, you must decode parameter two times.

Examples:

nativebridge://quit  #no parameter
nativebridge://showToast/Toast%20Test! # parameter1 = Toast Test!
nativebridge://showAlertDialog/Alert%20Title/Alert%20Message # parameter1 = Alert Title , parameter2 = Alert Message
nativebridge://goUri/https%253A%252F%252Fgithub.com%252Fslm #parameter1 = https:/github.com/slm | url parameter decoded two times

In Android Usage:

      NativeBridgeBuilder builder = new NativeBridgeBuilder()
                .addFunction("showToast", new OnActionListener() {
                        @Override
                        public void onAction(NativeBridgeFunction function, String... parameters) {
                            Toast.makeText(MainActivity.this,parameters[0],Toast.LENGTH_SHORT).show();
                        }
                })
                .addFunction("quit", new OnActionListener() {
                    @Override
                    public void onAction(NativeBridgeFunction function,String... parameters) {
                        finish();
                    }
                });
      WebViewClient client = builder.buildWebViewClient();
      webView.setWebViewClient(client);

If you use already a custom WebViewClient you can use like that.

...

final NativeBridgeBuilder.SimpleChecker checker =  builder.buildChecker();

#In WebViewClient
             ...
             ...
             @Override
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
                 return checker.check(url);
             }
             ...
             ...

Gradle

Add it in your root build.gradle at the end of repositories:

 	allprojects {
 		  repositories {
 			 ...
 			 maven { url "https://jitpack.io" }
 		 }
 	}

Add the dependency

 	dependencies {
	        compile 'com.github.slmyldz:WebViewNativeBridge:1.0'
	}

License

The MIT License (MIT)
Copyright (c) 2016 Selim YILDIZ

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].