question

Robin Walmsley avatar image
Robin Walmsley asked Robin Walmsley commented

Creating a Webview app in Sandbox on my Dev Clover Station

Over the last 18 months I've written an extensive Fashion Retail Business Management suite in php, html and Javascript.

However, I am a complete beginner with Android.

I have the Dev Clover Station, and I'm trying to setup a basic webview so I can test accessing part of our Web app from the clover station. I'm presented with an error message on the Clover Station, when I run the app.

"Web Page not available" followed by a standard message you might see on any browser. The URL is correct, and the web site is working fine.

I notice there is no Browser app available on the Dev Station App Market, I sincerely hope Clover is not blocking access to the internet from the Dev Station. If so, how might I test my apps?

Thanks Robin

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rachel avatar image
rachel Deactivated answered Robin Walmsley commented

I'm going to repost the answer that @Sam provided via email, in case it comes in handy for others.

Publicly accessible browsers are not supported on our devices due to compliance reasons but you can use webviews. https://developer.android.com/referen...

The simplest way to do this would be to set the entire Activity window as a WebView during onCreate()

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webview = new WebView(this); setContentView(webview); webview.loadUrl("http://www.example.com/"); }

While we allow for WebViews, we encourage that all native Android Application best practices be followed as closely as possible so that experience does not feel like a WebView. An important one would be using OAuth to automatically sign into your application using the device auth token. https://github.com/clover/android-examples/tree/master/gettoken

Best, Sam

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Robin Walmsley avatar image Robin Walmsley commented ·

Thanks, however this didn't address the problem I mentioned. With both my original code, and with the code Sam suggested, I am presented with a "Web Page not available" message on the Clover Station.

The site I am trying to access is "http://www.google.com"

Both versions of the app will load the Google website from an emulator on my PC.

Are you confident that there is a channel to the internet from a "development" Clover Station ?

Thanks Robin

0 Likes 0 ·
Robin Walmsley avatar image Robin Walmsley commented ·

Hi Voski, I missed your reply, and yes, that's exactly how I did it. Thanks

0 Likes 0 ·
voski avatar image
voski answered

@Robin W you should be able to do this.

Can you please share your code?

Do you have internet permission in your manifest? <uses-permission android:name="android.permission.INTERNET" />

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Robin Walmsley avatar image
Robin Walmsley answered

Ok I figured it out. In addition to the code suggested above by Sam the following line is required in the AndroidManifest.xml file

<uses-permission android:name="android.permission.INTERNET"/>

I assume this gives the necessary permissions to the app to use the internet.

phew ..that was an ordeal. thanks for everyone's help.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community