How to enable Google Translate in WebView Android App - android

I am working on a website to simply convert it into the android app using a WebView. The website has Google Translation and I want to achieve this functionality in the android WebView app.
I have searched a lot about this but did not find a proper solution. I have enabled JavaScript, below is the code:
binding.tland.getSettings().setJavaScriptEnabled(true);
binding.tland.getSettings().setLoadWithOverviewMode(true);
binding.tland.getSettings().setUseWideViewPort(true);
binding.tland.getSettings().setDomStorageEnabled(true);
binding.tland.getSettings().setLoadsImagesAutomatically(true);
The Google Chrome App is doing what exactly I want.

you can try to use Google custom Chome tab instead of WebView when you want to have the same Google Translate feature for specific web url.
The tutorial is here: https://developer.chrome.com/docs/android/custom-tabs/integration-guide/

Related

How can I make a PWA application access other native app?

I am creating a PWA application running on both iOS and Android. There is a requirement on the app to support navigation. I know it is hard to support the navigation on a PWA app what I want to achieve is that to popup a dialog to ask users to open a native app for navigation such as google map or apple map etc. How can I do that through PWA application?
Another use case is that how I can pass additional information to the native app? For example, I create a native app and want it to be open from a PWA app. How can PWA app open my native app and pass a json data.
For opening native maps apps, use URL schemes.
For example if you want to open the Apple maps app focussing the apple headquarter, use this URL: http://maps.apple.com/?address=1,Infinite+Loop,Cupertino,California.
If you open such link in the Safari browser, a popup opens which asks to open the Apple maps native app. (source)
For the Google maps app, it is similar. You just have to use Google maps links like this: https://www.google.com/maps/search/?api=1&query=Infinite+Loop,Cupertino,California. (source)
JSON Derulo's answer successfully answers your question regarding local map links. However I believe this answer here will answer the second half of your question on how to pass information to native apps on the device. In short, you'll want to use an Android intent to pass any information you want to send.

Android Questions about Mozilla GeckoView

I am a beginner Android developer.
I using the 'WebView' had tried to make a Android App.
However, the speed of the web is too slow.
So the Internet search results found GeckoView.
But homepage has been difficult for me to understand I do not know English well.
My questions:
Can I use GeckoView instead of the WebView? Is it simple?
Can I use a code library that just adds to the 'build.gradle' in Android Studio?
Is there another altenative?
Yes, you can use GeckoView also....
Android WebView is not intended for building browser application because, many advanced Web API'S are disabled.
And different phones might have different versions of WebView all of which your app has to support....
Geckoview is open source library that allows you to render web content on Android using the Gecko web engine...
I made simple application with webview, just check out you'll get some help
https://github.com/malikhimani21/Project-2
In some cases, a WebView is a good option for displaying trusted first-party access to your web pages from either a browser or your own app
check out this link
https://developer.android.com/guide/webapps
Gecko view is only experimental. You can't use for production
https://wiki.mozilla.org/Mobile/GeckoView
So your only choice would be a webview. If you are great in javascript, I would recommend you to use react-native. This is how facebook is made, and you can follow extensive documents mentioned here.
https://facebook.github.io/react-native/

Android Webview and Facebook Login Not working

I am having a problem with a WebView app that I am working on.
We have this responsive website that is being displayed through an android WebView.
The website has a Sign in with Facebook option, this works fine in a mobile browser and on the website itself. Whenever I try to use the WebView app to login using Facebook, it results in a white screen.
I am having difficulties finding a solution to get this to work.
Appreciate any advise.
I was able to find a solution based on a previous question on stackoverflow.com
Making facebook login work with an Android Webview
Here is a link to my MainActivity : http://pastebin.com/KdzfhqDJ
I'm fairly certain it's this same issue. Essentially it opens in another window and WebView doesn't support multiple windows out-of-the-box.
Luckily for you, unlike that question which was iOS-specific, if I recall correctly, it's possible to extend WebView to support multiple windows. You'll need to extend WebChromeClient, implement onCreateWindow and use it in your WebView.

Pass google search results (from widget) into my webview (Android)

I have created a WebView app for my android device, but I have come to a brick wall. Can anyone help.
I am trying to get Google search results from the Google search widget, passed into my Webview ?. so basically making my Webview app the native browser for my phone. is this possible ? can anyone point me in the right direction
(image of Google search widget)
I have searched all over the web, but all I can find is,
making links stay inside the Webview. But I have already done this.
How to create a Google query
I have already done these (with succession) all I need to know now is, pass Google widget results
into my Webview. fairly new to app development, but I'm learning.
You need to use google Data APIs or GDATA api.
Check this link. Select the proper api you need and read its documentation on how to use it.
You can also check the google api - java client for android or gdata -java - client
The documentation for google web search can be found here.
Hope this helps.
Use this api from google to get results
http://google.com/complete/search?output=toolbar&q=football

How to use google translate api for Webview in Android application?

How to use google translate api for translate the content of the website inside the android Webview.
Explanation
I am showing the webpage in my application throw webview. I want to translate the web page contents based on the Locale of the android device
Please any one tell is it possible or not
Yes means how to do that
The API is now for paying developers only (sad, but inevitable), but it is available. See here: https://developers.google.com/translate/

Categories

Resources