Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to launch webpage in android with an icon

We have a website that offers an e-mail service. We would like to create a fully fledged app for this but cannot afford this right now. In the mean time it would be great if we could give users an icon on their phones that will take them to a page formatted for mobile on the internet. So what I'd like to know is how can we get an icon on an android users phone that will simply launch a web link in a browser- does this have to be an app, is there an easier way, or am I over estimating how complicated it would be to make this as an app anyway?

Thanks in advance

like image 732
David O'Sullivan Avatar asked Aug 11 '11 12:08

David O'Sullivan


People also ask

How to open a website in Android’s web browser from any application?

This example demonstrates how do I open a website in Android’s web browser from any application. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.java

How to pin a website to the start screen on Android?

Android ships with built-in options to pin websites to the start screen so that you can open then directly from there without having to open a web browser first. It is actually pretty easy to do so. All you need to do is open the website you want to add to the home screen in your browser of choice, lets say Google Chrome for Android for instance.

How to load Javascript from web page to Android app?

To load the JavaScript from the web page and let it work you need to add this code: Now you will see that all the link from the app is opening via the default browser of your Android device. However, it needs to open in the app through WebView.

How do I link bookmarks from Android to desktop?

If on android you long press the home screen and then select the widget option you can create a bookmark. This will let you select a bookmark from your chrome bookmarks to be linked on the desktop. If that works for you you're all set with default Android features. The icon from the bookmark is used on the desktop.


4 Answers

Create a new Android project (after following the SDK installation steps provided at http://developer.android.com)

on the directory /res/drawable-*dpi you have the laucher icons. Modify all of them.

In the main activity, delete all inside the onCreate method an put this:

String url = "http://www.YOUR-URL.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

This will open the android browser with the URL provided.

like image 71
Fernando Gallego Avatar answered Oct 12 '22 14:10

Fernando Gallego


I have done projects like this in the past, it is very simple. You need to create a website formatted for a smaller screen. Once you do this, building an android app that displays your website inside it is simple. You can even remove all of the android browser toolbars so it appears as if your website is a real android application. Google android webviews, this will point you in the right direction.

like image 20
tier1 Avatar answered Oct 12 '22 15:10

tier1


One way is to bookmark the site and then add it to your home screen. Source

like image 36
Kevin King Avatar answered Oct 12 '22 13:10

Kevin King


See here for what's probably the best instruction page on how to do exactly that:

http://intelnav.50webs.com/app_project.html

It's based on a Webview, that is it opens the page and does all the navigation in the app window, not in the default browser. So if you want to open it in the browser, you have to use Intent, as said in previous answers.

My 2 pennies worth, I think it's better in the app window unless you really want complex navigation with the possibility of opening additional tabs, windows and so on. The drawback with the external browser is that, as far as I could see, there's no way to tell if the page is already open in the browser so you'll launch a different copy (in a new tab) every time. If the user doesn't close the tab at the end, they usually don't, it can become quite annoying. Besides, within an app you'll probably have somewhat better possibilities for ads should you ever want them.

Versus a simple home-screen bookmark, as others pointed out, it's simpler and more convenient for end users to just download an app from an online store (usually Google Play). It's what they're used to do. And they do have a lot of additional info available, like what it does, what others say about it, screen shots (if you provide some for them but you should). Plus a way to comment / complain themselves. It's a different thing. Technically it may not make a lot of sense but from a simple user's perspective it's clearly better IMO.

like image 2
VSim Avatar answered Oct 12 '22 14:10

VSim