Ionic App Update using Push Notifications - Ilir HUSHI
ilir hushi, portfolio, resume, full-stack developer, mobile developer, web developer, backend developer, frontend developer
582
post-template-default,single,single-post,postid-582,single-format-standard,ajax_fade,page_not_loaded,,qode_grid_1300,qode-content-sidebar-responsive,qode-theme-ver-13.9,qode-theme-bridge,disabled_footer_bottom,wpb-js-composer js-comp-ver-5.4.7,vc_responsive

Ionic App Update using Push Notifications

Ionic App Update

Ionic App Update using Push Notifications

During development of mobile apps we need to deliver new builds to the client with the new features or improvements made on the mobile application. In this blog post I will show you the steps to integrate the Ionic App Update for Ionic to deliver new builds to the clients using Push Notifications and this package works only for Android.

Notice: I suppose that you have an up and running Ionic project and correctly configured the Push Notifications for Ionic, if not please check the Ionic Documentation to create a new project.

 

Ionic App Update steps how to integrate it

 

Firstly, we start by installing the Cordova and Ionic Native plugins:

 

Then, at the app.module.ts we add the AppUpdate provider,

 

After this step we should first host an XML file on our server with the following data in it:

 

And then at the app.component.ts in the constructor we have initialised the push notification when the platform is ready and we check if the received push notification is of a type: “SOFTWARE_UPDATE”. Then, we run the _alertUpdateVersion function which makes a call at the remote host file update.xml. The plugin will compare the app version and update it automatically if the API has a newer version to install.

 

Possible Issue:

The issue that I faced when I run the application after the above steps was: when I pressed the app to open, it closed immediately and after a while of searching around in the internet I found out that if you go at: platforms/android/src/com/vaenow and the vaenow exists in this directory you should manually move it under: platforms/android/app/src/main/java/com/.

So the directory vaenow should be moved: from platforms/android/src/com/ to platforms/android/app/src/main/java/com/

Remember if you remove the android directory you should again change the location of the vaenow directory 

After we do this step we run the application, remember use real device since push notifications do not work on emulators, using the command:

and then we send a push notification from the firebase with the key “SOFTWARE_UPDATE” and we will be able to see a modal which notifies for a newer version available for our mobile app.

 

Leave a comment if you face any issues, let’s help each other 🙂

 

Find out more of my blog posts at: https://ilirhushi.me/blog

%d bloggers like this: