what's your advice for create native app for moodle with java?

what's your advice for create native app for moodle with java?

by sadaf sadafian -
Number of replies: 2

hi.

i want to know why moodle developers don't create java based app for moodle for android device instead of develop phone gap app?

phone gap has lower performance vs java native application.

1- can anyone advice and compare native java(or ios) application vs phonegap for moodlemobile?

2- if i want create java based application for android can anyone say me what is my problems and difficulties in this path?

(in my mind i can create android app simply with the webservice of moodle)

thank you.

Average of ratings: -
In reply to sadaf sadafian

Re: what's your advice for create native app for moodle with java?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Strictly speaking "native" Android apps are not Java (whatever Oracle might say). I believe that developing with PhoneGap is easier than for native Android but perhaps more importantly with PhoneGap you get an app that will run on iOS and Android and Windows from the same code.

I suspect that the performance bottleneck with any mobile software accessing Moodle will be the network connection and not how fast the code runs on the device.

The development of the App means that as you say you could develop a native Android app that simply accessed the Moodle web services. I am not aware of anyone doing that so far but I would be interested to see it if you gave it a try. One area that might be of interest is accessing the camera capabilities of Mobile devices as that is rather tricky with PhoneGap.



Average of ratings: Useful (1)
In reply to sadaf sadafian

Re: what's your advice for create native app for moodle with java?

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Sadaf,

the main reason we chose PhoneGap when the app was started is that it allows developing for several platforms with the same base code. We use the same code for Android, iOS, Windows 10, Mac OS and Ubuntu. It would be impossible for us to maintain so many platforms using native code.

Another reason to choose PhoneGap is that most Moodle activities use HTML, CSS and Javascript. Some of them can be easily rendered in a WebView, like the page module, but some others can be tricky. For example, the SCORM package uses a Javascript API to communicate with Moodle. In a PhoneGap app it's quite easy to treat this, since our Javascript code can implement this API and communicate directly with the server. In a native app you would have to:

  • Render the SCORM in a WebView.
  • Create the Javascript API implementation and run it in the WebView.
  • This Javascript API should communicate with the native code of the app to send/receive the data.
  • The native code should call the Moodle WebServices.

Some other tricky activities are quiz and lesson. The pages/questions are received as HTML, so in order to render them you should either parse the HTML to render an equivalent native view (this means reimplemening a lot of Javascript code, like the drag&drop), or display them in a WebView. In this second case, you end up with the same problem as in SCORM: you need to communicate your native code with the WebView's Javascript code.

The app communicates with Moodle using REST WebServices and JSON data, so it's possible to develop a native app. However, the amount of work required to do so would be way higher than using PhoneGap.

Kind regards,

Dani

Average of ratings: Useful (2)