'How to wrap a website in a phone app?
I have seen a lot of mobile phone apps that just open a web page without the controls. Just the page.
I am looking for guidance and links to start something simple like this.
Solution 1:[1]
If you would like to wrap a website in Android you may do so with this code, from Roskvist
package com.webview;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;
public class WebViewTest extends Activity {
WebView browserView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Removes the title bar in the application
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
//Creation of the Webview found in the XML Layout file
browserView = (WebView)findViewById(R.id.webkit);
//Enable Javascripts
browserView.getSettings().setJavaScriptEnabled(true);
//Removes both vertical and horizontal scroll bars
browserView.setVerticalScrollBarEnabled(false);
browserView.setHorizontalScrollBarEnabled(false);
//The website which is wrapped to the webview
browserView.loadUrl("http://dev.openlayers.org/sandbox/camptocamp
/mobile/trunk/examples/iol-iui.html?rev=9962#_map");
}
}
And here's the main.xml contents
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:id = "@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>
You would then have to compile and load it to your device via USB.
Solution 2:[2]
For iOS/iPhone, you can encapsulate a web app or web page inside an app's bundle, and display the site inside a full-height UIWebView. To add non-HTML5 features (which may be required for Apple to approve the app for their App store distribution), you can trap custom URLs via the shouldStartLoadWithRequest: delegate method and handle them with native Object C code.
Solution 3:[3]
There's a lot of general information out there in regards to Regular Webapps vs hybrid apps (web but designed for mobile) vs mobile apps (client software). What you're probably looking for is just typical HTML5 or mobile compliant web code.
For android, this is a good read: http://developer.android.com/guide/webapps/index.html
Solution 4:[4]
For android, you will want to use a WebView.
Solution 5:[5]
If you are not a programmer and you're looking for a quick fix, nativator.io is the go-to wrapper, it offers most native features and support both android and ios.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | hotpaw2 |
| Solution 3 | dispake |
| Solution 4 | Nightfirecat |
| Solution 5 | Sam |
