How to Notify to user if app update is availabe in google playstore

I want to set alert box for my app. if update is available from google play store.
I went through this Link

`const updateUrl = 'https://your-remote-api.com/update.xml';    
 
console.log("update",updateUrl);    
                        
 this.appUpdate.checkAppUpdate(updateUrl).then(() => { alert("Update Available") });`

if run i run this code, my app will exit automatically

how to resolve this…