Easiest way to launch webpage in android with an icon - android

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

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.

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.

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.

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

It seems to me like you need a mobile version of your web page. Do you have that already? Once you have your mobile website (ie. website optimized for mobile devices), you could create a simple application with only one WebView. All content would be fetched from your site and displayed inside a webview. This is trivial to make, however, making an entire mobile website will take some time.
Note that you do not HAVE TO have a mobile website, you could pack you existing website into a WebView, but this would lower user experience.

you would build an app that launches a browser intent linking to your website, or a custom WebView to launch your website in full screen without any navigation bar etc..

The only easier way is to put instructions on your site (directly, or as a contextual pop-up) on how to add the bookmark as an icon on your home screen. This can be slightly more complicated on Android, and depends on the browser. A simpler option for your potential users is to provide a wrapper app via the Marketplace.
It is not overly complicated to create a simple wrapper Android app in Java that launches the browser, using Intents. The essential browser launch code is basically this:
Uri uriUrl = Uri.parse("http://www.yourwebpage.com");
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(launchBrowser);
A more detailed tutorial for creating this is available here:
http://mobile.tutsplus.com/tutorials/android/launch-android-browser/

Try this kick-start mobile device app for showing websites. Written with cordova for platforms like android, ios, browser and so on: https://github.com/jetedonner/ch.kimhauser.cordova.kickstartwebsite (GooglePlay: https://play.google.com/store/apps/details?id=ch.kimhauser.cordova.kickstartwebsite, Website: http://kimhauser.ch/index.php/projects/cordova-phonegap/kick-start-website)

Related

Is it possible to open native android clock app from web application?

I am looking for a way to open the native android alarm clock app when a user clicks on the link or button on a web browser of the android. So basically need to open the native android app from web application. I tried using intent://#Intent;package=com.android.deskclock;end' and it is not working. I am wondering if I am using the wrong package name or it is not even possible in android.
Thank you much for help!
According to this documentation, this is not possible. In particular, this footnote is the limiting factor:
Only activities that have the category filter, android.intent.category.BROWSABLE are able to be invoked using this method as it indicates that the application is safe to open from the Browser.
If you look at the AndroidManifest.xml for the DeskClock app, none of the activities contain the android.intent.category.BROWSABLE category filter, meaning none of them can be opened from the browser.
I have a suspicion that the problem is that you are not providing a URI path in your URL. It might need to be a path declared in the app's manifest. See: https://developer.chrome.com/multidevice/android/intents
This could change it to ie intent://path/#Intent;package=com.android.deskclock;end'
It might be helpful if you were to look at the javascript console when you try to click on that link in Chrome, there might be details of what went wrong.
Keep in mind that the alarm clock app is not necessarily consistent. Manufacturers can remove the default alarm clock app to replace it with a different one, or just modify the source code so that it has the same package name but different source code. You could try opening multiple package names from javascript depending on what happens when the intent can't be opened.
Welcome to code party
You can get a android device IFrame from appetize site.
This is the easiest way for show android apps in web applications.
Update me in comments ;)

How can android app (Intent.ACTION_VIEW) opens url in browser, with named window

How can I, in Android APP, open a URL in browser with a named window?
There are many good solutions for, from Android APP, opening a URL in a browser window with the Intent.ACTION_VIEW, but is there a way to specify a target name?
The reason I need this is because there is a specific step that needs to done is a browser, instead of in my APP. If a new browser window is opened every time, there will be multiple browser windows open. What I need is just using one fixed browser window.
To make it clear, below are two similar situations when open another browser window with a link. What I need is the latter one.
< href="url" target='_blank'> Pop open a new window each time clicked.</>;
< href="url" target='MyWindow'> always open in the same window</>;
Thanks.
The behaviour you're trying to achieve is only possible through a custom webview or a 3rd party library. I would recommend Chrome Custom Tabs though because many mobile browsers actually do implement those and they offer much flexibility. Also some websites block features when they're shown in webview. For example you cannot use Google login in a Webview. You need to launch a browser or a custom chrome tab.

URLs that contain the text "feed" ask for an app to open with in Chrome for Android 4

I'm developing a web app and I have an url that has the word "feedback" in its path. When I tap it, Chrome for Android asks me whether I want to open it with Chrome, with Firefox or with RssDemon (an Rss app I installed).
I played with the url bit by bit until I realized that it's the word "feed" in the URL what triggers that behaviour. It doesn't have to be at the beggining nor at the end. Anything like "feeding animals" or "linefeed code" would have the same effect.
I don't want to have to change my urls to avoid that.
The problem is not in the web app in any way. It's all the fault of RssDemon, the RSS android app. After uninstalling RssDemon, the problem goes away.
It seems that RssDemon set up an URL intent filter so that links clicked on Chrome that had the text feed in them opened with RssDemon. Being a link, it's likely that Android also offers Chrome & Firefox as options to open it.
The bad thing about that is that I can't do anything in my web app to avoid such a behaviour. The good things is that I don't have to :-) . It'll work fine for anyone without an app like RssDemon that installs such an intent filter. And you can't really protect from those, any app could set up a filter for any pattern and it'll be up to the user to decide then.

move existing web app into a native phone app using a browser wrapper

So lets say there is a fully functional responsive ruby rails web app. This app works and looks great on mobile phones. Unfortunately, this web app can't be seen from the mobile phone app stores, because it's not a native app. Technically you could place an icon on a smart phone that opens up the browser, but obviously this is not optimal.
Is there a way to create a native app (Android, iPhone) that is essentially just a browser, without the navigation bar? This browser's wrapper would just load the web app and behave just like you had opened up the browser.
I have looked into options such as Phonegap and Titanium, but it seems there would be a significant amount of rewriting, and there are very little funds for this.
I don't really know iOS, but doing it in Android will be really easy.
First, this is your activity:
package com.example.my_browser;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class MyActivity extends Activity {
/**
* Called when the activity is first created.
*/
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView browser = (WebView)findViewById(R.id.browser);
browser.loadUrl("http://google.com"); //Replace google.com with you webapp's URL
}
}
This is your main.xml layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<WebView
android:id="#+id/browser"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
And you will need to request internet permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
I just tested this in an emulator and it works.
This answer is for iOS.
You can have an icon of your website on the home screen of the device without writing a line of code (no UIWebView, no native coding, no XCode).
Download iPhone Configuration Utility from http://www.apple.com/support/iphone/enterprise/
Start iPhone Configuration Utility and from the left menu select "Configuration Profiles"
In the General section of your new profile fill out the Name (MyWebsite app) and identifier (com.mycompany.coolapp). You can add also organization name and description.
Scroll down and select Web Clips section.
In the Label field you can enter the name that will be visible on the home screen.
URL will be the URL of your web site / web app.
Select the icon to be used as a home screen icon. Use at least 114x114 pixel resolution.
If you select "Full screen", the navigation bar and the address bar of Safari will be hidden when you launch your web app, so you can have a real "app".
Click on the "Export" button. You can decide whether to sign your profile (will be visible by the end user when he installs your profile).
Save the .mobileconfig file and upload it to your web server or send to your end users via mail.
When the end user opens the .mobileconfig file on his device, the system will ask him to install the configuration profile. After the installation a home screen icon will be created that points to your web site.
Update as of 2017
iPhone Configuration Utility has been replaced by Apple Configurator that you can download free from App Store. You can create a new Configuration Profile the same way as described for Apple Configurator, selecting File -> New Profile in the app.
edit 2
As #MrTJ said in the comments. Apparently Apple won't let you have a simple "website wrapper" application. So your only options would be porting Ruby, like the rest of my answer describes, porting the application natively, or doing a web app like #MrTJ describes in his answer. Porting it natively, supported by RESTlike web services, would probably be the best solution. Web Apps are nice, but native applications are usually nicer. It depends on what kind of user experience you want to provide.
end edit 2
edit 1
I need to read more carefully. I answered your question assuming you wanted to embed the application, without needing to access the internet. If that is NOT what you are trying to do, then it is definitely possible.
Just make an application that has a webview and loads the base URL for the site. You will probably want to do a special version of the site that ALWAYS has back buttons etc, so the user can never get stuck in a corner of your site (since you want the navbar hidden).
Also, personally I would not do this, you can, but you probably shouldn't. You will need to handle what to do when the user does not have an internet connection. And you may make them less than happy when they (potentially) paid for an application that they can't use everywhere. Native Applications tend to sell/perform much better.
end edit 1
My Personal Reaction to This Question
Cool Question. Personally I am not a fan or Ruby or Rails (I'm a bit more of a Python guy, but Python is actually why I know anything about this situation), but this is a pretty cool problem regardless.
Questions to ask yourself
Is this possible? Probably
Is it a good idea? Probably Not
Is it going to be worth the effort? Probably Not
And most importantly, will Apple let you sell it? ....Maybe, but for something like this, you won't know till you try....
What you Need
A WebView that uses a protocol to talk to your native application. This would be like the URL hash tag hack used to talk to an iFrame in a browser, or the protocol that PhoneGap uses to communicate with it's WebView
Embedded version of the Ruby Interpreter. People have been doing this on iOS with both the Python and JavascriptCore interpreters. Some people will try to tell you Apple won't let you do this, but that is no longer true. You will need to compile Ruby specifically for iOS, this will probably be annoying, but I bet if you base your implementation on the Python/Javascript implementations, you could eventually get it working.
edit
Another SO question/answer with relevance to this answer
Embed a JavaScript engine in an iOS application
end edit
Embedded version of Rails... Good luck :)
Method of triggering the Rails app without a web server (you probably can't run apache locally on an iPhone (would be difficult and would probably crash immediately), and definitely not on Android). You will either need to trigger each view manually somehow, piping the output to either a string or a file, and load that string (HTML) or file into the WebView
Method of triggering navigation in the Rails application. This will require catching link presses from the WebView (you can watch for the URL changing on iOS), and triggering the proper Rails view to produce its HTML.
Problems
Ruby and Rails are both VERY HEAVY. Most implementations I have seen require at least 256mb of RAM, iOS will instantly kill your application if it tries using this much memory at startup. Android will probably handle it far less gracefully and just crash unexpectedly at some point in the application run.
Android does not run Native Compiled code. This means you will need to run JRuby, which will leave you with an interpreted language running in an interpreted language (read as, Slow As Hell On a Mobile Device).
This will require writing MORE Ruby, some Javascript, and MORE Java or Objective-C. So in other words, Don't. Figure out what your application does, and port it.
Key Learning
This is will probably take way more effort than any sane developer would ever want to spend on a 'simple web application'. You will be far better off learning Native development, since that will be required to get this job done anyway.
Yes, for iOS simply load a UIWebView fullscreen and change the UIWebView's current URL to whatever the location of your web-app is. launching UIWebview with specific url
I don't know anything about android but apparently it's the same process... Here ya go: How to set url on WebView from a xml layout file on Android?
To communicate between iOS app and your website you can use stringByEvaluatingJavaScriptFromString mentioned here: Passing Javascript Variable to Objective-C
To do this with Android refer to the other answers to this question where they have already listed the code in their answer.

Is there Android Intent concept in iPhone SDK

Just switching from Android to iPhone. In Android I can make several apps and use a tabView to call each app as intent.
In iPhone, I can make several apps. I need a tab to call each apps or app views. Is there similar concept as intent in iPhone? Just switched to iPhone, copying all the other projects into the tabbar does not work out. If you have other methods to solve, I really appreciate. Thanks,
Android and iOS are very different in this regard. Android is very open about letting you use intents to mix and match activities from other apps. iOS isn't like that; each app runs in its own private space and generally cannot even see other apps' data, let alone use their services. It is possible to cause other apps to run via custom URLs, but that's not the same thing.
What you'll need to do is to copy or move the code for the view controllers, views, etc. of your various iOS apps into your tab bar app project. You'll build them all into a single application, and the tab bar will switch between the view controllers.
With iOS 8 you will have something similar to Android Intents. Using App Extensions you can reach similar behavior.
In a close future Apps will start expose their "extension" (as you do in Android Framework declaring Intent Filters in the manifest) that will be used by application who need.The extension areas allowed in this first version are:
Today
Share
Action
Foto Editing
Document Provider
Custom Keyboard
It's great finally apple release this functionality!
Intent in Android covers a lot of functions. There is no iOS equivalent to that.
But if your objective is to launch a different app, and pass parameters to it, you can try out URL Schema.
Let's say you have app AAA with URL schema aaa:// and app BBB with URL bbb://
You can launch app AAA, and call bbb://v=1&c=2 for example, to launch BBB and get the parameters. you can even take these parameters to control what view to show, so you can have a similar concept in Android, to call different Activity with Intents.
You have to register URL schema in Info.plist
The closest concept to an Intent on iOS is the handling of certain URLs by the system applications. See here. It was possible to register your own application URL schemes at one point (see this article), but I must admit I haven't tried this in recent SDKs (IIRC Glympse links can be opened in the Glympse app, so this technique probably still works).
As of 2016, Apple has added an Intents framework that is similar to Android's, albeit much more restrictive. Expect Apple to add more Intents in the future, but for now it is quite limited. https://developer.apple.com/reference/intents
Since iOS 8, you can use App Extensions.

Categories

Resources