How to test your app while not effecting active users? - java

I am soon ready to release my app on the play store but I would like to know how can I edit/add features/update my app without affecting my users. For example if I decided to add or remove something from the server I don't want the whole app to crash on the users. Basically running a clone where I can try out anything I want and it stays separate from the original app. How do I do that?
I am really sorry if I confused you all and my English is not the best.

For that you would run a development server and have multiple builds of your app.
You can use google play to distribute that app to your test users, described here or you can manually install the app on test devices. Manually installing is faster(if you have a few test users) than waiting for google play to push an update.
As for how to set it up, that would depend on what you are doing and with what tools. Usually you would set up multiple builds in android with BuildConfig.java variables. There you can either check the build type and use a specific API key/Server URL or you can pass a different value depending on the build. More info here.
Basically in your build.gradle you would have:
android {
...
buildTypes {
release {
buildConfigField("String", "SERVER_URL", "https://api.example.com/")
}
debug {
buildConfigField("String", "SERVER_URL", "https://api.dev.example.com")
}
}
}
You can switch which variant you are building from Build > Select Build Variant... or from the sidebar in Android Studio
Now you can access these from your code as:
BuildConfig.SERVER_URL
Next you would distribute that app to your test users.
As for the server side it depends on how you have it set up now and how you want to set it up.

Google Play’s Core library (on 1.5.0 or higher) has a feature for apps running on devices using Android 5.0 (API level 21) or higher and Chrome OS devices, called In-app updates. If you want users to try a new app feature or apply updates to improve performance or fix bugs, the Play Core library offers two methods. You can notify users about an available update using the Flexible or Immediate approach.
The In-app updates has a new request flow for you to prompt active users to update the app. Using the Flexible approach, the update is downloaded and installed in the background while the app is still in use. With the Immediate option, the user has to accept the update request after which Google Play manages the installation and restart the app.
Set a priority for each update in the Google Play Developer API, which determines how your app recommends an update, using an integer value between 0 and 5, with the default being 0 and 5 being the highest priority.

Related

Android App in-place update

I have an application which is deployed to some pretty remote, data connection starved regions of the world, specifically to health workers.
These people have minimal data connections and the app requires regular updates to provide increased functionality and critical bugfixes.
The problem we have is that the APK for the app is 5.7mb and only going to get larger. Which means that every time the users need to update the app, they have to download the 5.7 meg apk to update. If we roll out more than one release in a week, it can eat through a significant portion of their data plan as well as time as they have to sit and wait for it to download and install.
Is there a better way to do this? Some way to patch the versus completely replacing the application on the host device so that we deploy smaller patches?
I've tried looking for examples of "host" applications, where the actual application is just a shell for a downloadable set of libraries, sort of like a plugin system, but couldn't find any examples.
Are there any resources or a standardised way to accomplish this?
Also worth noting this is a react-native app and we're already running proguard and splitting apks based on architecture to reduce the apk size.
Did you have chance to examine CodePush? It basically allows you to push updates only for javascript part (the bundle) of your app, on-the-fly, without making your users download a new version of the apk.
If you add new native code to your project, you will still need to build and release a new apk though.
How it works is that, when you update the javascript code in your app, you push a new release. When users run the application, CodePush checks if there is a new version available and if there is, update it immediately and restart the app if you mark the mentioned release as mandatory or use the newly downloaded bundle version on next run.
Edit: react-native library of CodePush is here on github.

How to update Android OS on the device through an App

Is there any way to update the Android OS through an App(Using Android API or any other API/) after checking if a newer Android version is available in the market/Playstore
The Use Case required to be supported here is as follows:
The App starts and checks the version of the installed Android OS
It then finds the version of available Android OS in the
Playstore/other repository for that device
Then it compares the two version and if the available version is
newer, then it installs the new Android version on the device
How can it be implemented , especially the third point ? I do not want to root the device for that, so if there is any way to achieve this, please help ....
There is no API. If your device has an update feature built in (most do), you can decompile the update service and see how it works. If your device does not have an update feature, then you can look at custom ROMs for your device. Once you get ahold of a ROM or an update.zip you want to use, the process cannot be done automatically. The updating takes place in the system recovery mode where the user will have to select the .zip to update. However, if you can decompile and figure out how your manufacturer's update service works, maybe you can pull off an automated process.
There aren't any tutorials or documentation for this, as it is 100% dependent on phone model/OS. You can probably find a flashable ROM for your device, however, but the process is rarely automated. Actually, take a look at ROM Manager in this case, it is a somewhat automated upgrade app. I tried it before and it bricked my phone. Good luck
You would need to know where to ask if there is a newer version. And then is there an upgrade available for that particular device. At that point you could broadcast a request to update. Does not the device know when an update is available?
For updating your android version you would need
Custom Android on you device.(Some more info)
Rooted device.why need rooting?
Now for installing we would need to flash ROM.You would also need to have check for version of the OS available, which depend upon your logic .Generally Samsung ,Sony they use custom android and the updates are pushed over app center( or something like that,not much knowledge) in your case it may be any cloud service or server to check version for your custom android.
When we have a new version, after user accepts to upgrade, a new img file would be downloaded to your device which would be used to upgrade the OS.Please note you would also need a recovery backup method too.There are some Commands that can be used to extract and download the OS through your code.
I haven't implemented it yet but this is the procedure i could find.
I hope this would help others.
UPDATE
I have got some new information about how can we initiate the update through code. the Link and there's this another link that can be great help.
In both the examples they are using SystemRcovery class with intallerPackage API.

How to make an app unclosable?

After a user opens my application I don't want them to be able to get out. So when they press the home or back button it doesn't let them exit the app. I know there are ways using a service to keep the app always running in the background, but I don't even want them to even exit.
Is this even possible, if so how? Without having to hack the kernel.
I know this sounds odd, but it is not for a commercial app, but for my lab, it will never be on GooglePlay. The tablets will be given to little kids and they will take a test on it, so I can't have them using youtube or anything else.
Related post: Android, How to make the task of the app unclosable? Only closable by task killing
The answer by CommonWare seems to indicate that kernel hacking is the only way, but is it?
Also I am using Android L.
there is no official support yet - there will be support with android L via the Task locking API
The L Developer Preview introduces a new task locking API that lets
you temporarily restrict users from leaving your app or being
interrupted by notifications. This could be used, for example, if you
are developing an education app to support high stakes assessment
requirements on Android. Once your app activates this mode, users will
not be able to see notifications, access other apps, or return to the
Home screen, until your app exits the mode.
https://developer.android.com/preview/api-overview.html
EDIT: as you said you use L this got obsolete - but I leave it here as a hint for others
said that - you are also able to get this kind of work without root today if you have to ( e.g. kiosk mode app on a certain hardware ). It is not simple - and no solution that works for all devices - but if you need it you can get it work with tricks like:
- reacting on home-screen intent ( and setting it as default )
- when you go to background - bring your self foreground again
- ..
It seems google has some thing called COSU for setting up single-purpose devices
Android 5.0 Lollipop introduced two new ways to configure Android
devices for a single purpose:
With app pinning, the device user can temporarily pin specific apps to the screen.
With lock task mode, a user can’t escape the app and the Home and Recents buttons are hidden. Additionally, lock task mode gives the IT
administrator a more robust way to manage COSU devices, as discussed
below.
and
As an IT administrator, you can configure Android 6.0 Marshmallow and
later devices as corporate-owned, single-use (COSU) devices. These are
Android devices used for a single purpose, such as digital signage,
ticket printing, point of sale, or inventory management. To use
Android devices as COSU devices, you need to develop Android apps that
your customers can manage.
from here
and there is a code lab for it here
for earlier versions of android here i founded How-To Create a Working Kiosk Mode in Android which shows some hacks for disabling buttons and restarting the application after boot and lock. note that most of these hacks, don't work on android 6 and later

How to force users to update app?

I have a condition where the internal DB will be changed and after the migration the old app will no longer work. Is there a way that google play or apple app store provides any flag which does this job?
Also I don't have any version check in my current app (which is already with customers) so cannot display any message in the current app to download new app and ask them to update or quit the app.
I am using Adobe Flash Builder 4.6 to create IOS & Android apps.
You can not force users to update the application but you can send them push notification for updating the application if they want to and you have implemented into current version.
But when you release the update they are able to get notify by app store and if they want they can install the update from there..
As you cannot force users to update the app using Google play or AppStore build-in feature, you can use third party librairies that do exactly what you want. appgrades.io allows you to block any version of your app by displaying a view or popup (that you can customise on appgrades Dashboard) with a custom message to ask your users to update the app. You can even add an update button that sends the users to the appstore/Google play where they can update the app. No code needed. Just integrate the SDK in your app and block any version anytime.
The other solution would be coding what appgrades does by checking with your api the latest available version and block the app with a view when you are running a lower version.

How does downloading game updates works?

Let's say I published a game and after some point of time I wanted to release an all new feature for the game. Of course the app must be able recognize and download the update. How does this work specifically with Google Play apps? Does the app download the entire new version of APK from the market and reinstalls itself? I'm using Java for the development, if this info helps. Any tips you can give me about this topic?
With Google Play, the user is notified that app updates are available. It is up to the user to initiate the download of the updates.
You can always include in your app a check to your server as to whether an update is available. However, this becomes a maintenance issue.

Categories

Resources