support for ionic 5
Closed this issue · 1 comments
l0ft13 commented
I have tried to use your plugin with ionic 5 / capacitor and it is failing on build.
./src/app/app.module.ts:25:106-116 - Error: export 'ApkUpdater' (imported as 'ApkUpdater') was not found in 'cordova-plugin-apkupdater' (possible exports: default)
thanks
kolbasa commented
It works for me.
Blank project:
ionic start test blank --type=angular --capacitor --no-interactive
cd test/
npm install cordova-plugin-apkupdater
ionic cap sync
ionic cap open android
ionic info
Ionic CLI : 6.18.1
Ionic Framework : @ionic/angular 5.9.1
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.2.13
@angular/cli : 12.1.4
@ionic/angular-toolkit : 4.0.0
src/app/home/home.page.ts
import {Platform} from '@ionic/angular';
import {Component} from '@angular/core';
import ApkUpdater from 'cordova-plugin-apkupdater';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
remote = 'https://raw.githubusercontent.com/kolbasa/cordova-plugin-apkupdater-demo/master/update';
constructor(public platform: Platform) {
platform.ready().then(this.update.bind(this)).catch(console.error);
}
async update() {
await ApkUpdater.download(
this.remote + '/update.zip',
{
zipPassword: 'aDzEsCceP3BPO5jy',
onDownloadProgress: progress => console.log(progress),
onUnzipProgress: progress => console.log(progress)
}
);
await ApkUpdater.install();
}
}