How to convert php & jqueryMobile application to apk file

I made an application with PHP and jQuery mobile, and now I am looking for how to convert this application to apk file using PhoneGap.

Can this be done? And are there any tutorials to help me learn how to do this?

+4
source share
1 answer

This is a quick way to do this, better if you expanded to make a more real life:

1- download phonegap

2- Create your first application using this tutorial or using a phone screen saver, how to look in the eyes

3, as soon as you have it, release the server side. We need an API, the easiest way to do this:

<?php header('Access-Control-Allow-Origin: *'); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json'); if($_GET['nameofFunction'] == 'getHomepageContent'){ require_once('controllers/homeController.php'); $objHome = new homeController(); $jsonReturn = $objHome->gethome(); echo($jsonReturn); } ?> 

4 create this controller to control the API request, for example, something like this:

  <?php class homeController { public function __contruct(){ } public function gethome(){ //do what ever you need here, sql query, errors handling.. and return it //back to the api. //for example you could use something like this to return json array to the api // without making much effort if(mysql_num_rows($yourquery) > 0){ while($us = mysql_fetch_assoc($yourqueryResult)){ $output[]=$us; $homeJsonResponse = json_encode($output); } return $homeJsonResponse; } } ?> 

5 We returned to the phonegap application, now make sure that you include all the necessary files, jquery, jquerymobile, cordovajs, itouch, iscroll ....

6 - create a function that will be executed at boot time and will call ajax on api, this will return json, just parse with jquery and you are good to go.

+9
source

Source: https://habr.com/ru/post/1487688/


All Articles