Our Android app will be used in a place without internet. We have one server with limited internet there.
Can user download the app from the server instead of google play, the way we can use ios cache server?
If we keep a copy of app in the server and install from it, how can we update the app with latest version?
Thanks.
You can host the apk file on the server and download it to the devices for installation. However, you first need to enable third party source installation for the devices.
Link how to here,
https://www.cnet.com/how-to/how-to-enable-third-party-app-installation-on-most-android-phones/
In terms of the update, you can always update the apk file anytime but you might need a separate system to notify the users/devices about the update. Probably by using SMS.
Related
So, I have this old app, and problem is that app is accessing old backend URL, which no longer exists.
How do I change this url without recompiling app? Is there any app which can redirect traffic of other apps to specific URL?
On Windows, Fiddler can do that.
My phone is not rooted so using hosts file to remap domain is not an option.
What you are asking for is man in the middle application.
On google play there are a plenty of them, and some of them know how to modify request.
For example here: is mentioned that this application can modify request.
I am having my own apps store where all android applications are hosted. Some apps are modified. So How i can send updates to clients/users using OTA. So clients will come to know about new updates and he will be able to download it.
Found an interesting solution on HN a month back. This is related directly update the app on the client without any user interaction. And since you have your own app store, shouldn't face any problems as listed in the HN thread.
The solution working snippets from the website-
...intercepts all calls to startActivityForResult, getResources, and some other functions. When you try to start an activity, Evolve generates a dummy class and sets its superclass to the activity you want to start.
...dynamically generates the bytecode for a new class
...then changes the intent to start the appropriate class
This is still in alpha mode, so would require some effort from your side to integrate.
Link to solution - http://blog.vivekpanyam.com/evolve-seamlessly-deploy-android-apps-to-users
Assuming this is what you are expecting, hope this helps!
1.Create a Web Service which your app can poll whenever the app launches or based on some time limit that can check if there is new version out there.
2.This Web service should return the lastest Version of the apk file that is hosted on the Server along with the URI of the application file that has the new version.
3.When your app gets the response from the Web Service, it will parse the JSON and check your app version to the lastest version that is available on the server.
4 If your app version is lower than the latest version it will prompt the user to start the download process.
5.The download of the new app is handled by the Download Manager.
The download manager will notify your app using Broadcast receiver when the download is complete.
6.Upon completion of the latest version of the application file the you can start the activity to install that file.
At this point user needs to say OKAY, lets do it.
Check this https://code.google.com/p/auto-update-apk-client/
If you have your own app store, then you must have a client app running on the relevant devices that allows them to install/update apps from that app store.
As part of that client, you can have a service, that enumerates the installed apps on the device and checks with your store whether updates are available. If yes, then it presents the user with a prompt to visit the store to update the corresponding apps - or do whatever else is appropriate in the situation.
You may also want to register this service to receive broadcasts of network connection events so that if there is no internet connection, the service will receive a notification when the connection is available again.
I am developing an Android app that uses Google Cloud Endpoints on Google App Engine (in Python) for its backend. The Android app authorizes the user using Google Play Services on the Android device, and it all works fantastically.
However, now that I have actual users, I'd like to be able to test this all locally before deploying any app engine API changes to production, and I haven't figured out how to have the Android app talk to my local development server anywhere. The testing recommendations suggest that I just do some manual tinkering with API Explorer, but as I'm using the Endpoints Proto Datastore for my API, which makes the Android development easy, it also makes the API Explorer basically useless, since the calls I need to make are far more complicated than what I can generate by hand.
One answer to this question suggests that there is a way to point the Android client at the local server, but while I can use the --host argument to have the dev_appserver's default server listen on something other than localhost, I can't seem to find a way to do the same for the API server. And even if I could do that, it might only be the first step to a full end-to-end local testing setup for my Android app.
Can someone post more details on how I might do this, or short of that, please enlighten me on the best practices for testing Android apps that use Google Cloud Endpoints on App Engine? Thanks in advance for any answers.
Alright, finally got it working, thanks for the tips, Dan! Here are the remaining details that would have saved me a few hours - hopefully this is helpful to someone else.
1) As I expected and mentioned earlier, dev_appserver.py needs to be run with --host=0.0.0.0 so that it can listen on the local network.
2) In order to properly parse the ID token to make the user authentication work, you need to have the PyCrypto library installed - it is not installed by default, so just having it in your app.yaml isn't enough. I found the binaries for Windows here.
3) Then, in my generated Tictactoe.java-equivalent class, I had to change the DEFAULT_ROOT_URL to be http://<my-local-machine>:8080/_ah/api/ (which is where my local machine is running), so that requests went to the local network. Alternatively (and perhaps less invasively), you can use builder.setRootUrl to the same address from wherever you initialize your builder. This way you don't muck with your generated classes.
4) I also had to make the change Dan mentioned described here.
After doing those four things, everything seems to be working now and I can test my app locally - hooray!
In the local environment, the dev_appserver is the API server. If you've configured it so that it's accessible from machines other than localhost (i.e. another machine/device on the network) API requests should be accessible as well.
However, there's currently an issue with the local server and gzipped requests. Until that's fixed you'll need to disable gzipping within the client library in your Android app (see this post).
Is it possible to update application from itself in Android? The app in question is a system app, so I can execute privileged commands. Also note that I don't want to show any notification to user, so everything should work in the background.
It is actually pretty easy for an app to update itself, the hard part is doing it without putting up a prompt to the user. The app needs to download the APK, then send it to the PackageManager API to install it. Android will then put up the install prompt. There is a library to handle that part:
https://gitlab.com/fdroid/update-channels
As for doing it with prompting, the app needs privileged access. If the device is rooted, the app can request root access. The app can also be flashed as a "priv-app" so that it has privileged access. Or you can do it like F-Droid: flash the Privileged Extension as a "priv-app", and make your app send install/uninstall requests to Privileged Extension.
Otherwise, you need to download binary code, and dynamically load it, like #yusuf-x said. Be aware that Google is working to make that impossible in each new release of Android.
Use the Java ClassLoader to dynamically load code that was push or pulled down. – Yusuf X just now edit. I've used this for just such a purpose on Android.
Fdroid is an open source application repository.
Their client app can install/update/delete apps from the fdroid repository, including itself.
See the code for the installer part of the client app here:
https://gitlab.com/fdroid/fdroidclient/tree/master/app/src/main/java/org/fdroid/fdroid/installer
I would like to notify the users when there is an update because the updates will be coming from my own website and not the market. However, do not want to have to update two places.
Either that or I would like to share the existing update notifier that is included with android. I am planning on uploading the app to one of our websites instead of the market.
Thanks!
AFAIK there is no public API for this provided by the Android OS or by the Android Market app. Note that hardware vendors often bundle their own update apps for this very reason.
Your best bet is to put the APK on your web server for download. Every time you download it, record the date from the Last-Modified HTTP header. Then in future you can poll this file using If-Modified-Since if your server supports this tag, if it doesn't you can get the header and check the Last-Modified date programmatically without downloading the HTTP contents.
Once you know an update is available, you can notify the user with your own notification code. If you plan to update the app programmatically, you will need to make sure you request the android.permission.INSTALL_PACKAGES permission in your manifest.