Hello everyone,
As per my knowledge the hybrid application ( combination of Native + Web HTML5/Javascript ) with MBO is suitable for any type of Mobile Application. Means it can be online or offline. Online and Offline scenario can be handled through MBO's API (Generated Code).
For a Hybrid Application first thing is developing applications in HTML5, CSS for front-end and Javascript for handling events. HTML5 + CSS + Javascript apps are nothing but the normal web app which will run in any HTML5 enabled browser. It is platform independent so we can run the same HTML5 application on Android, BlackBerry or iOS.
For all the question's solution is PhoneGap framework.
Following is the procedure for creating Hybrid Mobile Application
Prerequisite:
- Eclipse with ADT and SDK configured.
- Basic knowledge of Java classes and packages.
Steps:
public class MyJavaClass {
public String getName() {
return "ShashanK";
}
}
public class example extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
appView.addJavascriptInterface(new MyJavaClass(), "myclass");
super.loadUrl(Config.getStartUrl());
}
}
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova-2.7.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
alert("Hello " + window.myclass.getName()); // Here we are calling the getName() method
</script>
</body>
public class MyJavaClass {
public String getName() {
return "ShashanK";
}
/*
* Create
* */
public void create(String name, int age) {
Person person = new Person();
person.setName(name);
person.setAge(age);
MBODB.create();
}
/*
* Synchronize
**/
public void synchronize() {
MBODB.synchronize();
}
}
Hope this blog helps you to get an idea to implement Hybrid Application.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 |