nokia asha webinar: new api for social sharing in nokia asha sdk 1.1
DESCRIPTION
Your Java™ apps for Nokia Asha software platform 1.1 can now be enabled to post content to popular social media channels, using the new Share API. This webinar gives you a hands-on introduction to delivering social media experiences to users of Nokia Asha phones using Nokia Asha SDK 1.1. The webinar opens with an overview of the Share API and how to implement it in your Nokia Asha apps. Pranav Gothadiya, product owner for the Nokia Asha SDK, then shows you the key features of the Share API. This is followed by a demonstration of how to use the API to authenticate your app with social media services, using the OAuth 2.0 protocol. Next Pranav conducts a code walkthrough for an entire example application that you can download and modify. He’ll finish by demonstrating how to incorporate the popular emoji characters into your apps. Find out more about: * the Share API : http://developer.nokia.com/Resources/Library/Java/#!developers-guides/data-handling/share-api.html * OAuth 2.0 protocol support: http://developer.nokia.com/Resources/Library/Java/#!developers-guides/data-handling/oauth-20.html *Emoji support: http://developer.nokia.com/Resources/Library/Java/#!developers-guides/data-handling/emoji.html * the Nokia Asha SDK: http://developer.nokia.com/Develop/asha/java/tools.xhtml * getting started with the Nokia IDE: http://developer.nokia.com/Develop/asha/java/start/nokia_ide/ * getting started with the NetBeans: http://developer.nokia.com/Develop/asha/java/start/netbeans/ * all the new APIs in Nokia Asha software platform 1.1: http://developer.nokia.com/Resources/Library/Java/#!whats-new/java-runtime-for-nokia-asha-software-platform-110.html Check out the current webinar schedule here: http://www.developer.nokia.com/webinars and https://developer.nokia.com/Develop/asha/learning/TRANSCRIPT
SOCIAL SHARING USING NOKIA ASHA SDK 1.1 (BETA)
Pranav Gothadiya Product Owner Nokia Asha SDK [email protected]
CONTENTS • Introduction to Social Sharing • What is Share API? • Using Share API • Application development using Share API
- Share contents from MIDlet - Share contents from other apps - Fastlane integration
• Oauth 2.0 • Emoji Support • Additional Information
INTRODUCTION TO SOCIAL SHARING • Sharing content with social media • Built-in feature of Share API through content handler • Oauth 2.0 based authentication support • Use unicode base emoticons in content sharing
WHAT IS SHARE API ?
• Its a convenient overlay to JSR-211 for simple social sharing of content
• Platform implements this social sharing support • Content handled either by content type/content handler ID • Application development:
- Implementing source for sharing - Implementing destination for sharing
APPLICATION SIDE IMPLEMENTATION Code snippet: String[] args = new String[]{"text=" + this.sharedText.getString()};
String mime = "text/plain";
Registry registry = Registry.getRegistry(this.getClass().getName());
Invocation invocation = new Invocation(null, mime, "com.nokia.share"); invocation.setAction("share");
invocation.setArgs(args);
invocation.setResponseRequired(false);
registry.invoke(invocation);
SUPPORTED ARGUMENTS • url: url
- The url to the file that is being shared (many supported) n - This is used when the shared items are files
String[] args = new String[]{“url=file:///Phone/_my_picture/img1.png"};
SUPPORTED ARGUMENTS • url: url
- The url to the file that is being shared (many supported) n. This is used when the shared items are files
• text: text
- Textual content that is being shared - This is used when the shared items are texts
String[] args =
new String[]{"text=file:///Phone/_my_picture/img1.png"};
SUPPORTED ARGUMENTS • url: url
- The url to the file that is being shared (many supported) n. This is used when the shared items are files
• text: text
- Textual content that is being shared. This is used when the shared items are texts
For Fastlane integration • id
- A unique identifier of the share transaction. - It can be stored for future reference. - Used with “open-shared” action.
SUPPORTED SHARE TYPES
Following mime types can be registered: • image/* or specific image types • audio/* or specific audio types • video/* or specific video types • text/plain type
“No limit on size or types by the Share API, but there might be limitations on the individual share destinations”
SHARE CONTENTS FROM MIDLET
• Generate arguments to pass content • Specify mime type of the content • Get content handler Registry • Create invocation • Invoke
SHARE CONTENTS FROM OTHER APPLICATIONS
• Make JAD entry for content handler • Create ContentHandlerServer • Get Invocation from content handler server • Get the arguments (content) • Use content to share
CONTENT INVOCATION
Content can be invoked from following native apps: • Sharing link and bookmark from Browser • Sharing files from:
- Gallery - Music player - Video player - Camera
• Sharing contacts and calendars
FAST LANE INTEGRATION • Destination must register to action "open-shared“ • Destination can deep link the user into the right view • Fastlane item is added if the destination returns with Invocation.OK handler.finish(invocation, Invocation.OK);
• Fastlane item is added if the destination returns Invocation.CANCELLED and quit contentHandlerServer.finish(invocation, Invocation.CANCELLED);
• Share UI considers that sharing has ended, but does not create a Fastlane item because the sharing was not completed
contentHandlerServer.finish(invocation, Invocation. INITIATED);
OAUTH 2.0 SUPPORT • Allows to access server resources on behalf of the resource owner • Secure open authorization protocol • Authentication handled by Nokia browser • Invocation happens through Content Handler • Browser - Performs Oauth 2.0 based authentication - Get back the access token - MIDlet app to use that access token further
22 November 2013 / Slide no 15
OAUTH 2.0 IMPLEMENTATION
EMOJI SUPPORT • Japanese term which represents a picture • It expresses an visual/idea in messaging • Standard Unicode set: - Large number of emoji chars - Range: U+1F300 to 1F64F • Surrogate pair: - Maps an emoji character to a pictograph - Nokia Asha Platform has built-in implementation • Back to UTF16 char: - While reading the char from Java text component
EMOJI SUPPORT - IMPLEMENTATION • Constants
• Create surrogate par from Unicode character
• Get Unicode character back from surrogate pair
MORE INFORMATION Overview - http://developer.nokia.com/Develop/asha/java/start/ Downloads - http://developer.nokia.com/Develop/asha/java/tools.xhtml - http://projects.developer.nokia.com/LWUIT_for_Series_40 Guides - Nokia Asha Design Guide: http://developer.nokia.com/Resources/Library/Asha_UI/ - Porting Guide: http://developer.nokia.com/Resources/Library/Porting_to_Nokia_Asha/ - Documentation: http://developer.nokia.com/Develop/asha/java/resources/docs/ - Training Videos: http://developer.nokia.com/Develop/asha/learning.xhtml - Code Examples: http://developer.nokia.com/Develop/asha/java/resources/code/
THANK YOU. QUESTIONS? For more information: https://developer.nokia.com/Develop/asha/learning.xhtml