Intent
Need to create an interface for enabling Access to Content on Sunbird across different apps like Read Along,Games etc.
Note: Assumption of this specification is based on the apps being able to support these intents as part of their implementation.
Documentation is categorised into multiple sections:
Approaches
Technical Specification for third party apps
Param Data Supported
Data Sharing Table
Summary Event Spec
API Documentation
Intent Handling
Vendor Registration of Apps to Sunbird
Global Vendor Registration API
Local Vendor Registration by Deep Linking
Approaches
Expand | ||||||
---|---|---|---|---|---|---|
| ||||||
Approach 1 : (Deeper Integration)
Targeted Application need to fetch the data from platform. Understand the Content Metadata and play the content. Targeted Application need to respond back with Summary Data
Pros It can enable bazaar apps to index the content in their own environment. It could open up the Sunbird APIs for most of the bazaar players. Cons Tighter coupling for bazaar apps to be reliant on Sunbird APIs. Necessary for bazaar apps to understand the content metadata. Could mean a development effort for these players Any service disruptions,outage could spell trouble for these apps and also could potentially ending these apps taking a hit in terms of ratings.Data to be sent might be huge Spec is rigid. If the spec changes there can be inconsistency between various version of both apps |
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Approach 2 : (Lighter Integration)Intent provides basic information such as content do_id, context information & artifactUrl and mimeType. Bazaar Apps can launch the artifactUrl directly based on mimeType.
Pros Need to develop a secure mechanism to serve only sun bird specific resources. Cons Data to be sent might be huge Spec is rigid. If the spec changes there can be inconsistency between various version of both apps |
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Intent provides the basic information such as content URL, mimeType & user/session context.
Pros
Context Information Following are the contextual params passed to the reader app
|
Technical Specification for Third Party Apps
Expand | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||
|
Expand | ||
---|---|---|
|
|
All the reader apps need to send summary data back to Sunbird app via intent data.
SUMMARY Event Spec
Code Block | ||
---|---|---|
| ||
{ "edata": { "type": "", // Required. Type of summary. Free text. "session", "app", "tool" etc "mode": "", // Optional. "starttime": Long, // Required. Epoch Timestamp of app start. Retrieved from first event. "endtime": Long, // Required. Epoch Timestamp of app end. Retrieved from last event. "timespent": Double, // Required. Total time spent by visitor on app in seconds excluding idle time. "pageviews": Long, // Required. Total page views per session(count of CP_IMPRESSION) "interactions": Long, // Required. Count of interact events "envsummary": [{ // Optional "env": String, // High level env within the app (content, domain, resources, community) "timespent": Double, // Time spent per env "visits": Long // count of times the environment has been visited }], "eventssummary": [{ // Optional "id": String, // event id such as CE_START, CE_END, CP_INTERACT etc. "count": Long // Count of events. }], "pagesummary": [{ // Optional "id": String, // Page id "type": String, // type of page - view/edit "env": String, // env of page "timespent": Double, // Time taken per page "visits": Long // Number of times each page was visited }] } } |
Specifications for Bazaar Apps:
Need to implement an activity which is capable of calling API and read the content metadata to launch the content in their respective apps. Following is the API request,response structure to be adhered to.
API Information:
For More Details Refer Sunbird Documentation
Intent Handling
Need to create an intent filter in Android Manifest as follows :
Code Block <activity android:name="com.example.ExampleActivity" android:label="@string/title_example" > <intent-filter android:label="@string/play_view_web_example"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with "http://sunbird.staginged.in/play” --> <data android:scheme="https" android:host="sunbird.staginged.in" android:pathPrefix="/play" /> </intent-filter> <intent-filter android:label="@string/play_view_app_example"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with "example://play” --> <data android:scheme="example" android:host="play" /> </intent-filter> </activity>
Implement Activity as follows
Code Block @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = getIntent(); String action = intent.getAction(); Uri data = intent.getData(); <!-- Trigger the Business Logic of App --> }