{"id":13639251,"url":"https://github.com/slm/WebViewNativeBridge","last_synced_at":"2025-04-19T22:32:00.046Z","repository":{"id":74156585,"uuid":"76193422","full_name":"slm/WebViewNativeBridge","owner":"slm","description":"WebView bridge for android","archived":false,"fork":false,"pushed_at":"2018-08-06T02:09:29.000Z","size":94,"stargazers_count":36,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T01:14:13.786Z","etag":null,"topics":["android-library","webview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-11T18:59:43.000Z","updated_at":"2023-10-08T11:31:44.000Z","dependencies_parsed_at":"2024-01-14T11:05:21.189Z","dependency_job_id":"4b130bbb-8b0b-49b3-9872-e7be4e21d2b2","html_url":"https://github.com/slm/WebViewNativeBridge","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slm%2FWebViewNativeBridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slm%2FWebViewNativeBridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slm%2FWebViewNativeBridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slm%2FWebViewNativeBridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slm","download_url":"https://codeload.github.com/slm/WebViewNativeBridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223810327,"owners_count":17206741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-library","webview"],"created_at":"2024-08-02T01:00:59.021Z","updated_at":"2024-11-09T09:30:46.395Z","avatar_url":"https://github.com/slm.png","language":"Java","readme":"# WebViewNativeBridge\n\nThis library allows you to send simple data from WebView to Java. Sends the data via url.\n\n#### Url Structure\n```\nnativebridge://functionName/paramter1/parameter2/parameter3\n```\n* Your urls must be start with nativebridge://\n* Your functionName and parameters must be valid for url standards.\n* If you want to pass url as parameter, you must decode parameter two times.\n\nExamples:\n```\nnativebridge://quit  #no parameter\nnativebridge://showToast/Toast%20Test! # parameter1 = Toast Test!\nnativebridge://showAlertDialog/Alert%20Title/Alert%20Message # parameter1 = Alert Title , parameter2 = Alert Message\nnativebridge://goUri/https%253A%252F%252Fgithub.com%252Fslm #parameter1 = https:/github.com/slm | url parameter decoded two times\n```\n\n#### In Android Usage:\n\n```\n      NativeBridgeBuilder builder = new NativeBridgeBuilder()\n                .addFunction(\"showToast\", new OnActionListener() {\n                        @Override\n                        public void onAction(NativeBridgeFunction function, String... parameters) {\n                            Toast.makeText(MainActivity.this,parameters[0],Toast.LENGTH_SHORT).show();\n                        }\n                })\n                .addFunction(\"quit\", new OnActionListener() {\n                    @Override\n                    public void onAction(NativeBridgeFunction function,String... parameters) {\n                        finish();\n                    }\n                });\n      WebViewClient client = builder.buildWebViewClient();\n      webView.setWebViewClient(client);\n\n```\nIf you use already a custom WebViewClient you can use like that.\n\n```\n...\n\nfinal NativeBridgeBuilder.SimpleChecker checker =  builder.buildChecker();\n\n#In WebViewClient\n             ...\n             ...\n             @Override\n             public boolean shouldOverrideUrlLoading(WebView view, String url) {\n                 return checker.check(url);\n             }\n             ...\n             ...\n\n```\n\n\n### Gradle\nAdd it in your root build.gradle at the end of repositories:\n```\n \tallprojects {\n \t\t  repositories {\n \t\t\t ...\n \t\t\t maven { url \"https://jitpack.io\" }\n \t\t }\n \t}\n```\nAdd the dependency\n```\n \tdependencies {\n\t        compile 'com.github.slmyldz:WebViewNativeBridge:1.0'\n\t}\n```\n\n#### License\n```\nThe MIT License (MIT)\nCopyright (c) 2016 Selim YILDIZ\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n\n```\n\n","funding_links":[],"categories":["WebView","Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslm%2FWebViewNativeBridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslm%2FWebViewNativeBridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslm%2FWebViewNativeBridge/lists"}