21
devicestatus
deviceapis.devicestatus.getPropertyValue(	 

	 	 	 	 function	 (value)	 {	 $("#device	 .cellular-roaming-status").html
(value);	 },	 
	 	 	 	 errorCallback,	 
	 	 	 	 {	 aspect:	 "CellularNetwork",	 property	 :	 "isRoaming"}
);	 	 


deviceapis.devicestatus.getPropertyValue(	 
	 	 	 	 function	 (value)	 {	 $("#device	 .cellular-signal-strength").html
(value);	 },	 	 
	 	 	 	 function	 (e)	 {	 ...	 },	 
	 	 	 	 {	 aspect:	 "CellularNetwork",	 property	 :	 "signalStrength"}
);	 	 

                                                                             22
devicestatus - vocabulary
    Aspect                                 Properties                                  Components

    Battery                batteryLevel, batteryBeginCharged                              _default

CellularHardware                              status                                      _default

CellularNetwork       isInRoaming, signalStrength, operatorName                           _default

    Device                      imei, model, version, vendor                              _default
                   resolutionHeight, pixelAspectRatio, dpiY, resolutionWidth, dpiX,
    Display                                  colorDepth
                                                                                      _active, _default

  MemoryUnit                   size, removable, availableSize                             _default

OperatingSystem              language, version, name, vendor                          _active, _default

  WebRuntime         wacVersion, supportedImageFormats, version, name, vendor         _active, _default

 WiFiHardware                                 status                                      _default

 WiFiNetwork                ssid, signalStrength, networkStatus                       _active, _default



                                                                                                          23
24
messaging
var msg = deviceapis.messaging.createMessage(
      deviceapis.messaging.TYPE_SMS);
var to = [];


to.push($("#toSMS").val());


msg.body = $("#smsMessage").val();
msg.to = to;


deviceapis.messaging.sendMessage(function() {
      alert("Send!");
}, onErrorCallback, msg);



                                                25
26
geolocation
navigator.geolocation.getCurrentPosition(
 function (position) {
      var point = new google.maps.LatLng(
            position.coords.latitude, position.coords.longitude);
      var mapOption = {
       zoom: 15,
       center: point,
       mapTypeId: google.maps.MapTypeId.ROADMAP
      };


      var mapContainer = document.getElementById("map");


      mapContainer = new google.maps.Map(mapContainer, mapOption);


      currentPositionMarker = new google.maps.Marker({
       position: point,
       map: mapContainer,
       title: "Here!!"
      });
});


                                                                     27
28
contact

var oContact = deviceapis.pim.contact.getAddressBooks(function (arr) {

      arr[0].findContacts(function (addr) {
         for (var i = 0; i < addr.length && i < 50; i++) {
           var firstName = (addr[i].firstName == undefined) ? '' : addr[i].firstName;
             var lastName = (addr[i].lastName == undefined) ? '' : addr[i].lastName;
             var phoneNumbers = addr[i].phoneNumbers;


             $('#contact-list').append("<li><a href='#contact-detail'>"+lastName+" "+firstName+"</li>");
         }


          $('#contact-list').listview('refresh');
      }, function (e) { ... },
      { filter });
});




                                                                                                           29
30
ax.ext.net
function getRSSFeed(feed) {
 $.mobile.pageLoading();

    $("#cross-domain-rss").empty();

    ax.ext.net.get(feed, function (result) {
     $($.parseXML(result.data)).find("item").each( function () {
      var title = $(this).find("title").text();
      var pubDate = $(this).find("pubDate").text();
      var author = $(this).find("author").text();
      var thumbnail = $(this).find(
       "[nodeName='media:thumbnail']").attr("url");

       if (thumbnail == undefined)
         $("#cross-domain-rss").append(
           "<li><a href='#'><h3>"+title+"</h3><p>"+pubDate+"</p></a></li>");
       else
         $("#cross-domain-rss").append(
           "<li><a href='#'><img src='"+thumbnail+"'><h3>"+
           author+"</h3><p>"+title+"</p></a></li>");
     });

      $("#cross-domain-rss").listview('refresh');
      $.mobile.pageLoading(true);
    }, onErrorCallback);
}


                                                                               31
32
앱스프레소를 이용한
실전 하이브리드앱 개발


               33
Q&A



      34
That’s all folks



                   35

앱스프레소를 이용한 모바일 앱 개발(2)

  • 1.
  • 2.
    devicestatus deviceapis.devicestatus.getPropertyValue( function (value) { $("#device .cellular-roaming-status").html (value); }, errorCallback, { aspect: "CellularNetwork", property : "isRoaming"} ); deviceapis.devicestatus.getPropertyValue( function (value) { $("#device .cellular-signal-strength").html (value); }, function (e) { ... }, { aspect: "CellularNetwork", property : "signalStrength"} ); 22
  • 3.
    devicestatus - vocabulary Aspect Properties Components Battery batteryLevel, batteryBeginCharged _default CellularHardware status _default CellularNetwork isInRoaming, signalStrength, operatorName _default Device imei, model, version, vendor _default resolutionHeight, pixelAspectRatio, dpiY, resolutionWidth, dpiX, Display colorDepth _active, _default MemoryUnit size, removable, availableSize _default OperatingSystem language, version, name, vendor _active, _default WebRuntime wacVersion, supportedImageFormats, version, name, vendor _active, _default WiFiHardware status _default WiFiNetwork ssid, signalStrength, networkStatus _active, _default 23
  • 4.
  • 5.
    messaging var msg =deviceapis.messaging.createMessage( deviceapis.messaging.TYPE_SMS); var to = []; to.push($("#toSMS").val()); msg.body = $("#smsMessage").val(); msg.to = to; deviceapis.messaging.sendMessage(function() { alert("Send!"); }, onErrorCallback, msg); 25
  • 6.
  • 7.
    geolocation navigator.geolocation.getCurrentPosition( function (position){ var point = new google.maps.LatLng( position.coords.latitude, position.coords.longitude); var mapOption = { zoom: 15, center: point, mapTypeId: google.maps.MapTypeId.ROADMAP }; var mapContainer = document.getElementById("map"); mapContainer = new google.maps.Map(mapContainer, mapOption); currentPositionMarker = new google.maps.Marker({ position: point, map: mapContainer, title: "Here!!" }); }); 27
  • 8.
  • 9.
    contact var oContact =deviceapis.pim.contact.getAddressBooks(function (arr) { arr[0].findContacts(function (addr) { for (var i = 0; i < addr.length && i < 50; i++) { var firstName = (addr[i].firstName == undefined) ? '' : addr[i].firstName; var lastName = (addr[i].lastName == undefined) ? '' : addr[i].lastName; var phoneNumbers = addr[i].phoneNumbers; $('#contact-list').append("<li><a href='#contact-detail'>"+lastName+" "+firstName+"</li>"); } $('#contact-list').listview('refresh'); }, function (e) { ... }, { filter }); }); 29
  • 10.
  • 11.
    ax.ext.net function getRSSFeed(feed) { $.mobile.pageLoading(); $("#cross-domain-rss").empty(); ax.ext.net.get(feed, function (result) { $($.parseXML(result.data)).find("item").each( function () { var title = $(this).find("title").text(); var pubDate = $(this).find("pubDate").text(); var author = $(this).find("author").text(); var thumbnail = $(this).find( "[nodeName='media:thumbnail']").attr("url"); if (thumbnail == undefined) $("#cross-domain-rss").append( "<li><a href='#'><h3>"+title+"</h3><p>"+pubDate+"</p></a></li>"); else $("#cross-domain-rss").append( "<li><a href='#'><img src='"+thumbnail+"'><h3>"+ author+"</h3><p>"+title+"</p></a></li>"); }); $("#cross-domain-rss").listview('refresh'); $.mobile.pageLoading(true); }, onErrorCallback); } 31
  • 12.
  • 13.
  • 14.
    Q&A 34
  • 15.