A cloud based solution for
enterprise mobility: Putting
Windows Phone 7 into context
Dr. Mícheál Ó Foghlú – CTO
Microsoft: Developer Developer Developer Digital Hub, Dublin
2
Mícheál Ó Foghlú
•
CTO FeedHenry
•
Executive Director Research
TSSG (2004--2010)
•
Prolog, Lisp, Pascal, C, C++,
Java, Perl, Python, JavaScript
•
Networking: IPv6, routing
•
Services: Composed
Services, Web Services
@mofoghlu
mofoghlu-at-feedhenry.com http://www.ofoghlu.net/log
About FeedHenry
•
A spin-out company from the TSSG in
Waterford Institute of Technology
•
A hosted enterprise service supporting
the development of cross-platform
mobile apps
4
TSSG @ WIT
•
Telecommunications Software & Systems
Group
•
154 projects, 73% led by TSSG, 40 active
each year
•
Avg project size $500k, Total budget >$80M
total funding (1996-2010)
•
150 researchers and developers
•
Convergence of Internet technologies and
telecommunications
FeedHenry App
Philosophy
•
Plain old HTML, JavaScript and CSS
•
No proprietary languages or formats
•
See your changes right away
•
Small footprint JavaScript API
•
Client
and
Server-side JavaScript
•
Create your own database tables
•
Access external web services without browser
cross-domain restrictions
6
App Big Picture
Application FeedHenry Server External Web Service
JSON request sent by FeedHenry API Web service request sent by FeedHenry API HTML, CSS and JavaScript Server-side JavaScript Your website
8
App API
•
JavaScript API exposes underlying
HTTP/JSON REST-based API
•
Functions are provided by the
$fh
object
•
Use the
act
method on the client-side to call
server-side methods (“actions”).
•
Use the
ent
method to load and save data
(“entities”) from your database tables
A Spell Check App
•
Put your HTML in
index.html
•
Put your CSS in
index.css
•
Put your client-side JavaScript in
index.js
•
Put your server-side JavaScript in
/ext/server/private/main.js
10
Client-side:
index.html
•
Plain old HTML
•
Use a link tag to pull in
index.css
•
Use a script tag to pull in
index.js
<link href="index.css" rel="stylesheet" type="text/css"> <h1>Spell Check</h1>
<input id="spell" value="" ></input>
<input id="button" type="button" value="Spell"></input> <div id="suggest"></div>
Client-side:
index.js
•
Use
$fh.act
to call server-side
spell
action.
$('#button').click(function() { $fh.act( { act:'spell',
req:
{word:$('#spell').val()} }
,function(
res
) {var suggest = 'Suggestion: '+
res.suggest
+'.'; $('#suggest').text(suggest);} ); });
Send this JSON:
{word:’ffood’}
Get this JSON back:
12
Server-side:
main.js
•
Write a
spell
function that calls Google
•
Get the word from the
$params
object
•
Use
$fh.web
for the web-service
function
spell()
{var word = $params.word; var res =
$fh.web
( {url: 'http://api.google.com/search/beta2', contentType: 'text/xml',
method: 'POST',
body: <…>{word}</…> } );
var suggest = res.body.descendants("c").toString();
return
{ suggest: suggest }
;}
Send this JSON back:
{suggest:’food’}
Make an XML web-service call to Google
App Preferences
•
Preferences let users customize Apps
•
Google needs an API key
•
Define a preference
•
Users can edit this
var prefs =
$fh.loadPrefs()
;var sendxml = <…>
<key xsi:type='xsd:string'>
{prefs.key}
</key> </…>Load as JSON:
{key:’GQ…’}
14
App Data Storage
•
We always have to wait for Google
•
Let
ʼ
s cache the suggestions!
•
Create an “entity” to store them:
App Entity API
•
No saved Suggestion? Go to Google, and save
result
•
Otherwise, just return saved result
var savedsugs =
$fh.ent('Suggest/list',
{'list-type':'criteria', criteria:[{field:'spell',type:'eq',value:word}]}); if( savedsugs.list.length == 0 ) { … go to Google … $
fh.ent('Suggest/create',
{fields:{spell:word,suggest:suggest}}); } else { suggest = savedsugs.list[0].fields.suggest; }List entities using query criteria
Create entities by passing in fields
16
Entity Operation
Parameters
•
Create:
•
Read:
•
Update:
•
Delete:
•
List:
{fields:{product:’apple’,price:10}} {guid:’ABC…’} {guid:’ABC…’, {fields:{product:’apple’,price:20}} {guid:’ABC…’} {'list-type':'criteria', criteria: [{field:‘price',type:‘le',value:30}] }Device Capabilities
• Go with the emerging standards:
• Device meta tags:
•
<meta name="viewport" content="user-scalable = no">
• Device APIs:
•
window.orientation
• HTML5
• Use FeedHenry API for cross-platform needs:
• $fh.contacts – access contact list
• $fh.send – send emails, SMS, etc
• $fh.geolocation – get location
18
Getting the Contacts List
•
Use the 'list' action; your callback function will
get the list of contacts on the device
$fh.contacts( {act:'list'}, function(res) { var ul = document.createElement('ul'); for( var i in res.list ) {
var li = document.createElement('li'); li.innerHTML = '<i>'+res.list[i].name+'</i>'; ul.appendChild(li); } document.getElementById('contacts').appendChild(ul); } );
Windows Phone 7
•
Export to source from FeedHenry platform
•
Compile and deploy using MS tools on
Windows 7 machine
•
Customers using Windows Mobile export
today
•
Plan to allow binary export in product
roadmap
20
Feed Henry Customers
End-to-end Apps that integrate with business systems
Cross-platform – Build once, Available everywhere
Server-side Logic and Security in the Cloud
Cloud - Platform-as-a-Service – Pay-as-you-Go Model
Scalability, Reliability and Performance Management
22
developer.feedhenry.com
Microso' are looking for the best Windows Phone 7 apps in Ireland, so if you’re a developer you’ve hit the jackpot!
Register your interest to be eligible to win some great prizes:
h"p://AppChallenge.ie
h"p://AppChallenge.ie
Grand Prize
€5,000 Audience Choice€2,500 Best Student AppBest Professional App €1,000
All winners also receive a brand new Xbox 360 Elite plus a 12 month Xbox Live Gold Membership
For more info visit
hVp://AppChallenge.ie
and/or email Dave daven@microso'.com
Microso' are looking for the best Windows Phone 7 apps in Ireland, so if you’re a developer you’ve hit the jackpot!
h"p://
h"p://
AppChallenge.ie
AppChallenge.ie
Great Prizes for the best apps
Great Prizes for the best apps
For more info
For more info
email Dave Northey
email Dave Northey
[email protected]
h"p://AppChallenge.ie
h"p://AppChallenge.ie
1. Register yourself as a Windows Phone 7 developer
2. Download the FREE tools you’ll need
3. Learn about building Windows Phone 7 apps
4. Build your app and upload it to the Marketplace
5. Watch the money roll in
26
Thanks
Mícheál Ó Foghlú
@mofoghlu mofoghlu-at-feedhenry.com http://www.ofoghlu.net/logAppendix
•
Samples of use of client phone
features:
– Accelerometer
– Camera
– Map
– Notify
28
FH API: accelerometer
function getCurrentAccel(){
$('#accelerometer .wait_message').show(); $fh.acc({interval: 0}, function(accel){
var resultHtml = ""; for(var key in accel){
resultHtml += "<p>" + key + " : "
+ accel[key] + "</p>"; }
$('#accelerometer .wait_message').hide();
$('#accelerometer .result').html(resultHtml).show(); }, function(msg){
alert("Error: " + msg); })
FH API: camera
function getCamera(type){
var sources = ['camera', 'photo'];
$fh.cam({act:'picture', source:sources[type]}, function(picdata){ var resultHtml = "<img src='data:image/"+picdata.format
+";base64,"+picdata.b64+"' width='300px' height='300px' ></img>"; $('#cam .result').html(resultHtml).show();
}, function(msg){
alert('Error: ' + msg); })
30
FH API: map
function showCurrentLocationInMap(){ $fh.geo({interval: 0}, function(res){
$fh.map({target: '#maps_div', lat: res.lat, lon: res.lon, zoom: 9}, function(res){ }, function(error){
alert(error); });
FH API: notify
function notify(method){
var methods = ['vibrate', 'beep', 'blink'];
$fh.notify({type: methods[method]}, function(){}, function(msg){ alert("Error : " + msg);
}) }