0

I've built a mobile-ready website that does most of the features that an app would do. However, some people still like the idea of an 'app' on their phones because it would load the 'app' (website) directly, rather than having them load their browsers and type the URL.

Is there a way to create an app in Android and in iOS that works this way? The idea is that there's simply a custom icon reflecting the website, and once it's tapped it loads the browser with the URL of the website already input.

It seems like it would be simple enough to do in both Android and iOS, but scrolling through my reference books only yields concepts like putting a clickable URL inside a 'main screen' in the app, rather than effortless redirection.

Isaac Askew
  • 1,181
  • 2
  • 16
  • 29
  • 1
    For Android, see [this answer](http://stackoverflow.com/a/2201999) – A--C Jan 16 '14 at 04:04
  • For Android: just use webview in a layout and display your webpage. – chiru Jan 16 '14 at 04:08
  • For iOS the user decides if he/she wants to put a web page on the springboard. This [link](http://www.interworks.com/blogs/ssiemens/2012/01/23/get-your-web-app) is a good starter for what is possible. – Bamsworld Jan 16 '14 at 04:46

4 Answers4

2

For iOS a "mobile web shell" kind of applications will get rejected in the app review process.

From App review guidelines document (you will require to login with your AppleId),

2.12 Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected

Which means that applications which merely wrap a UIWebView to display the mobile site and do not support any other functionality/purpose will be rejected. Such shell applications can be achieved even through Safari browser which allows to "Add website to Home screen".

There is similar question asked previously on SO, please go through it: Does Apple reject “mobile web shell” applications?

Hope this helps!

Community
  • 1
  • 1
Amar
  • 13,103
  • 7
  • 50
  • 69
1

For Android, I would say the comment by @A--C is correct. What you can do to improve the user experience is that have just one activity which is transparent. In the onCreate function have a progress dialog showing some message. Since its transparent it will only show the dialog. Then from within the onCreate just open the browser. It will seem to the user that you are just opening the browser. For making that single transparent activity do following:

<activity android:name=".your.activity.declaration.here" 
android:theme="@android:style/Theme.Translucent.NoTitleBar" />

Basically add android:theme="@android:style/Theme.Translucent.NoTitleBar" to your activity declaration in manifest.

Community
  • 1
  • 1
Shobhit Puri
  • 24,785
  • 8
  • 89
  • 115
1

If you wanted to build a native iOS app, you could use a simple UIWebView to load the page.

As an example, inside your root UIViewController:

NSString* url = @"http://google.com";
NSURL* nsUrl = [NSURL URLWithString:url];
NSURLRequest* request = [NSURLRequest requestWithURL:nsUrl cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];

[self.webView loadRequest:request];
Matt
  • 1,979
  • 1
  • 15
  • 22
  • 1
    I've heard that Apple reviews each app, and sometimes they won't publish it if they don't think the app has enough features. Do you know if this is true, and if that's the case here? If it's in iOS, would the app have to have more features than a simple webView? – Isaac Askew Jan 16 '14 at 05:04
  • That I don't know. I was thinking the same thing when submitting the answer. Would be curious to know too. – Matt Jan 16 '14 at 05:14
1

As a disclaimer, I have absolutely no idea if apple would accept this for the app store, but to implement such a thing is extremely simple. Here is the only code I changed in the appDelegate:

#import "AppDelegate.h"
#import "WebViewController.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];

    WebViewController *webVC = [[WebViewController alloc] initWithURLString:@"http://www.google.com"];
    self.window.rootViewController = webVC;

    [self.window makeKeyAndVisible];
    return YES;
}

I then subclassed a UIViewController with the following .h and .m files:

#import <UIKit/UIKit.h>

@interface WebViewController : UIViewController <UIWebViewDelegate> {
    NSString *_url;
}

- (id)initWithURLString:(NSString *)URLString;

@end


#import "WebViewController.h"

@interface WebViewController ()

@end

@implementation WebViewController

- (id)initWithURLString:(NSString *)URLString {
    self = [super init];

    _url = URLString;

    return self;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    webView.autoresizingMask = UIViewAutoresizingFlexibleHeight + UIViewAutoresizingFlexibleWidth;
    webView.delegate = self;
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_url]]];

    [self.view addSubview:webView];
}

-(void)webViewDidStartLoad:(UIWebView *)webView {
    // perhaps show some sort of loading message here
}

-(void)webViewDidFinishLoad:(UIWebView *)webView {
    // hide the loading message here
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    // also hide the loading message here and present the user with an appropriate error message
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    return YES;
}

@end

This resulted in the following:

enter image description here

Hope that helps!

Mike
  • 9,225
  • 5
  • 32
  • 59