I built a site in asp.net C#. Visual Studio 2010.
The site scales nicely and fits on my phone and other Android divices. It database driven also. I want to make an app for the android market out of my site now. Free app.
Can i easily accomplish this? Can a app be as simple as launching a browser window? Will the android market accept an app like that?
Point me in the right direction please. Im unsure where to start.
Hybrid. You can think of hybrid apps as a cross between a website and a native app, hence the name. Hybrid apps allow you to convert your website into apps using purely web-based technology, and are essentially a native container (the native app part) that displays web content (CSS, JavaScript, HTML) when used.
What you describe can be easily accomplished using a WebView
.
WebView
(from android developers) : A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.
Here's a simple sample app:
public class WebActivity extends Activity { WebView mWebView; @Override public void onCreate(Bundle savedInstanceState) { final Activity mActivity = this; super.onCreate(savedInstanceState); // Adds Progrss bar Support this.getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.main); // Makes Progress bar Visible getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON); mWebView = (WebView) findViewById( R.id.webview ); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl(http://your.url.com); mWebView.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { //Make the bar disappear after URL is loaded, and changes string to Loading... mActivity .setTitle("Loading..."); mActivity .setProgress(progress * 100); //Make the bar disappear after URL is loaded // Return the app name after finish loading if(progress == 100) { financialPortalActivity.setTitle(R.string.yourWebSiteName); } } }); } }
and a very simple layout file: main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout>
Of course you will have to set a permission in your Manifest:
<uses-permission android:name="android.permission.INTERNET" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With