Previously we executed ionic serve
to run the mobile app in a web browser and make the necessary modifications. The next step is to create the binaries on production mode.
Make sure you install the necessary dependencies to create the native binaries for each platform. More information here.
mycomputer@NearmeApp:~$ ionic cordova platform add android
mycomputer@NearmeApp:~$ ionic cordova build android --prod --release
mycomputer@NearmeApp:~$ ionic cordova platform add ios
mycomputer@NearmeApp:~$ ionic cordova build ios --prod --release
These commands will create an optimized and suitable compilation for Google Play and App Store, respectively.
Android requires that all APKs be digitally signed with a certificate before they can be installed.
Visit this Ionic guide to learn how to generate your private key and use it to sign the APK.
When executing the command above to build for iOS it may have generated an error related to code signing. This can be solved by creating the provisioning profiles. Do the following to create and sign the compilation:
.xcodeproj
located on the folder platforms/ios
. On the option Signing (Debug) select the development profile and in Signing (Release) the production profile.ionic cordova build ios --prod --release
to build and sign the code correctly.Don´t forget to activate push notifications in xCode. Simply go to the project editor for your target and then click on the Capabilities tab. Look for Push Notifications and toggle its value to ON.
First we need to deploy the application to a Github account. You have to create new repository from here.
Now open you terminal and change your current directory to the app’s directory. Run the next commands but you have to change the repo name to your repo’s name.
Create a new local repo
git init
Add all the project files to the repo
git add .
Commit the changes
git commit -m "First commit before deployment"
Add the remote repo created on Github
git remote add origin git@github.com:your-username-here/your-repo-name-here.git
Finally push the changes
git push origin master
Create a new account on Netlify. After that you’ll be redirected to create your site.
Click on New site from Git.
Now choose Github, if you’re using another git system choose it.
Next, choose your repo.
Next we have to set some settings for the deployment.
For Branch choose master, If you’re using different branch choose it.
For Build command type ng build --prod --service-worker
For Publish directory, type www
.
Then click Deploy site.
It’ll take a minute to deploy the site and give us the URL.
That’s it. Next you’d want to use a custom domain for your application.
Click on Domain Settings. To add a custom domain, click Add custom domain at the bottom of the Custom domains panel, and enter your domain name. Click Verify and the domain will be validated.
After you add a custom domain to a site, the domain name will normally appear grayed out in the Custom domains panel, with a Check DNS configuration link next to it. This means Netlify cannot serve your site correctly under that domain.
To serve your site under a custom domain, you need to point DNS records for the domain at the Netlify servers.
Click Check DNS configuration next to the custom domain to see customized instructions on the DNS records you need to configure.
Depending on your DNS provider, changes to DNS records can take several hours to propagate and take effect for the entire internet.
If you have any suggestions or questions related to this documentation do not hesitate to contact us.