0

My android app opens a Webview and run html and JavaScript from the server. The JavaScript creates a data and I want to save the data as a file in the assets folder of my app. Is this possible? and How?

John Kim
  • 1
  • 1
  • 1
    Your android app can communicate with the webview. Which means you can call a function that is [injected into the webview's page](https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String)) and pass your text, then grab the passed text in your android app and save it. –  Sep 16 '21 at 10:11
  • 1
    Duplicate: [Passing data from java class to Web View html](https://stackoverflow.com/questions/11752052/passing-data-from-java-class-to-web-view-html) –  Sep 16 '21 at 10:13
  • 1
    Hi Chris, as you said, addJavascriptInterface seems to be the right way. Thanks a lot for your help. – John Kim Sep 19 '21 at 06:34

0 Answers0