Intent
Need to create an unified deep linking 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:
Work Flow
Registration of External Apps
Sunbird Third Party App Interaction
Vendor registration of Apps to Sunbird
Each Vendor can be registered as part of Global Configuration for Sunbird to have app links being enabled.
Code Block |
---|
|
{
identifier: "",
name: "",
logo: "",
appName: "",
packageId: "",
target: {
mimeType : [],
contentType : [],
.... // All content attributes
},
appDetails: {
organization: "",
id: "",
version: ""
},
vendorCode: "" // Internally assigned
} |
Vendor CRUD API (or) Form Configuration Supported.
of their implementation.Approachesof handling deep link will try to persist vendor information locally on app’s data.
Any subsequent invocation of intent from Sunbird will show globally registered apps for Sunbird along with locally registered apps in devices.
deeplink Url :
sunbird://register?name: "", logo: "", appName: "", packageId: "",target:”{}”,appDetails:”{}”
Parameter | DataType | Description |
---|
name (M) | String | Name of the vendor |
logo (M) | String | App logo Url |
appName (M) | String | App Name |
packageId (M) | String | PackageID of the app |
target (M) | String | Targeted content query |
appDetails (O) | String | App details |
extra (O) | String | Misceallaneous Information to be sent |
Approaches
Expand |
---|
title | Approach 1 : (Deeper Integration) |
---|
|
Approach 1 : (Deeper Integration) |
Deep Link hit in terms of ratings. Intent provides basic information such as content do_id, telemetry context information.
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
Params | Description |
---|
resourceID | Content ID of the resource | context | Context of the play - like did, sid, uid etc |
Image ModifiedPros 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 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 |
---|
title | Approach 2 : (Lighter Integration) |
---|
|
Approach 2 : (Lighter Integration) |
Deep Link Intent provides basic information such as content do_id, context information & artifactUrl and mimeType. Bazaar Apps can launch the artifactUrl directly based on mimeType. Params | Description |
---|
resourceID | Content ID of the resource | context | Context of the play - like did, sid, uid etc | mimeType | Mime type of the content | artifactUrl | The URL to download the content |
Image ModifiedPros Least Effort in integrating the |
deep link Response Object:
Code Block |
{Intent for bazaar apps. 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 |
---|
title | Approach 3 : (A Hybrid approach between 1 & 2) |
---|
|
Deep Link Intent provides the basic information such as content URL, mimeType & user/session context. Params | Description |
---|
resourceID | Content ID of the resource | context | Context of the play - like did, sid, uid etc | mimeType | Mime type of the content | contentUrl | The public |
|
DIKSHA Sunbird content url or a dial url (https:// |
|
diksha.gov.indiksha.gov.inPros The spec doesn’t need to change if more content metadata needs to be sent The integration apps need to understand our content model and can also index the content in their apps
Context Information Following are the contextual params passed to the reader app Device ID User ID Session ID Collection ID Batch ID Reference ID
|
Deep Link - URI & Data
Sample Deep Linking URI:dikshacontent://play?mimeType=<>resourceId=<param-value>&referrerPackageId=<param-value>…..Technical Specification for Third Party Apps
Expand |
---|
title | Params Data Supported |
---|
|
Params | Description | Data type |
---|
|
resourceId | identifier of the resource to be served in bazaar apps | String |
collectionId | CollectionID of textbook,course | String |
---|
referrerPackageId | package details of referrer app | String |
|
batchId | BatchId if it is trackable collectionreferenceID | Reference ID to be sent back to sunbird app | String | mimeType | Content MimeType | String | vendorCode | Vendor ID to validate the referrer | String |
|
contentCategory | contentCategoryArtifact URL to play contentcontentUrl | Url of the Content | String |
|
artifactURL | profileContext | Name and Avatar | String |
|
telemetryContext | Hashed value of uid, sid | String |
Data Sharing Table :
Params | Approach 1 | Approach 2 | Approach 3 |
---|
resourceId | Yes | Yes | collectionId | Yes | Yes | referrerPackageId | Yes | Yes | Yes |
batchId | Yes | mimeType | Yes | vendorCode | Yes | Yes | Yes |
contentCategory | Yes | artifactURL | Yes | contentURL | Yes | telemetryContext | Yes | Yes | Yes |
All the reader apps need to send summary data back to DIKSHA app via intent or deeplink.
SUMMARY Event Spec Expand |
---|
|
https://github.com/sunbird-specs/Telemetry/blob/main/v3_event_details.md/#summary 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:
All the reader apps need to send summary data back to Sunbird app via intent data. |
Expand |
---|
|
The third party apps should do a HTTP GET call on the contentUrl parameter sent via the intent data Code Block |
---|
GET intentdata.contentUrl
Headers {
X-App-ID: <ID of the App>,
X-App-Version: <Version of the App>,
X-Device-ID: <Device Id>
} |
Response Data Structure |
dialassembleread",
"ver":"v1",
"ts":"2021-02-10 04:27:14:674+0000",
"params":{
"resmsgid":null,
"msgid":"90e184d1-c52c-106b-c410-6a168900ef05",
"err":null,
"status":"success",
"errmsg":null
},
"responseCode":"OK",
"result": {
" |
|
response{"ignoredSections":[],"name":"DIAL Code Consumption","id":"01265699913956556871","sections":[{"display":"{\"name\":{\"en\":\"Linked Content\"}}","alt":null,"count":0,"description":null,"index":1,"sectionDataType":"content","facets":[{"values":[],"name":"primaryCategory"},{"values":[],"name":"subject"},{"values":[],"name":"grade"},{"values":[],"name":"domain"},{"values":[],"name":"language"},{"values":[],"name":"medium"},{"values":[],"name":"contentType"}],"imgUrl":null,"resmsgId":"406a3b50-6b58-11eb-ae68-add1f2666d9e","contents":null,"searchQuery":"{\"request\":{\"facets\":[\"language\",\"grade\",\"domain\",\"contentType\",\"primaryCategory\",\"subject\",\"medium\"],\"filters\":{\"primaryCategory\":[\"Digital Textbook\",\"Textbook Unit\",\"Course\"],\"mimeType\":[\"application/vnd.ekstep.content-collection\"],\"status\":[\"Live\"],\"compatibilityLevel\":{\"max\":4,\"min\":1},\"dialcodes\":\"XC40VV\",\"contentType\":[\"Collection\",\"TextBook\",\"TextBookUnit\",\"Resource\",\"Course\"]},\"mode\":\"collection\",\"userProfile\":{},\"limit\":10},\"limit\":10,\"sort_by\":{\"lastUpdatedOn\":\"desc\"}}","name":"Linked Content","id":"01265699616802406427","dynamicFilters":null,"dataSource":null,"apiId":"api.content.search","group":1}]}}For More Details on the content model refer Sunbird Documentation Object Types |
Expand |
---|
|
Intent HandlingNeed 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. 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 -->
} |
|