-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capacitor support #25
Comments
Unfortunately, I have not yet had time to check what is needed for Capacitor. However, according to the documentation, Cordova plugins can also be used with Capacitor without any problems. A warning beforehand: I have rewritten the complete plugin the last few days.
Demo-Apk: I am almost finished with the changes. Then I want to write at least a detailed tutorial how to use the plugin with Ionic > 2 / Capacitor. |
I have tried a bit with the latest Ionic version. Here is my first successful attempt. Of course, I have to say that I'm not really familiar with the new Ionic versions. But maybe it already helps. import {Platform} from '@ionic/angular';
import {Component} from '@angular/core';
import {HttpClient} from '@angular/common/http';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
endpoint = 'https://raw.githubusercontent.com/kolbasa/cordova-plugin-apkupdater-demo/master/update';
constructor(private httpClient: HttpClient, public platform: Platform) {
platform.ready().then(this.downloadAndInstall.bind(this)).catch(console.error);
}
async downloadAndInstall() {
const apkUpdater = (window as any).ApkUpdater;
const response = await this.httpClient.get<any>(this.endpoint + '/manifest.json').toPromise();
const remoteVersion = response.version;
const installedVersion = (await apkUpdater.getInstalledVersion()).version.name;
if (remoteVersion > installedVersion) {
await apkUpdater.download(this.endpoint + '/update.zip', {password: 'aDzEsCceP3BPO5jy', onDownloadProgress: console.log});
await apkUpdater.install();
}
}
} |
I have now tried Capacitor and implemented a TypeScript Api on Plugin-Version: Installation:
Sample Implementation: If you have problems with it, feel free to reopen the issue. |
I've been using this plugin for my cordova app for a few months and it's been working great!
I'm in the process of converting from cordova to capacitor and am wondering if I can still use this?
The text was updated successfully, but these errors were encountered: