[Solved] Self-updating on android without google store

I’m looking for some sane way to make a self-updating application on android that does not use google play for update process (assume it is installed using alternate means/etc).

Checking for a version, downloading file, most likely won’t be an issue, but I’m not sure how to go about installing apk or for the app replacing itself with a new version.

Can someone point me in the right direction?


Or, perhaps it is possible to stuff logic/new script into asset bundles and then download that? Shouldn’t be the case on android.

Why? What is the reason of self-updating app?
And I don’t believe it is possible to reinstall APK from itself, that would be a security disaster.

self-updating application on android that does not use google play

That’s a security risk and should not be allowed.

No offense, but this is not related to my question.

This particular problem has to be solved in this particular way. It doesn’t matter whether this is the right way or not.
Security concenrs and the right way of doing things are not related to the question.

I want to know how to make this work and what do I need to make this work.

The questions is “HOW do i do it?”. Not “is it possible to do it?”, not “is it the right way”, etc.

Customized devices with android and non-market apks on it.

How about launcher apk paired with application apk? Judging by the scraps of info on the internet, it seems to be possible to launch “intents” from within unity, and it seems it is possible to launch the app via such intent.

4 Likes

Well no offense, dude, but I’m not going to help you how to write a virus.

In fact, I hope nobody does.

I’m not writing a goddamn virus.

Please do not post if you have nothing topic-related to say.

5 Likes

Haven’t cracked the problem yet, but found some relevant info. Posting it here in case someone else bumps into a similar issue:

Launching android application from unity:

Self-updating on rooted devices (possibly obsolete):
https://stackoverflow.com/questions/14982174/self-updating-app

Stackoverflow links:
https://stackoverflow.com/questions/4604239/install-application-programmatically-on-android
https://stackoverflow.com/questions/4967669/android-install-apk-programmatically

Currently testing.

5 Likes

Alright…

It is not exactly possible to make an unattended automatic self-install for non-rooted device (should be possible on rooted devices, though).

However, it is fairly trivial to check external ftp/http server for the most recent version, and then either open the link with a new file in the browser via OpenURL… (which will start download/install)… OR download the file into temporary location within Environment.getExternalStorageDirectory and then open it with Intent ACTION_VIEW via method described here. getExternalStorageDirectory (see this and this) pretty much requires use of AndroidJNI to call it (becasue callStatic asks for a signature that returns java.lang.Object and not java.io.File), but creation of intent can be done entirely through AndroidJavaClass/AndroidJavaObject.

And that’s pretty much it. Resulting intent will still require user confirmation to install and then re-launch the file.

It is really unfortuante that nobody stepped up and saved me some time hunting through all this, but oh well.

Unsubscribing from the thread.

8 Likes

Cant u make a plugin with android studio and use AndroidJavaClass

The thread was one year old (-_-) . It is also marked as “Solved”.

And I thought I unsubscribed from it.

Feel like OP got shit on unnecessarily here (or just got really misunderstood). It’s totally possible to do self-updating app apk without going through the play store. Both Facebook and Amazon provided downloadable apk versions of their apps that could self-update. Lots of other popular apps did the same. In fact, a good chunk of Chinese app makers have to provide self-updating apks for users to download directly simply because there are way too many app stores in China.

I haven’t had the need to do this myself, but here are some solutions:

  • Android Auto Update. Chinese library, but should do the trick, far out the most popular library to do this, but this can be just because Google Play is not available in China.
  • AppUpdateChecker A simple non-Market way to keep your app updated. All it requires to set up is a URL pointing to a JSON document describing your app’s changes.
  • Auto Updater This project allows to automatically update a running APK application using a private update server (see apk-updater) instead of Google Play updater. Also comes with a server script.
  • SmartUpdates. Older library, but instructions in English and also provides a server script.
  • WVersionManager. Checks for updates, but actual update has to be downloaded from the Play Store.

Source: How to autoupdate android app without playstore? Like Facebook app or any Contest app - Stack Overflow

16 Likes

Hello @Singtaa !

Thanks for sharing this information.
Can you help me to apply this auto update on Unity? I have checked the links you shared but i don’t understand how to apply this on Unity.

this helped me c# - How to install Android apk from code in unity - Stack Overflow

3 Likes

@neginfinity I am sorry you have been harassed here by the likes of @FMark92 , some people will always write absurd things when they can’t understand the problem. That’s why I prefer StackOverflow from boards like this one… however…
I am grateful for your research and for what @Singtaa has shared, I have stumbled upon the same issue and how have it a lot easier.

Just wanted to say ‘thanks’ to both of you.

6 Likes

Woaw, all of you are rude. I did an app for a private client that is obviously not on the store and my client want ( of course ) an auto update…Don’t see bad hackers everywhere. Here is an answer for you : c# - How to install Android apk from code in unity - Stack Overflow.

First time I see an idiot answer from unity tech. I’m so surprised !

4 Likes

rude answers as always. if self updater was indeed a virus or unwanted process, 95% of online games on play store would be removed by now. Literally every multiplayer game has self updater to reduce installer size.
there is something i found but imma need to research it some more as i am looking for just resource pulling

Hi MarieScala,
I have the same problem with you, I followed the instruction in Stackoverflow. But I have to build 2 apps, 1 is the “launcher” that contains the code to frequently check if update available and the other is the main application.
Is there any solution to put all together and have only 1 application ?

Also, I encountered the error “App is not installed” sometimes. I don’t know why. Does anyone have this error ?
Thank you

What if I am trying to update a game that is being beta tested. Hence i send to a set group of friends who are testing it for me. It there a secure way of doing this. Is there an API?

1 Like

You could use Unity Remote Config. You would embed the current version value in your game (or get the version via an API) and compare it to a server-side variable at runtime. When you have a new version, update and sync your Remote Config variable. You could either let your customer know that a new version is available, or make the update required and exit. This suggestion doesn’t actually “update” the client, it just lets the user know that a new version is available for download Code integration | Remote Config | 2.0.2-exp.1

Exactly. That is what brought me here. I wanted to give my small band of alpha testers the easiest way to get my most recent build for testing.

1 Like