Note you must have node installed, otherwise run brew install node
.
npm install -g cordova
cordova create hello com.example.hello HelloWorld
cordova platform add ios
cordova platform add android
brew update && brew install gradle
Accept all andriod licenses
cd ~/Library/Android/sdk/tools/bin/
./sdkmanager --licenses
brew install ios-deploy
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
cordova build
To prevent app from opening browser, inside add
<allow-navigation href="*" />
Edit config.xml
Replace
<content src="index.html" />
with
<content src="http://127.0.0.1:3000/" />
Edit index.html
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
window.location.href = "http://localhost:3000/";
}
function onDeviceReady()
{
// do your thing!
}
</script>
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
</head>
<body onload="onBodyLoad()">
</body>
</html>
Settings > General > Device Management > Trust device
. https://support.apple.com/en-ca/HT204460