Mahesh's blog
Published on

Create mobile app using phonegap

Installations

Create and run app

  • To create mobile app, run following commands:
    phonegap create mobile-app
    cd mobile-app
    phonegap platform add android browser
    
  • Before running app, make sure Android SDK or needed requirements are met by running the following command:
    phonegap requirements
    
  • Once all installations are completed, we can run the app:
    phonegap serve . -p 3001
    

Test app using browser or mobile

  • App can be tested in a browser by going to url which was shown in the console logs.
  • For running in mobile, install this app: Google Play store link for Phonegap mobile app
  • Open app and hit the URL with port to download and run the app in mobile as native app.

Deploying app

  • Once mobile app is good to deploy, update config.xml with appropriate information.
  • Zip the entire folder and rename to app_name.apk
  • This apk is good to publish in play store or further testing in other mobiles.

Issues so far faced

  • phonegap requirements showed Gradle was missing and had to install separately after a bit of googling and digging through log traces. https://gradle.org/install/#manually
  • Google playstore Phonegap app was not compatible in some mobiles so had to download and install apk from web
  • If app is using api from local machine, make sure update the api endpoint using ip address instead of localhost. And also make sure firewall is not causing any issue.

Other than building mobile app locally using phonegap which is convenient and faster way, there is another way to build mobile apps using phonegap build site which creates site out of html app. Please refer this site: https://build.phonegap.com/

References