Upload
snig178
View
1.809
Download
0
Embed Size (px)
DESCRIPTION
My slides from Over the Air, 4th-5th April 2008.
Citation preview
Mobile Mashups!Over the Air - 4th April 2008
Owen Griffin, Vodafone Group R&D
These slides are available on Google Docs
- Brief Introduction- Betavine- Web APIs- Web Mashups- Mobile Mashups
Who am I?
This is who I work for
Summertime in Newbury
Where I work...
What I do...
Research and Development
What do I do?
What I also do...
What do I do?
www.betavine.net
Member of the Betavine Development Team"An Open Community & Resource Website"
www.betavine.mobi
My web presence
FlickrPublish photoshttp://www.flickr.com/photos/snig/
GmailEmailhttp://www.gmail.com/
BloglinesRSS Aggregatorhttp://www.bloglines.com/
del.icio.usShare bookmarkshttp://del.icio.us/snig/
FacebookWaste timehttp://www.facebook.com/
Web API Example
http://www.flickr.com/services/api/
Allows you to:Search photosFind contactsTransform photosContribute
Uses HTTP withSOAPJSONXML-RPCREST
Allows you to upload content from your mobile onto Flickr
Example Mashups
MashupsGoogleMaps mashups
Dart MapsBerkshire FloodsGoogle Maps Mania
Flickr MashupsRetrievrFastr
ServicesText Messages
Simple SMS messagesWAP Push links
Exchange of web linksApplication Trigger
Prompt J2ME applications to launchWindows Mobile library
Betavine Applications and DownloadsList applications by different attributes
CostCredit-based frameworkWhen you register you get 100 creditsTo get more email the webmaster
Overview
Test modeUses a Developer UAIDNo messages are sentNo credits are usedAllows you to test the response from the API
Authentication
Live modeUses a real UAID tied to Application and UserMessages are sent into the networkUser's credits are spentActive when a User downloads an application from Betavine
What is a UAID?User Application IDentifierUniquely identifiers a user to an application Allows an Application to send messages originating from the User without having any knowledge of their mobile number.
Response formats
PlainSimple plain textDesigned for simple translationQuick easy, and dirty
XMLSimple, well-formed documents
JSONJavascript Object NotationAllows you to easily use the API within web pages or widgets
To change the response format alter the suffix at the end of the API method URL.
Sending SMS
Method URL:http://www.betavine.net/api/send/sms.plain
Parameters:uaiddestmessage
Example Response:OK 1.1TRANSACTION 6176MESSAGE 5875 2008-03-28 14:25:09.0
Sending WAP push
Method URL:http://www.betavine.net/api/send/wappush.json
Parameters:uaiddestmessageurl
Example Response:{"response":{"transaction":{"id":6177,"messages":[{"sentAt":"2008-03-28 14:27:02.0","status":1,"id":5876}]},"status":"OK","method":"send\/wappush","version":"1.1"}}
Ugly code snippet!
Sending App Trigger
Method URL:http://www.betavine.net/api/send/trigger.xml
Parameters:uaiddestmessageport
Example Response:<response version="1.1"><method>send/trigger</method><status>OK</status><transaction><id>6178</id><messages><message><id>5877</id><status>1</status><deliveredAt/><sentAt>2008-03-28 14:48:09.0</sentAt></message></messages></transaction></response>
Ugly code snippet!
Message status
Method URL:http://www.betavine.net/api/send/status.plain
Parameters:uaidtransactionmessage
The response will contain a delivered-at property. It will only work if the mobile has delivery reports turned on.
API Application Usage
http://www.betavine.net/web/guest/projects/api/usage
API Method Usage
http://www.betavine.net/web/guest/projects/api/usage
Betavine does not log the
contents of any messages sent.
Mobile Mashup Example
I'm going to write a Facebook application, with
a Mobile client.
Uber Picture PokePoke your friends by showing them your photo on their mobile!
(because Facebook notification's aren't quite intrusive enough) Consists of a Java Mobile MIDlet and a Facebook application.
The Facebook application uses the Betavine API to send an Application Trigger message to the MIDlet.
The message contains a URL to an image. The image is downloaded and displayed on the mobile.
- http://apps.facebook.com/uberpicturepoke/
Uber Picture Poke - MIDlet
What the UberPicturePoke MIDlet will do:Listen for trigger messagesOn receipt of a message1. Download the profile image2. Display the image to the user
Application Trigger messages sent by the API are Java Push messages.
It requires a Push Registry on the mobile. This is defined in MIDP 2.0 (JSR 118).
We'll need a compatible phone, such as the N95.
Listening for messages
JAD File Properties:MIDlet-Push-<n>
sms://:<port number>,<class>,<restriction>sms://:12345,net.betavine.UPPMidlet,*socket://:5000,AnotherMIDlet,192.168.1.50
MIDlet-Permissionsjavax.microedition.io.Connector.smsjavax.microedition.io.Connector.socketjavax.wireless.messaging.sms.receivejavax.wireless.messaging.sms.sendjavax.microedition.io.Connector.httpjavax.microedition.io.PushRegistry
MIDlet Push Registry
Implement MessageListenerpublic void notifyIncomingMessage(MessageConnection messageConnection);
Create a message connectionString url = sms://:1111";this.messageConnection = (MessageConnection) Connector.open(url);this.messageConnection.setMessageListener(this);
Check how the MIDlet was startedthis.connections = PushRegistry.listConnections(true);
Create a Thread which listens for new messages
Message Received
What happens when a message is received by our MIDlet. The run() method of our Thread.
Obtain the messageMessage message = this.messageConnection.receive();if (message == null) break; // OUCHTextMessage textMessage = (TextMessage) message;String text = textMessage.getPayloadText();
Display the Image in our FormHttpConnection connection = (HttpConnection) Connector.open(url);Image image = Image.createImage(connection.openInputStream());this.imageItem.setImage(image);
Facebook ApplicationThe Facebook application needs to:- List all of our friends which also have this application- Send an Application Trigger message to the MIDlet
Facebook API is extensive.. - http://developer.facebook.com/
The method we need is- Friends.getAppUsers
There is a helpful PHP library which interfaces with the API.
Facebook allows us access to all sorts of information, but.. does not let us find the users' mobile number.
Sending Messages using PHPSending the Application Trigger message:// Build the API call URL$url = "http://www.betavine.net/api/send/trigger.plain?";$url = $url . "uaid=" . $uaid;$url = $url . "&dest=" . $mobile;$url = $url . "&message=" . $picture;$url = $url . "&port=" . $port;
// Initialise CURL// DELETED
// Call the Betavine API with the generated URL$response = curl_exec($curl);
Uber Picture Poke - Demo
Uber Picture Poke - Demo
Future Additions
The Betavine API is a work-in-progess.
In the next few months you can expect the following:OAuth authenticationDevice capability queryApplication compatibility queriesLocation API
I am looking for beta-testers.. So contact me at [email protected] to give it a go.
References
- betavine.net developer resources
- betavine.mobi
- Reuters - Global cellphone penetration reaches 50 pct
- Social Network Usage Statistics
- Flickr API
- Facebook Developers