vaenow / cordova-plugin-app-update

App updater for Cordova/PhoneGap
MIT License
299 stars 146 forks source link

Cannot read property 'checkAppUpdate' of undefined #69

Closed pattnayakpratik93 closed 6 years ago

pattnayakpratik93 commented 6 years ago

Hi, I am using Ionic version 1 with angularJS. My Code:- I am reading the version from a XML file in my server and if there is any change in version then i am updating. that will come in later part of code, but can u please tell me what i am doing wrong?

var updateUrl = "C:/Users/pratik_pattanayak/version.xml";
this.AppUpdate.checkAppUpdate(updateUrl).then(function (response){
     console.log(response);
})
vaenow commented 6 years ago

Please try

+ window.AppUpdate.checkAppUpdate
- this.AppUpdate.checkAppUpdate
pattnayakpratik93 commented 6 years ago

With window.AppUpdate.checkAppUpdate also getting same error.

vaenow commented 6 years ago

Please make sure you have correctly installed the plugin.

pattnayakpratik93 commented 6 years ago

I can see cordova-plugin-app-update folder in my plugins folder. it has res, src, www, LICENSE, package.json, plugin.xml, readme.md and syncfromdemo.sh

pattnayakpratik93 commented 6 years ago

Can u also explain how to remove the plugin and add again?

vaenow commented 6 years ago
cordova plugin remove xxxx.xxx.xxx

more cordova docs: https://cordova.apache.org/

prasad2kin commented 5 years ago

I'm also getting exact same problem with ionic v1 I'm trying this

  window.AppUpdate.checkAppUpdate(onSuccess, onFail, updateUrl);

However, with ionic v1, I'm suspecting that I can't do this: import { AppUpdate } from '@ionic-native/app-update'; it gives me error Uncaught SyntaxError: Unexpected token {

if I remove { & }, I still get error

Uncaught SyntaxError: Unexpected identifier

I guess angular is not importing plugin correctly with import.. any clues?