webview android app issues - java

i'm a web developer so i don't have a large knowledge with android apps, but i have found a project on github to make a simple webview app to show a website i have created which is fully responsible and work fine with all browsers on desktop and android phones, when i run the app in android studio it works great and everything run smoothly in many emulators, but when i install the apk on physical phone some problems show include taking larger width than the device and some containers which displayed 'none' shows at the bottom of the page and there are many issues with the proportions of the pages, i hope someone can help me to locate the problem or guide me to where i can search for it and find it by myself
this is the url to the github project
thank you very much

I see, I think just adding this code to your MainActivity will do the trick!
mWebView.getSettings().setLoadWithOverviewMode(true);
mWebView.getSettings().setUseWideViewPort(true);
maybe try this too:
WebView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
put the above code below :
mWebView.setWebViewClient(new WebViewClient());
hope this helps :D and please tell me if it does!

Related

Is it possible to load a webpage in Gluon Mobile Application?

I'm a student and currently learning + working to develop mobile applications using JavaFX, gluon mobile Application. I'm able to build up distinct applications. But, I wanted to know if there is any possible way to open up a webpage in gluon mobile application. Like we can have it in android by android-studio. But I want to make it in gluon mobile app.
I have checked many of the samples, but none actually helped.
I want this because I have a website which has a mobile responsive theme. Instead of developing a separate app for that ( which is, of course, a very lengthy process), I want the webpage URL to open in-app. So that it will be more easy for me to set up rest of the things...
I have tried the rest, gluon connect settings etc. I have read the docs as well. But couldn't find anything related to that. Or maybe I've missed.. I'll be glad to get support regarding this question.
Any possible help will be appreciated.
Well, as answered in comments by Jose Pereda,
the WebView worked very well!
Sample Code:
//javafx class
...
WebView myWebView = new WebView();
WebEngine web = myWebView.getEngine();
web.load("https://yoururl.com");
....
docs can be found here: WebView Javafx Docs

Site for APP IOS AND ANDROID

Good afternoon ,
I currently have a simple website made in Wordpress and would like to create a webview to encapsulate the same.
The goal is to look like an App, so that the client can download for both Android and IOS, install and in fact he will see the mobile version of the site.
I know how to make an App from scratch but I can not pass the site codes to it.
Can someone help me?
I searched so much on the internet but found nothing.
If you really just want to show the website in a web view, you can do that. For Android, you'll load the URL into a WebView. For iOS, you can use SFSafariViewController.
Official documentation:
WebView: https://developer.android.com/guide/webapps/webview
SFSafariViewController: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller
Edit: You probably won't actually be able to publish that, though. Maybe on Android, but on iOS, they want your app to be more than a repackaged website. See section 4.2 of the App Store review guidelines. https://developer.apple.com/app-store/review/guidelines/
I would perhaps recommend instructing your client how to add your website as a shortcut to the home screen of their phone.
There is now a Wordpress plugin to make your site a PWA
https://wordpress.org/plugins/pwa/

Display a non-mobile website with WebView in an Android app

I'm currently working on a project at my university. The goal is to develop an Android app which functions as a mobile version of a website and its forum. I am currently asking myself if it is possible to display the website which doesn't have a view optimized for mobile devices in an Android app so that it looks like a mobile version of that site?
I stumbled upon WebView (WebKit) during my research and also read about JavaScript-Injection via WebView. Can somebody just plainly tell me if this would be a viable solution? Are there better alternatives i haven't come across? The only problem is the website doesn't have an API and i also don't have access to any data that isn't available to every user on the forum and the website.
Thanks in advance for your answers.
You can checkout IBM Worklight and Apache Cordova
link
link
Try this it might work. Worked for me.
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);

Adverts not appearing on my Android App - Google AdMob

I have made an android application and put adverts in using Google AdMob.
On Eclipse's Graphical Layout there is a white rectangle which says 'Ads by Google' in it, which shows that it has been set up properly.
However, when I run the app on the simulator and in real life, nothing shows up. Why would this be?
Thanks in advance!
You should make sure you have setup your Android Application properly with Ads, go over the following steps and ensure that you have done them correctly.
GoogleAdMob Jar in your libs folder
GoogleAdMob Activity in your manifest
GoogleAd AdView in your main activity XML file, with your adunitId correctly inputted
And Ensure your class in which your AdMob is coded in is correct.
Let me know if these steps help you or not.

Android WebView - Works in browser but not WebView

I am attempting to create an Android game in Javascript, then I planned on putting it into a WebView. The problem is, although my game works 100% in the default Android browser, running it in a WebView seems to break it somehow. I've looked through all of my code and cannot for the life of me figure out what the issue is.
I used this game as the "codebase" for my own game, and it faces the same issue.
It loads perfectly in the default Android browser but when you put it into a WebView it will no longer play. Simply copy the above link into a webview and see for yourself.
Note I do have Javascript enabled and the webview is functioning properly.
Perhaps the cache manifest?
Have you tried Phonegap? You have all the hard work done and works out of the box.

Categories