How can we push app updates without using Google Play?


#1

We have 500 android tablets that we need to ship with our app pre-installed. Right now our process is to create 500 Google accounts, log into the play store, and download the app.

The problem is that Google limits the number of accounts you can create per telephone number and this process takes a long time. The only reason why we use the play store is that we want to have a 100% reliable method for being able to update the app in the future.

Now we’re also using Ionic Pro and we know we can use Live Deploy to push small updates without having to go through the play store. However, my understanding is that we can’t use Live Deploy for major updates such as things that impact cordova plugins or someday if/when Ionic has a major update of it’s own, or if Live Deploy ever gets discontinued.

The question I have is, is there any other 100% reliable way to update apps yourself to totally bypass the Google Play store?


#2

Since they are Android Tablets, you could enable the developer mode and simply side load the app. Ionic Pro Deploy should still work just fine (with the issues you mentioned).


#3

But can we push major updates that way? The reliance on Google Play isn’t so much for the installing as it is for updating.


#4

If a new Cordova plug in is involved, no. That code lives in the native side of the app. But since this is Android, there is no review process that would be in play, plus if you side load the Play Store never comes into play. So, you can add new features without worry. You might check with Google and see if they have a system in place for education deployments. I would think they would.


#5

Thanks! I guess the part that I don’t understand is how a major update involving cordova changes actually gets deployed if not through the play store if you side load it. So if Google Play isn’t initiating the update, who does?


#6

In your app init function call to server api which return the latest veriosn then check if the current app version lower then the version that response from server api

look at this code example.

app.component.ts

initializeApp() {
    //return the current version (from config.xml)
    //this.appVersionNative is from "@ionic-native/app-version"
    this.appVersionNative.getVersionNumber().then((versionNumber:any) => {
      let currentVersion = parseFloat(versionNumber:any);
    
      //your server api to get last version
      this.serviceApi('url-to-server-api').then((res) => {

         if (currentVersion < parseFloat(res.lastVersion)) {
            this.downloadNewVersion(res.lastVersion);
         } else {
           //continue with app logic...
         }
      });
   

    });
}

downloadNewVersion(newVersions) {
    this.showLoading();
    const fileTransfer = this.transfer.create(); //this.tranfer is from "@ionic-native/file-transfer";
    let fileUrl = 'YOUR_SERVICE_API_FOR_DOWNLOAD_APK';
    // this.file is '@ionic-native/file';
    const savePath = this.file.externalDataDirectory + '/newVersions/' + 'AppName' + this.newVersions.toString() + '.apk';
    fileTransfer.download(url, savePath).then((entry) => {
      this.hideLoading();
      const nativePath = entry.toURL();
      this.runNewVersionApk(nativePath);
    }, () => {
      this.hideLoading();
      alert("SERVER ERROR TO DOWNLOAD FILE")
    });
}

runNewVersionApk() {
    //this.fileOpener is from '@ionic-native/file-opener';
    this.fileOpener.open(path, 'application/vnd.android.package-archive');
}

#7

I suspect you’ll hit a lot of roadblocks trying to circumvent the app stores.

I’d look at the possibility of private apps via Google Play.


#8

Is self updating per Avishai’s 100% reliable?


#9

Considering this is only about Android I would be more inclined to go with PWA


#10

Almost everything works doing it as a PWA except some USB functionality for using thermal printers. Unless there’s a breakthrough in using cordova plugins like that as a PWA, I don’t think it’s viable for us.


#11

I don’t know what printers you have, but Android gives access to BLE devices which includes a bunch of thermal printers.

As a half-way house there is the idea of using Microsoft AppCenter (aka codePush) to keep your apps up-to-date over the air. I use it with great success - fantastic FREE offering.

A bit like Ionic Push, it’ll keep the html/css/js of your application up-to-date, and the only time you need to push out a binary update is when you need to do something low-level like a new cordova plugin requirement.

EDIT: Just read your original message more closely - I see you already have a relationship with Ionic Pro so this might not be of interest.