Playing SCORM on Android devices - java

I've got few questions about Android and SCORM. In both areas I'm pretty new and I only spent one evening digging the web in search of some answers.
Topics I found were about synchronizing SCORM package with LMS but I do not need that. I'm just wondering how to PLAY (and just play, no need for any syncing or tracking) SCORM package on android device (Lenovo tablet with Android 4+ OS). If I try to make my own application which allows to browse local SCORM packages, will I be able to launch SCORM by using WebView component?
I found this tutorial:
http://support.scorm.com/entries/21826060-RSOfflinePlayer-Developer-Tutorial
which has section:
Playing Content and Syncing Results
where I found some interesting source code about configuring this WebView component in order to play SCORM content, but I'm not really sure if I need RSOfflinePlayer.jar for this.
I've also heard, that if device supports Flash, I will be able to launch SCORMs with Browser - is it true?
Maybe you know some application which can do that? Or library which could help?
Is there anyone with experience in:
1) Java SCORM API:
would paste URL, but I need more reputation
2) Celine
https://code.google.com/p/celine-scorm/
Any help will be appreacieted, not only by me but also by children with different kinds of diseases (we are just students trying to help them).

Javier is almost right. I will nonetheless try to explain this again. Maybe you will gather more information from this.
Every SCO is basically a zipped webpage. You have to unzip it and look for imsmanifest.xml, find the initial file in there (index.html, player.html, something like this). It will NOT be located under resources. You first have to look at Organizations > Organization > Item > Identifierref, which will give you an ID. Then you have to look at Resources > Resource with the above ID > href value. This is the file you're looking for.
Example (index.html is the file you need):
<organizations default="someorg">
<organization identifier="someorg">
<title>Some Title</title>
<item identifier="CourseItem01" identifierref="SCO_Resource_01" isvisible="true">
<title>SCO Title Here</title>
</item>
</organization>
</organizations>
...
...
<resources>
<resource identifier="SCO_Resource_01" type="webcontent" adlcp:scormtype="sco" href="index.html">
<file href="index.html"/>
<file href="SCORM_API_wrapper.js"/>
...
Once you found it, just open it in WebView and it'll try to connect to SCORM API in the parent window. You'll have to provide some dummy functions to fool it into thinking that it did connect to LMS and carry on as usual. Otherwise it will either fail or throw alerts at you.

I don't have any Android experience, but I have some experience working with SCORM.
To play a SCORM object, you need to open the right file inside the right environment, the right file is stated in the imsmanifest.xml file, that will be always in the top level of the zip package, you have to look for something like this:
<resources>
<resource identifier="546468" type="webcontent" href="index.htm" adlcp:scormtype="sco">
<file href="index.htm" />
</resource>
</resources>
This means that you have to open index.htm in the top level, in general you have to look for the first resource with adlcp:scormtype="sco" (if you need more details, read the SCORM spec).
When this page loads, it will look for the API object, it must be in the parent window, or parent frame, you will need a dummy SCORM API, something like:
function ScormAPIClass()
{
this.GetLastError = function (){return 0};
this.GetErrorString = function (param){return ""};
this.GetDiagnostic = function (param){return ""};
this.SetValue = function (element, value){
//you need something else here
return true};
this.GetValue = this.SetValue = function (element){
//you need something else here
return true};
this.Initialize = function (param){return true};;
this.Terminate = function (param){return true};
this.Commit = function (param){return true};;
this.version = "1.0";
}
window.API_1484_11 = new ScormAPIClass();
The SCORM objects will assume that you API works, so, if the set and get functions are not real this can generates errores depending on the object logic.
Also, I did not tested the code, is only to give you an idea of what you need.
I hope this help you.

First you have to understand structure of Scorm.
You can see Scorm package is a zip file containing several folders right and a manifest file.
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.
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.
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.
finally 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.

Related

Sending image to Hangouts from local folder

I'm attempting to send an image to Hangouts from within an app I'm building.
I'm working in Xamarin for VS 2015 to do this so the code below is c# but it's not much different from the equivalent Java code so I think it's easy to follow.
What I've done is set up a button on my app which has code setting up an Intent to share an image to Hangouts. I've set the image up already in the Downloads folder on the device and hardcoded the name into the code.
Intent hangoutsShareIntent = new Intent(Intent.ActionSend);
hangoutsShareIntent.SetType("image/jpeg");
hangoutsShareIntent.SetPackage("com.google.android.talk");
string downloadsPath = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath;
string filePath = Path.Combine(downloadsPath, "shared.jpg");
hangoutsShareIntent.PutExtra(Intent.ExtraStream, filePath);
StartActivity(Intent.CreateChooser(hangoutsShareIntent, "Share with"));
When I run this, I get the option to select a chat in Hangouts that I want to send the content to. Upon selecting the chat, I get a blank message box and no image.
I've swapped the above code over to use text/plain and pass the filePath variable to the message. When I copy the file path into Chrome to check it, the image loads so I have to figure that the image is where I've said it is... right?
I get no errors (probably because the issue is in Hangouts rather than my app so I have nothing to debug there). Logcat shows nothing except an error I can't find much about on Google: ExternalAccountType﹕ Unsupported attribute readOnly
The only information I could find on that error implied some issue with permissions but I've made sure my app has runtime permissions checked for Read/Write using this code (which wraps the above):
if ((CheckSelfPermission(Permission.ReadExternalStorage) == (int)Permission.Granted) &&
(CheckSelfPermission(Permission.WriteExternalStorage) == (int)Permission.Granted))
NOTE: I'm running this on a HTC One M8 - no SD card but does have external storage on device. I've also added the above permissions to the manifest for earlier Android versions.
The documentation for this (here) isn't overly helpful either so any advice AT ALL here is welcome :)
Thanks!
If you use the file provider instead of sending just the URI on its own. This should get around the permission issues you are seeing.
There is a guide available here which might be useful.
Intent shareIntent = new Intent(Intent.ActionSend);
shareIntent.SetType("image/gif");
Java.IO.File file = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory + "/myimage.gif");
Android.Net.Uri fileUri = Android.Support.V4.Content.FileProvider.GetUriForFile(this, "com.myfileprovider", file);
shareIntent.SetPackage("com.google.android.talk");
shareIntent.AddFlags(ActivityFlags.GrantReadUriPermission);
shareIntent.PutExtra(Intent.ExtraStream, fileUri);
StartActivity(Intent.CreateChooser(shareIntent, "Share with"));

Android Studio - URL string

So I'm pretty new to the whole Android Studio thing and I've been using the internet to help me with a lot of the things I am doing and needed help on something.
I'm not sure if it's possible to connect this to either a string or an SQL database but I have a Main Layouts with a bunch of buttons that allow me to click on them and choose what external player I would like to use to watch the video. In my MainActivity java class, this is how it finds the button.
case R.id.button3:
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://videoname.mp4"), "video/*");
startActivity(Intent.createChooser(intent, "Choose an External Player"));
break;"
I wanted to know if "http://videoname.mp4" url can be connected to like a string where I can always update or change the URL instead of manually going to find the URL in the MainActivity java and changing it. As of now I have to manually do it but a different way to do it would be helpful.
I'm sorry if it's all confusing, but if you know, please let me know as soon as.
Thank you.
you just need write your string URL :
open your directory folder /res/values/strings.xml -> write your string : <string name="yourStringName>yourStringURL</string>. to use your string do this
getContext().getString(R.string.yourStringName) in fragment
getString(R.string.yourStringName) in Activity
or you can write directly on your code, put your cursor on your string, then press key alt + enter choose extract string resource fill the resource name with your string name
wherever you need to use it, just do point 1 or 2. also in your Intent
hope this help you, never stop learning!
Add it to strings.xml in your project. That is the recommended way of using strings anyway.

Display Images in TextView html

I state that I have already read all the other questions but none is right for me.My app retrieves data from a database. If I put in the database in the app does not display the image, while the other tag html yes because i put:
Text = (TextView) this.findViewById(R.article.text);
String formattedText = db.getText();
Text.setText(Html.fromHtml(formattedText));
For images I would like something that the download so that they are always available. I tried to put ImageGetter but with the loading time of an article in the app increased a lot and very often said that Android is not responding (ANR). I also need something that resizes images depending on the display. Any ideas?
Take a look at AQuery download the latest jar add it in your project
and use it like following
AQuerymAQuery;
mAquery=new AQuery(context);
mAquery.id(ImageView).auth(handle).image(ImagePath,true,true,400,0,null,0,0.0f);

Javascript/html - File upload

I have a news section where I can post some news.
-> Thumbnail , title and content
What I want:
The user should be able to upload an image file without leaving the page
-> progress bar
Send the file as a post request to my server.
Then I can get the image file from the post request, then I can resize/rename the image and upload it to amazon s3.
If I have to use a javascript library, I would prefere to use jquery.
This should looks something like this:
If I submit the news, I want to save the image path in my database. Now I would need a way to get the image name from my post method.
I've found some uploading solutions, but I have problems to understand how they are working.
http://blueimp.github.com/jQuery-File-Upload/
http://www.uploadify.com/
I only know get/post to retrieve information but they integrate somehow php files in the form.
for example:
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php'
// Put your options here
});
});
I am lacking information to do this on my own. What would you recommend me?
Ps: I am using Java with Play2
Uploadify is definitely the way to go.
All the steps for implementation are to be found here : http://www.uploadify.com/documentation/uploadify/implementing-uploadify/
You need to configure the path where your uploads go in the uploadify.php script.
As for amazon S3 here is an implementation : http://code.google.com/p/uploadify-amazon-s3/
I think onUploadSuccess method better fits than onSelect : http://www.uploadify.com/documentation/uploadify/onuploadsuccess/
You can do something like this from the documentation :
$(function() {
$("#file_upload").uploadify({
'swf' : '/uploadify/uploadify.swf',
'uploader' : '/uploadify/uploadify.php',
'onSelect' : function(file) {
alert('The file ' + file.name + ' was added to the queue.');
}
});
});
Where you can get the flename once it has been selected.
What you're asking for is a LOT really. But to get you started, have a look at this page (uses JQuery):
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/
The above link is a nice upload utility that you can use for drag-and-drop pretty easily, but it can be used by manually selecting files as well. Well documented.
As for resizing, I've used this with great success (PHP): simpleImage
simpleImage is REALLY easy to use and plug into your website.

Create an HTML link or button to add an event to a Lotus Notes user's calendar

My client uses Lotus Notes for calendering. We have a need to serve event information on SharePoint. I'm trying to create an HTML link or button I can use in a custom display form on SharePoint (HTML) that users can click to add the event to their Notes calendars. So far, I've found no way to do this.
An app exists on my client's Domino deployment(?) that creates buttons for use in Notes email messages that also can collect response information. The action of this button is handled by what looks like Java to me. I've included a sample in case it's relevant, and I can include all of it if it looks like it would be helpful, but it's quite long:
Set CurDb=Session.CurrentDatabase
'Get mail file information from Location document using Notes.ini
MailServer$ = session.GetEnvironmentString( "MailServer",True)
MailFile$ = session.GetEnvironmentString( "MailFile",True)
'Set MailDB = session.CurrentDatabase
If CurDb.Server = "" Then
'Attempt to open local mail file
Set MailDB = session.GetDatabase("", MailFile$)
If Not MailDB.IsOpen Then
Set MailDB = New NotesDatabase(MailServer$, MailFile$)
If Not MailDB.IsOpen Then
Msgbox "Unable to add event to your calendar because your local and server mail file cannot be located.",16, "Notice"
Exit Sub
End If
End If
Else
'Attempt to open server replica of mail file
Set MailDB = New NotesDatabase(MailServer$, MailFile$)
If Not MailDB.IsOpen Then
Msgbox "Unable to add event to your calendar because your server mail file cannot be located.",16, "Notice"
Exit Sub
End If
End If
The same app can create a "web" version that can be added to our current intranet platform, but it uses what looks to me like a custom "hook" to interact with the button application and the user's calendar, and it has no function if not placed within an object on that platform. I include the snippet here in case it offers a clue:
<input type="button" onclick="SendEmailNotification('PTHN-132512')"
value="Send me a Notes Calendar Invitation" id="HTMLWebBtn">
I'm wondering if using the snippet elsewhere is as easy as linking to a .js file in my source, and am waiting to hear back from people managing the platform internally, but experience says this is a dead end.
Searching on the Googlybox has so far been basically fruitless. I know you can have a link open Lotus Notes by replacing the http:// with Notes:// followed by the server's name and the application/database/document address (usually a sometimes-really-long string of alphanumeric characters). And I found an article containing strings you can place after the Notes:// to open a new document in a given application, i.e., the email editor. But that's as close as I've come.
Any help, folks?
You can leverage the fact that Notes supports the .ics file format. When a ICS file is opened, Notes can respond by creating a new calendar entry. The best thing is that this works in other mail platforms too, in case your environment is mixed.
Here is some info on setting up Notes: http://www.ibm.com/developerworks/lotus/library/notes85-icalendar/
You can programmatically generate that ICS file, or if you're looking to just play around there are sites online that will generate one for you:
http://www.pratie.com/lab/icalendar/

Categories