SlideShare a Scribd company logo
Android, The Fifth
Element
Murat Yener, eteration
@yenerm
Saturday, June 15, 13
who (the hell) am I?!?
• Java, Flex, GWT, iOS, Android developer
• Principle Mentor at Eteration
• Eclipse Committer
• GDG (GTUG) Istanbul Organizer
• Conference Speaker
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
Me as an Android Developer
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
• Widgets
Saturday, June 15, 13
what (the hell) is the fifth
element?!?
• Activities
• Intents
• Services
• Widgets
• ... and the WebView (hybrid apps, web
apps)
Saturday, June 15, 13
an HTML5 talk?!?
• Facebook killed HTML5 app, Zuckerberg
said HTML5 is not there yet!!
• Sencha Built FastBook
fb.html5isready.com
• LinkedIn moved to native
• anybody think its better now?
Saturday, June 15, 13
an HTML5 talk?!?
• Facebook killed HTML5 app, Zuckerberg
said HTML5 is not there yet!!
• Sencha Built FastBook
fb.html5isready.com
• LinkedIn moved to native
• anybody think its better now?
Saturday, June 15, 13
wait its too complicated!
• How many of you have web development
experience?
• How many of you develop native mobile
apps?
• How many of you don’t like web
development just because javascript
Saturday, June 15, 13
wait its too complicated!
• How many of you have web development
experience?
• How many of you develop native mobile
apps?
• How many of you don’t like web
development just because javascript
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Saturday, June 15, 13
but it is slow!
• building games?
• 3d physics?
• image processing?
• ...?
Nooo! We just build lists and detail pages!!
(well, most of the time...)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
“We started with the existing Jake2 Java port of the Quake II
engine, then used the Google Web Toolkit (along with WebGL,
WebSockets, and a lot of refactoring) to cross-compile it into
Javascript. You can see the results in the video above — we
were honestly a bit surprised when we saw it pushing over 30
frames per second on our laptops (your mileage may vary)!”
from Google Code Blog...
Wait!! Is this web?!?
• Angry Birds for Chrome (GWT)
• Quake on Mobile http://media.tojicode.com/q3bsp/
(requires Chrome Beta with WebGL)
Saturday, June 15, 13
Mobile HTML5
Frameworks
• jQueryMobile
• Sencha
• Zepto
• mGWT, hey wait! no javascript?!? Seriously?!!
Saturday, June 15, 13
Java to Javascript?!?
• GWT Compiler does the magic
• Optimized, high performance js
• Cross browser compability (upto ie6)
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Android vs iOS
Saturday, June 15, 13
Setup
• get the source from https://code.google.com/p/mgwt/
• or download the jar
• or use Maven!
<dependency>
      <groupId>com.googlecode.mgwt</groupId>
      <artifactId>mgwt</artifactId>
      <version>1.1.2</version>
</dependency>
Saturday, June 15, 13
Hello World
public class MGWTEntryPoint implements EntryPoint {
  public void onModuleLoad() {
    // set viewport and other settings for mobile
    MGWT.applySettings(MGWTSettings.getAppSetting());
    // build animation helper and attach it
    AnimationHelper animationHelper = new AnimationHelper();
    RootPanel.get().add(animationHelper);
    // build some UI
    LayoutPanel layoutPanel = new LayoutPanel();
    Button button = new Button("Hello mgwt");
    layoutPanel.add(button);
    // animate
    animationHelper.goTo(layoutPanel, Animation.SLIDE);
  }
}
Saturday, June 15, 13
Add a little spice:
Phonegap
• Geolocation
• Camera
• Accelerometer
• Compass
• Phonebook
• File System
• even NFC
Saturday, June 15, 13
Add a little spice:
Phonegap
• Geolocation
• Camera
• Accelerometer
• Compass
• Phonebook
• File System
• even NFC
Basically
any
Native
API
!!
Saturday, June 15, 13
Phonegap
Button button = new Button("Hello mgwt");
button().addTapHandler(new TapHandler() {
@Override
public void onTap(TapEvent event) {
phoneGap.getNotification().alert("Done!!");
}
});
layoutPanel.add(button);
Saturday, June 15, 13
more Phonegap
phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){
@Override
public void onSuccess(Position position) {
// check accuracy
if (position.getCoordinates().getAccuracy() > 11) {
raceView.getLabel().setText("Error: Accuracy");
}
// geolocation returns mps, multiply with 3.6 to convert to kph
double speed = 3.6 * position.getCoordinates().getSpeed();
if (speed > 0.2) {// if going
raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy());
currentLocation = position;
// got the position now can start!
start();
// stop if the threshold is reached
if (isGoing && speed >= 60) {
MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher);
endLocation = position;
calculate();
}
} else {// if stoped
raceView.getLabel().setText("get ready!!");
isGoing = false;
}
}
@Override
public void onFailure(PositionError error) {
MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location");
}
});
Saturday, June 15, 13
more Phonegap
phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){
@Override
public void onSuccess(Position position) {
// check accuracy
if (position.getCoordinates().getAccuracy() > 11) {
raceView.getLabel().setText("Error: Accuracy");
}
// geolocation returns mps, multiply with 3.6 to convert to kph
double speed = 3.6 * position.getCoordinates().getSpeed();
if (speed > 0.2) {// if going
raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy());
currentLocation = position;
// got the position now can start!
start();
// stop if the threshold is reached
if (isGoing && speed >= 60) {
MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher);
endLocation = position;
calculate();
}
} else {// if stoped
raceView.getLabel().setText("get ready!!");
isGoing = false;
}
}
@Override
public void onFailure(PositionError error) {
MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location");
}
});
yes, you can really do that
with mgwt/phonegap
Saturday, June 15, 13
even more...
public void onTap(TapEvent event) {
final MCheckBox check = ((MCheckBox) event.getSource());
if (check.getValue()) {
if (TWITTER.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter");
else if (FACEBOOK.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook");
profileView.getBrowser().addLocationChangeHandler(new
ChildBrowserLocationChangedHandler() {
@Override
public void onLocationChanged(ChildBrowserLocationChangedEvent event) {
//Do the login...
}
});
}
}
Saturday, June 15, 13
even more...
public void onTap(TapEvent event) {
final MCheckBox check = ((MCheckBox) event.getSource());
if (check.getValue()) {
if (TWITTER.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter");
else if (FACEBOOK.equalsIgnoreCase(type))
profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook");
profileView.getBrowser().addLocationChangeHandler(new
ChildBrowserLocationChangedHandler() {
@Override
public void onLocationChanged(ChildBrowserLocationChangedEvent event) {
//Do the login...
}
});
}
}
Make use of the
Phonegap Plugins!!
Saturday, June 15, 13
mgwt experienced
• MVP
• Model
• View
• Presenter
• Maven Archetype
Saturday, June 15, 13
mgwt experienced
• MVP
• Model
• View
• Presenter
• Maven Archetype
Saturday, June 15, 13
mvp?!?
• Code your UI in View
• and logic in Acitivity
classes
• sound familiar?!?
• easy navigation
• a bit of boilerplate
code
Saturday, June 15, 13
mvp?!?
• Code your UI in View
• and logic in Acitivity
classes
• sound familiar?!?
• easy navigation
• a bit of boilerplate
code
Saturday, June 15, 13
calling the backend
• GWT-RPC
• JSONP & AutoBean
JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
String url = URL.encode(JSON_URL + "/sendData/" + “HelloWorld”);
jsonp.requestObject(url, new AsyncCallback<JavaScriptObject>() {
@Override
public void onFailure(Throwable caught) {
MgwtAppEntryPoint.phoneGap.getNotification().alert(caught.getMessage());
}
@Override
public void onSuccess(JavaScriptObject result) {
JSONObject jsObj = new JSONObject(result);
AutoBean<Score[]> bean = AutoBeanCodex.decode(factory, MyModel[].class, jsObj.toString());
Score[] scores = bean.as();
scoresCallback.onResponse(scores);
}
});
Saturday, June 15, 13
Calling Native JS
• Use any existing Javascript
• Use Javascript in a type safe way
• BUT dont mess touch events
• AND beware you are not in safe zone
anymore
Saturday, June 15, 13
JSNI
public native static String key(int index) /*-{
return $wnd.localStorage.key(index);
}-*/;
public native static void setItem(String key, String value) /*-{
$wnd.localStorage.setItem(key, value);
}-*/;
public native static String getItem(String key) /*-{
return $wnd.localStorage.getItem(key);
}-*/;
public native static void removeItem(String key) /*-{
$wnd.localStorage.removeItem(key);
}-*/;
public native static void clear() /*-{
$wnd.localStorage.clear();
}-*/;
Saturday, June 15, 13
gwtquery
public void onModuleLoad() {
  //Hide the text and set the width and append an h1 element
  $("#text").hide()
    .css("width", "400px")
    .prepend("<h1>GwtQuery Rocks !</h1>");
   
    //add a click handler on the button
    $("button").click(new Function(){
      public void f() {
        //display the text with effects and animate its background color
        $("#text").as(Effects)
          .clipDown()
          .animate("backgroundColor: 'yellow'", 500)
          .delay(1000)
          .animate("backgroundColor: '#fff'", 1500);
      }
    });
}
Saturday, June 15, 13
skinning
• offers default themes for
• android
• iOS/iOS Retina
• Blackberry
• easy to create yours
https://code.google.com/p/mgwt/wiki/Styling
//append your own css as last thing in the head
MGWTStyle.injectStyleSheet("yourcssfile.css");
Saturday, June 15, 13
wait! css in java??
.mgwt-Button {
	 	 	 display: inline-block;
	 	 	 float: left;
	 	 	 width: 145px;
	 	 	 height: 100px;
	 	 	 border: 1px solid rgba(0,0,0,0.23);
	 	 	 background: #ff6600;
	 	 	 border-radius: 6px;
	 	 	 box-shadow: inset -1px 0px 0px rgba(255,255,255,0.41), inset
1px 0px 0px rgba(255,255,255,0.21), inset 0px -1px 0px
rgba(0,0,0,0.21), inset 0px 1px 0px rgba(255,255,255,0.41), 0px 1px
2px rgba(0,0,0,0.21);
	 	 	 text-align: center;
	 	 	 font-size: 14px;
	 	 	 margin: 5px;
	 	 	 font-weight: bold;		 	
	 	 	 text-shadow: 0px 1px 1px rgba(0,0,0,0.49);
	 	 	 color: white;
	 	 	 line-height: 124px;
}
Saturday, June 15, 13
debugging
• First Class Java Debugging on your IDE
• Gwt Pretty Compile! and debug
Javascript in your browser
Saturday, June 15, 13
What about other OSs
• iOS, works like charm
• Blackberry
• Windows Phone
• Tablets?!
• Desktop?!?
Saturday, June 15, 13
What can I really build?
• Anything!
• but why not going native for games
• lists, carousels, forms...
• make use of current js
• windows phone?? seriously?!?
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
thanks to...
Saturday, June 15, 13
special thanks to my
mentor Naci Dai
Saturday, June 15, 13
</slides>
murat@muratyener.com
blogs.eteration.com
devchronicles.com
@yenerm
114028338330916709688
like what you see??
click to download!
@gdgistanbul
Saturday, June 15, 13

More Related Content

Similar to Android WebView, The Fifth Element

From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
edill3484
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Matt Raible
 
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
Marco Pas
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
Marco Pas
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Alina Vilk
 
Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016
Steve Hoffman
 
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Codemotion
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric Car
GR8Conf
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump Start
Troy Miles
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
Bramus Van Damme
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
Tony Parisi
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Alex Theedom
 
FITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning CurveFITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning Curve
Little Miss Robot
 
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
MarcinStachniuk
 
First steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - PordenoneFirst steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - Pordenone
Giampaolo Trapasso
 
Using Geoscript Groovy
Using Geoscript GroovyUsing Geoscript Groovy
Using Geoscript Groovy
Jared Erickson
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
Yottaa
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
Anis Ahmad
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
Cristiano Costantini
 

Similar to Android WebView, The Fifth Element (20)

From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails ...
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
 
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
Встреча Google Post IO ( Владимир Иванов, Катерина Заворотченко и Сергей Комлач)
 
Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016Enabling Microservice @ Orbitz - GOTO Chicago 2016
Enabling Microservice @ Orbitz - GOTO Chicago 2016
 
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
Gianluca Esposito - It's time to go Native! (with JavaScript and React Native...
 
Using Grails to Power your Electric Car
Using Grails to Power your Electric CarUsing Grails to Power your Electric Car
Using Grails to Power your Electric Car
 
jQuery Mobile Jump Start
jQuery Mobile Jump StartjQuery Mobile Jump Start
jQuery Mobile Jump Start
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
 
Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"Mobile Java with GWT: Still "Write Once, Run Everywhere"
Mobile Java with GWT: Still "Write Once, Run Everywhere"
 
FITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning CurveFITC 2013 - The Technical Learning Curve
FITC 2013 - The Technical Learning Curve
 
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
Java Web Start czyli jak żyć z tą dziwną technologią & Continuous Delivery w ...
 
First steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - PordenoneFirst steps with GWT @ Google IO Extended - Pordenone
First steps with GWT @ Google IO Extended - Pordenone
 
Using Geoscript Groovy
Using Geoscript GroovyUsing Geoscript Groovy
Using Geoscript Groovy
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
 
GWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 PanicGWTcon 2015 - Beyond GWT 3.0 Panic
GWTcon 2015 - Beyond GWT 3.0 Panic
 

More from Murat Yener

Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with Kotlin
Murat Yener
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
Murat Yener
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Murat Yener
 
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
Murat Yener
 
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse LibraJavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
Murat Yener
 
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Murat Yener
 
Eclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client RoundupEclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client Roundup
Murat Yener
 

More from Murat Yener (7)

Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with Kotlin
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
 
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
The Horoscope of OSGi: Meet Eclipse Libra, Virgo and Gemini (JavaOne 2013)
 
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse LibraJavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
JavaOne 2012, OSGi for the Earthlings: Meet Eclipse Libra
 
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
Mobile Java with GWT, Still Write Once Run Everywhere (mGWT+Phonegap)
 
Eclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client RoundupEclipsist2009 Rich Client Roundup
Eclipsist2009 Rich Client Roundup
 

Recently uploaded

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 

Recently uploaded (20)

みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 

Android WebView, The Fifth Element

  • 1. Android, The Fifth Element Murat Yener, eteration @yenerm Saturday, June 15, 13
  • 2. who (the hell) am I?!? • Java, Flex, GWT, iOS, Android developer • Principle Mentor at Eteration • Eclipse Committer • GDG (GTUG) Istanbul Organizer • Conference Speaker Saturday, June 15, 13
  • 3. Me as an Android Developer Saturday, June 15, 13
  • 4. Me as an Android Developer Saturday, June 15, 13
  • 5. Me as an Android Developer Saturday, June 15, 13
  • 6. Me as an Android Developer Saturday, June 15, 13
  • 7. Me as an Android Developer Saturday, June 15, 13
  • 8. Me as an Android Developer Saturday, June 15, 13
  • 9. Me as an Android Developer Saturday, June 15, 13
  • 10. Me as an Android Developer Saturday, June 15, 13
  • 11. Me as an Android Developer Saturday, June 15, 13
  • 12. what (the hell) is the fifth element?!? Saturday, June 15, 13
  • 13. what (the hell) is the fifth element?!? • Activities Saturday, June 15, 13
  • 14. what (the hell) is the fifth element?!? • Activities • Intents Saturday, June 15, 13
  • 15. what (the hell) is the fifth element?!? • Activities • Intents • Services Saturday, June 15, 13
  • 16. what (the hell) is the fifth element?!? • Activities • Intents • Services • Widgets Saturday, June 15, 13
  • 17. what (the hell) is the fifth element?!? • Activities • Intents • Services • Widgets • ... and the WebView (hybrid apps, web apps) Saturday, June 15, 13
  • 18. an HTML5 talk?!? • Facebook killed HTML5 app, Zuckerberg said HTML5 is not there yet!! • Sencha Built FastBook fb.html5isready.com • LinkedIn moved to native • anybody think its better now? Saturday, June 15, 13
  • 19. an HTML5 talk?!? • Facebook killed HTML5 app, Zuckerberg said HTML5 is not there yet!! • Sencha Built FastBook fb.html5isready.com • LinkedIn moved to native • anybody think its better now? Saturday, June 15, 13
  • 20. wait its too complicated! • How many of you have web development experience? • How many of you develop native mobile apps? • How many of you don’t like web development just because javascript Saturday, June 15, 13
  • 21. wait its too complicated! • How many of you have web development experience? • How many of you develop native mobile apps? • How many of you don’t like web development just because javascript Saturday, June 15, 13
  • 22. but it is slow! • building games? • 3d physics? • image processing? • ...? Saturday, June 15, 13
  • 23. but it is slow! • building games? • 3d physics? • image processing? • ...? Saturday, June 15, 13
  • 24. but it is slow! • building games? • 3d physics? • image processing? • ...? Nooo! We just build lists and detail pages!! (well, most of the time...) Saturday, June 15, 13
  • 25. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 26. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 27. “We started with the existing Jake2 Java port of the Quake II engine, then used the Google Web Toolkit (along with WebGL, WebSockets, and a lot of refactoring) to cross-compile it into Javascript. You can see the results in the video above — we were honestly a bit surprised when we saw it pushing over 30 frames per second on our laptops (your mileage may vary)!” from Google Code Blog... Wait!! Is this web?!? • Angry Birds for Chrome (GWT) • Quake on Mobile http://media.tojicode.com/q3bsp/ (requires Chrome Beta with WebGL) Saturday, June 15, 13
  • 28. Mobile HTML5 Frameworks • jQueryMobile • Sencha • Zepto • mGWT, hey wait! no javascript?!? Seriously?!! Saturday, June 15, 13
  • 29. Java to Javascript?!? • GWT Compiler does the magic • Optimized, high performance js • Cross browser compability (upto ie6) Saturday, June 15, 13
  • 37. Setup • get the source from https://code.google.com/p/mgwt/ • or download the jar • or use Maven! <dependency>       <groupId>com.googlecode.mgwt</groupId>       <artifactId>mgwt</artifactId>       <version>1.1.2</version> </dependency> Saturday, June 15, 13
  • 38. Hello World public class MGWTEntryPoint implements EntryPoint {   public void onModuleLoad() {     // set viewport and other settings for mobile     MGWT.applySettings(MGWTSettings.getAppSetting());     // build animation helper and attach it     AnimationHelper animationHelper = new AnimationHelper();     RootPanel.get().add(animationHelper);     // build some UI     LayoutPanel layoutPanel = new LayoutPanel();     Button button = new Button("Hello mgwt");     layoutPanel.add(button);     // animate     animationHelper.goTo(layoutPanel, Animation.SLIDE);   } } Saturday, June 15, 13
  • 39. Add a little spice: Phonegap • Geolocation • Camera • Accelerometer • Compass • Phonebook • File System • even NFC Saturday, June 15, 13
  • 40. Add a little spice: Phonegap • Geolocation • Camera • Accelerometer • Compass • Phonebook • File System • even NFC Basically any Native API !! Saturday, June 15, 13
  • 41. Phonegap Button button = new Button("Hello mgwt"); button().addTapHandler(new TapHandler() { @Override public void onTap(TapEvent event) { phoneGap.getNotification().alert("Done!!"); } }); layoutPanel.add(button); Saturday, June 15, 13
  • 42. more Phonegap phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){ @Override public void onSuccess(Position position) { // check accuracy if (position.getCoordinates().getAccuracy() > 11) { raceView.getLabel().setText("Error: Accuracy"); } // geolocation returns mps, multiply with 3.6 to convert to kph double speed = 3.6 * position.getCoordinates().getSpeed(); if (speed > 0.2) {// if going raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy()); currentLocation = position; // got the position now can start! start(); // stop if the threshold is reached if (isGoing && speed >= 60) { MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher); endLocation = position; calculate(); } } else {// if stoped raceView.getLabel().setText("get ready!!"); isGoing = false; } } @Override public void onFailure(PositionError error) { MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location"); } }); Saturday, June 15, 13
  • 43. more Phonegap phoneGap.getGeolocation().watchPosition(geolocationOptions, new MyGeolocationCallback(){ @Override public void onSuccess(Position position) { // check accuracy if (position.getCoordinates().getAccuracy() > 11) { raceView.getLabel().setText("Error: Accuracy"); } // geolocation returns mps, multiply with 3.6 to convert to kph double speed = 3.6 * position.getCoordinates().getSpeed(); if (speed > 0.2) {// if going raceView.getLabel().setText(speed + "km @" + position.getCoordinates().getAccuracy()); currentLocation = position; // got the position now can start! start(); // stop if the threshold is reached if (isGoing && speed >= 60) { MgwtAppEntryPoint.phoneGap.getGeolocation().clearWatch(geolocationWatcher); endLocation = position; calculate(); } } else {// if stoped raceView.getLabel().setText("get ready!!"); isGoing = false; } } @Override public void onFailure(PositionError error) { MgwtAppEntryPoint.phoneGap.getNotification().alert("Problem getting location"); } }); yes, you can really do that with mgwt/phonegap Saturday, June 15, 13
  • 44. even more... public void onTap(TapEvent event) { final MCheckBox check = ((MCheckBox) event.getSource()); if (check.getValue()) { if (TWITTER.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter"); else if (FACEBOOK.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook"); profileView.getBrowser().addLocationChangeHandler(new ChildBrowserLocationChangedHandler() { @Override public void onLocationChanged(ChildBrowserLocationChangedEvent event) { //Do the login... } }); } } Saturday, June 15, 13
  • 45. even more... public void onTap(TapEvent event) { final MCheckBox check = ((MCheckBox) event.getSource()); if (check.getValue()) { if (TWITTER.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/twitter"); else if (FACEBOOK.equalsIgnoreCase(type)) profileView.getBrowser().showWebPage(Service.BASE_URL + "auth/facebook"); profileView.getBrowser().addLocationChangeHandler(new ChildBrowserLocationChangedHandler() { @Override public void onLocationChanged(ChildBrowserLocationChangedEvent event) { //Do the login... } }); } } Make use of the Phonegap Plugins!! Saturday, June 15, 13
  • 46. mgwt experienced • MVP • Model • View • Presenter • Maven Archetype Saturday, June 15, 13
  • 47. mgwt experienced • MVP • Model • View • Presenter • Maven Archetype Saturday, June 15, 13
  • 48. mvp?!? • Code your UI in View • and logic in Acitivity classes • sound familiar?!? • easy navigation • a bit of boilerplate code Saturday, June 15, 13
  • 49. mvp?!? • Code your UI in View • and logic in Acitivity classes • sound familiar?!? • easy navigation • a bit of boilerplate code Saturday, June 15, 13
  • 50. calling the backend • GWT-RPC • JSONP & AutoBean JsonpRequestBuilder jsonp = new JsonpRequestBuilder(); String url = URL.encode(JSON_URL + "/sendData/" + “HelloWorld”); jsonp.requestObject(url, new AsyncCallback<JavaScriptObject>() { @Override public void onFailure(Throwable caught) { MgwtAppEntryPoint.phoneGap.getNotification().alert(caught.getMessage()); } @Override public void onSuccess(JavaScriptObject result) { JSONObject jsObj = new JSONObject(result); AutoBean<Score[]> bean = AutoBeanCodex.decode(factory, MyModel[].class, jsObj.toString()); Score[] scores = bean.as(); scoresCallback.onResponse(scores); } }); Saturday, June 15, 13
  • 51. Calling Native JS • Use any existing Javascript • Use Javascript in a type safe way • BUT dont mess touch events • AND beware you are not in safe zone anymore Saturday, June 15, 13
  • 52. JSNI public native static String key(int index) /*-{ return $wnd.localStorage.key(index); }-*/; public native static void setItem(String key, String value) /*-{ $wnd.localStorage.setItem(key, value); }-*/; public native static String getItem(String key) /*-{ return $wnd.localStorage.getItem(key); }-*/; public native static void removeItem(String key) /*-{ $wnd.localStorage.removeItem(key); }-*/; public native static void clear() /*-{ $wnd.localStorage.clear(); }-*/; Saturday, June 15, 13
  • 53. gwtquery public void onModuleLoad() {   //Hide the text and set the width and append an h1 element   $("#text").hide()     .css("width", "400px")     .prepend("<h1>GwtQuery Rocks !</h1>");         //add a click handler on the button     $("button").click(new Function(){       public void f() {         //display the text with effects and animate its background color         $("#text").as(Effects)           .clipDown()           .animate("backgroundColor: 'yellow'", 500)           .delay(1000)           .animate("backgroundColor: '#fff'", 1500);       }     }); } Saturday, June 15, 13
  • 54. skinning • offers default themes for • android • iOS/iOS Retina • Blackberry • easy to create yours https://code.google.com/p/mgwt/wiki/Styling //append your own css as last thing in the head MGWTStyle.injectStyleSheet("yourcssfile.css"); Saturday, June 15, 13
  • 55. wait! css in java?? .mgwt-Button { display: inline-block; float: left; width: 145px; height: 100px; border: 1px solid rgba(0,0,0,0.23); background: #ff6600; border-radius: 6px; box-shadow: inset -1px 0px 0px rgba(255,255,255,0.41), inset 1px 0px 0px rgba(255,255,255,0.21), inset 0px -1px 0px rgba(0,0,0,0.21), inset 0px 1px 0px rgba(255,255,255,0.41), 0px 1px 2px rgba(0,0,0,0.21); text-align: center; font-size: 14px; margin: 5px; font-weight: bold; text-shadow: 0px 1px 1px rgba(0,0,0,0.49); color: white; line-height: 124px; } Saturday, June 15, 13
  • 56. debugging • First Class Java Debugging on your IDE • Gwt Pretty Compile! and debug Javascript in your browser Saturday, June 15, 13
  • 57. What about other OSs • iOS, works like charm • Blackberry • Windows Phone • Tablets?! • Desktop?!? Saturday, June 15, 13
  • 58. What can I really build? • Anything! • but why not going native for games • lists, carousels, forms... • make use of current js • windows phone?? seriously?!? Saturday, June 15, 13
  • 62. special thanks to my mentor Naci Dai Saturday, June 15, 13