Display SCORM content in Android

7.4k Views Asked by At

I have an native Android Moodle based application wherein I have to display the courses which are in SCORM format in the application.
Can someone please help me how to go about this...
The courses are uploaded to my Moodle based website in SCORM format.
The get_course_contents web service gives me a url pointing to the course files, as specified here
https://github.com/dongsheng/moodle/wiki/WebService:get_course_contents

How do I display these SCORM files in my native Android application?
Do I need to parse the imsmanifest.xml file and get details of SCORM package and display the HTML5 contents? Or is there another/better way??

**


**
Update:
I have now tried to display the SCORM package contents in a WebView.
My SCORM package is like:
enter image description here
I have copied this package in the Assets folder of my POC project.
My WebView settings are:

settings.setJavaScriptEnabled(true);
settings.setPluginsEnabled(true);
PluginState state = PluginState.ON;
settings.setPluginState(state);
settings.setAllowFileAccess(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDatabaseEnabled(true);

String databasePath = this.getApplicationContext()
        .getDir("database", Context.MODE_PRIVATE).getPath();
settings.setDatabasePath(databasePath);
webview.loadUrl("file:///android_asset/ttttt.html");

And my manifest is:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.html5test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.html5test.MainActivity"
            android:hardwareAccelerated="true"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

But I'm not getting required results and cannot view my SWF....

enter image description here

Also, when I copied the SCORM package onto the sdcard of the device and tried to open the html file, it opened up in HTMLViewer app and showed a blank white screen...

enter image description here

Can someone please help me out with this....
Thanks in advance...

4

There are 4 best solutions below

4
On BEST ANSWER
  1. First you have to understand structure of scorm.

  2. You can see scorm package is a zip file containing several folders right and a manifest file.

  3. First you have to unzip that zip package of scorm and then you have to parse that imsmanifest.xml file and maintain two lists one containing titles and other addresses of html files corresponding to that title.

  4. I have used sax2r2 parser to parse that manifest file and got that two array lists one containing title and other addresses of html files.

  5. Later you just have to fill up you ios list with titles array, and when user click on any title of that list get the position of list and retrieve the address of html files corresponding to that title from addresses array list.

  6. inaly you can open html file in webview of your ios, make sure have enabled parameters required for open scorm html5 file.

In android I have enabled and set these values this is java code but it may help you.

WebViewClient webViewClient = new WebViewClient();
    webView.setWebViewClient(webViewClient);
    webView.clearCache(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.setInitialScale(1);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.clearHistory();
    webView.getSettings().setAllowFileAccess(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setPluginState(PluginState.ON);
    webView.loadUrl("file://" + open_scorm.scorm_path
            + open_scorm.scorm_name + "/" + open_scorm.href.get(0));

webView is used to open html/html5 files in android and i have enabled above settings in android, these settings are by default in android, may be in ios you just have to load that html file and dnt have to enable all these values.

In above you can see I am retrieving href.get(0) which is first html5 file of scorm.

In simple words you just have to unzip scorm , parse imsmanifest.xml file and get data of it and use it to open/parse scorm.

0
On

Use mobile moodle. Much functionality is being added and it works synchronized to your website, has versions for android, IOS and windows mobile.

https://docs.moodle.org/31/en/Moodle_Mobile_features

Works offline, but with some limits for things like quiz, which can only be scored in contact with the website.

No need to make everything new yourself. Moodle Mobile plays SCORM already.

6
On

Zeba,

You need to provide LMS (Moodle) SCORM API. This API (it is a javascript which defines standard SCORM functions such as LMSInitialize() and LMSFinish()) acts as a bridge between your Android SCORM player (client) and the LMS (server).

In webversion of Moodle, Moodle checks the version of SCORM package and then includes the appropriate API to be used as a main API (there are aicc.js.php, scorm_12.js.php and scorm_13.js.php).

You may want to extend these APIs to be used in your Android application. Once you have the API, you can get the SCORM content by returning the url of the file from a webservice function.

Each SCO files (ex. scormpackage.zip/index.html) have its own APIWrapper. The wrapper will find such LMS API and use it to be connected to the LMS backend.

Look at the adlnet website to see how SCORM packages consumes APIWrapper to keep track of SCORM content.

5
On

core_course_get_courses

this function you can use .