user1178708
user1178708

Reputation: 43

Can an IOS / Android Phonegap app do nothing but link to a website?

I've developed a mobile website which is optimized for android/iOS. I've been asked to place it on the mobile app stores, however the website is programmed mostly server-side.

I want to avoid re-programming the entire mobile website using ajax for phoneGap, both because it's just another version to maintain and I want to make sure any changes I make to the mobile website are immediately on app versions without having to re-submit or risk breaking the ajax API I would need to create.

I know that phoneGap simply uses a web-view to build the app. Is it possible to have a phonegap app just link to the website, through a frame, redirect, etc? (and avoid the website showing the browser controls/chrome); What would the best way to go about this be? Also, is there a company that would just do this and submit the apps?

Thank you.

Upvotes: 4

Views: 1806

Answers (2)

Graham Smith
Graham Smith

Reputation: 25757

Thomas approached the ios viewpoint, so I shall an Android one to complete the picture. From my point of view using phonegap seems overkill.

If all you want is a "branded browser" which only loads your mobile website, then it would be quicker to have a single activity that loads a single WebView. This is a essentially a browser without the UI controls (there is JavaScript support but no Flash).

You can do the basics by:

1) Creating a layout

<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

2) Specifying the URL to load

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("http://www.google.com");
}

With a tiny bit more reading you can handle the lack of internet connection by doing what ever you would like to do. For reference use the Google Tutorial at http://developer.android.com/resources/tutorials/views/hello-webview.html

OK we have code but to answer the question "why do it this way? I want to use Phonegap" - simple answer: This is much 'lighter' as I have not had to include Phonegap yet I have achieved the same result. The app will load faster and do the same job.

I am told by our Ios dev that a similar web view exists for Ios and offers similar functionality. However this is not my area.

You would not have to learn much about Android programming to do the above and would still go through the same process to submit the app to the market place.

Upvotes: 4

Thomas
Thomas

Reputation: 1563

You can, but as for Apple approving it, that's another matter, and they most likely won't. As a rule of thumb, if there is no Internet connection, you must at least load the UI (your views) without the corresponding data, and put an error notice to that effect. Therefore your app must have these views included in it. For a guideline, set your iPhone to Airplane Mode in the Settings, then load either the Maps, Weather, Youtube, ITunes or Facebook apps, and see what they do (have a "shell"). Apple is probably concerned about them approving your app based on your app description and functionality as promised by you, and then you turning around and changing it completely after approval to something undesirable.

phonegap

Upvotes: 3

Related Questions