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