This Nokia example demonstrates how utilise the Share API on Nokia Asha software platform to share images and messages to various destinations. The app also implements OAuth authorisation for Facebook.
This example is hosted in GitHub: https://github.com/nokia-developer/status-shout
For more information on implementation, see the wiki: https://github.com/nokia-developer/status-shout/wiki
This example application is compatible with Nokia Asha software platform 1.1.
You can choose to share either a photo (image from the phone's file system) or a message. To select a photo, tap the image placeholder item above the text box. This will open a photo browser (provided by the FileSelection API). After a photo has been chosen, you can discard it by tapping the red button in the top-right corner of the image. A message can be composed by tapping the text box, which will open the virtual keyboard. Press the physical back button to hide the keyboard.
To share content, you have two options to choose from:
- Share using Share API within the app
- Tap the right icon button in the category bar. This will open the user interface provided by the API.
- Note that you can share either a photo or a message, but not both at the same time. If you have an image selected, it will be shared and the possible message will be not. To share a message, remove any selected image.
- Share using Share API with invocation
- Open an application, which implements image sharing using Share API, e.g. Gallery app provided by the platform.
- Share a selected image, e.g. long press a photo and select Share.
- From the share UI, select "Status Shout!".
- Status Shout! launches. You may add a caption to your photo.
- Follow the steps in "Share using Facebook (OAuth)" (below).
- Share using Facebook (OAuth)
- Tap the Facebook icon button in the category bar.
- If you have not yet been authenticated, the browser will be launched and you will be taken to Facebook website where you will prompted to provide your credentials. After a successful login, the access token is stored for later (so that you do not have to authenticate every time you want to share to Facebook) and your message will be shared to your timeline.
- If you had already been authenticated, the message you had composed will be shared to Facebook.
Note: When you compile the application yourself, you need to obtain a Facebook application ID to share content in Facebook. For more information, see https://developers.facebook.com/
You cannot install the application on the device with the IDE, but you can package the application. In Eclipse IDE, after you have imported the project, locate the Application Descriptor in the Package Explorer window and open it. Open the Overview tab (by default it is the first tab on the left) and click Create package. Select the destination directory and click Finish.
Connect the phone to the computer with USB cable or Bluetooth. Locate the application binary (.jar file). Copy the file to your phone, locate it and tap to install. After the application is installed, locate the application icon from the application menu and launch the application by selecting the icon.
|FacebookService||Implements the Facebook specific authorisation and provides a simple method for sharing a message to user's Facebook feed with HTTP Post.|
|OAuthService||An abstract base class of OAuth service specific implementations. Contains the common implementation for OAuth.|
|ShareApiManager||Implements sharing of images and messages with Share API. Implements the logic for managing invocations (sharing destination).|
|StatusShoutData||A singleton class managing the application specific data and its persistance.|
|MainView||The main user interface (UI) class of the application. Owns all the major class instances and manages the app logic.|
- Share API cannot be used to share both an image and a message. If an image has been selected, it is prioritised over a message.
- Facebook implementation is minimal, and there is no proper access token validation.
- No error handling for missing or poor network connectivity.
When selecting an image, there are sometimes artifacts shown on the screen briefly until the image is scaled.
See the license text file delivered with this project. The license file is also available online at https://github.com/nokia-developer/status-shout/blob/master/Licence.txt
- Version 1.1: Added sharing destination support and image sharing to Facebook.
- Version 1.0: The initial release.