When updating an app in the appstore, automatic data download? - android

My question is, I have to update an app that's on the appstore when they download the update will all the data also be downloaded automatically or not, my app is a calendar with events and a recyclerView with there events and the update is to update the calendar range from last year to this year (2019/01/01 - 2020/01/30) => (2020/01/01 - 2021/01/30) but doing this also means I need to download the calendar events again.
My download function is in the MainActivity.java and it downloads a json from online.
Is there a way to force this download when the person updates the app?
EDIT: This is the section of code that changes in this update, the widget in this case is this dependency
widget.state().edit()
.setMinimumDate(CalendarDay.from(2020, 1, 1))
.setMaximumDate(CalendarDay.from(2021, 1, 31))
.commit();

This also has sdk versions dependencies as per https://developer.android.com/guide/topics/data/autobackup, but generally speaking two possibilities exist:
Your previous app is already installed and used on the device
This is clean install on new device of user who was using your app on other device
All the cached data for p1 will be there for your scenario.
P2 depends on your manifest configuration and if device does backups: https://developer.android.com/guide/topics/manifest/application-element#allowbackup
If you application manifest says allowBackups true and device was configured/able to backup previous app version, clean install for user who was using your app on device A will get shared prefs, local storage etc (https://developer.android.com/guide/topics/data/autobackup) to device B upon install of the app. Summing up, if you are using any of the storages mentioned in autobackup url, they will be restored and ready for use.

Related

Android In-App update API return 0 as availableVersionCode & updateAvailability as 1 (UPDATE_NOT_AVAILABLE)

I'm trying to implement the in-app update API, followed in-app-update-api, when debugging the app with lower version than play store version, AppUpdateInfo return availableVersionCode as 0 and updateAvailability as 1 (UPDATE_NOT_AVAILABLE),
Note: I've used the same package name & same signing key to run a build
Thanks in advance!
The most likely reason is that the Play Store on your device hasn't learnt about the new update yet.
After you release your update in the Play Developer Console, the information about this update does not reach immediately all devices; some Play Store background job on the device is responsible for periodically checking for updates for installed apps and refresh the on-device cached information.
"But I want to test the behaviour on my device now, I don't want to wait for a background job to complete before I can test. Can I force the refresh of this cache?"
Yes, take a look at the last item of the Troubleshooting section here: https://developer.android.com/guide/app-bundle/in-app-updates#troubleshoot
To refresh the cache you need to: close the Play Store; reopen it; navigate to the "My Apps & Games" app.
"Will my users need to do this too?"
No: your users can just wait for the background job to run.
At least you should download the app from Play Store. This because the device must know exact information about the application.
I also had the exactly same problem, and I solved it. You should check what kind of context you are passing to create AppUpdateManager. It seems like you need to pass global app context when creating AppUpdateManager.
So if you are just passing "this" or some other activity context, change it to "Global App Context".
From
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(this);
to
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(getApplicationContext());
According to the documentation context is the application Context for your app

How to inform about app update for an app that is 'not in market' but on a drive, programatically?

I have made an app for my friends so that they can view class notes.The app is not available on play store. Every time I update the app, I upload the new apk file to google drive.I want to write a simple code in my app that can inform if a new version is available or not.How can I do this?I don't want the user to automatically download the new version instead prompt the user to download the new version by clicking a button
In the same Drive folder that you post your app, you can also put a text file, call it something like version.txt. In this file, just put the version number of the latest version of the app. It can be as simple as an integer that you increment each time you post the app.
Then at startup, your app can do the following:
Download the version.txt file, and note the version number. Call this V-Drive.
If a locally-stored version exists, read it. If not, save the value of V-Drive to SharedPreferences. Call this V-Local.
If (V-Drive > V-Local) display a message telling the user that there is a new version available for download.
You can use FABRIC. Make registration and after that get the CRASHLYTICS(A tool from Fabric made for testing purposes). It is quite easy to use and they are explaining step by step what to do in order to activated it. After that you can just add them in the list of testers and at the moment you release new version it will send them email with the updated app. I use it for work and it is working quite nice and it looks professional.
Good luck!!!

Keep an internal app updated

I'm going to develop an android app for a museum, which will handle a tablet with the app installed on it to the visitors.
The app will be on foreground full time and visitor will only be able to use this app.
Since there will be many tablets, and they are all under our control, I would like a way to update all the tablets remotly with the last version of the app.
Is there a way to achive this?
Is there a way to achive this?
Answer is : Yes but with one exception lets have a look.
Step 1 : Create a local server for your museum. I guess it is already in the museum.
Step 2 : Now In your android application whenever you start your app check that whether new version of APK is available. For checking APK new version you can use this code.
PackageInfo packageInfo = getPackageManager().getPackageInfo(context.getPackageName(), 0);
int apkVersion = packageInfo.versionCode;
You should set your APK name like "yourAppname_version" so whenever you upload the new app to your local server just change the name so you can easily identify that new version of APK is available or not.
Step 3 : If new version is available then start downloading APK from the local server and save it to your storage directory.
Step 4 : When downloading completed you can call this set of code to install the new APK.
Intent intentApkInstall = new Intent(Intent.ACTION_VIEW);
intentApkInstall.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+"/"+"yourAppname_version.apk")), "application/vnd.android.package-archive");
intentApkInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentApkInstall);
Now the Exception part is here the above code will prompt user to install APK. So in this case you have to install it manually.

Turnbased matches disappear after loading for the first time

I'm developing a game for Android using the Google Play Services for creating a turnbased match.
At first everything was fine I load the turnbased matches for the signed in user using
Games.TurnBasedMultiplayer.loadMatchesByStatus(getApiClient(),
new int[]{TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN,
TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN,
TurnBasedMatch.MATCH_TURN_STATUS_INVITED,
TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE})
.setResultCallback(this);
It always loaded all matches that are any of the given states. But since last weekend the callback is called but there are no matches, as I'm not participating in any match (Status response is OK). I deleted the cache of Google Play Services on my phone and rebooted the device. At that moment all the matches were shown again until the next time I opened the app. Again all matches were missing.
Once I start a new match the match keeps showing up with the above method (refreshing the list) until I close the app. At the next launch that match is also gone.
I have to say the game is not published yet but in a test phase on the Google Play Developer Console. I found the same issue on an emulator. It ran fine for days but suddenly got the same problem as my real device (with a later build so it is not that a single change of code causes this).
Did anyone else notice this behaviour or has an idea on how to resolve it?
Might it be related to having multiple apps connected to one game? I had two apps signed with debug certificates connected and this afternoon added one for a signed apk. When I used the signed apk it worked again until I deployed a new test app (debug signed). After switching back to the signed apk the bug is still around.
As nobody seems to know the answer let me rephrase the question. Should I cache TurnBasedMatches myself on the device? I just deleted the play services cache again and reopened my app. Result? A list of hundreds of games (since I have to start a new game every time while testing...)
My code to handle the loadMatchesResult
#Override
public void onResult(TurnBasedMultiplayer.LoadMatchesResult loadMatchesResult)
{
showToast("GotMatches status: " + loadMatchesResult.getStatus().getStatusCode());
//add matches to listview (only caching matchId, no references to turnbasedmatch)
loadMatchesResult.getMatches().getMyTurnMatches().close();
loadMatchesResult.getMatches().getInvitations().close();
loadMatchesResult.getMatches().getTheirTurnMatches().close();
loadMatchesResult.getMatches().getCompletedMatches().close();
loadMatchesResult.release();
}
Found another interest point.. it starts to look like the issue occurs when deploying a new apk to the device... Once I deploy a new apk (either by install alpha version from google play or directly debug version from Android Studio) the matches are gone. When I don't change the apk I can reboot my phone/close the app and it works fine...
Issue also occurs if I update the app through the play store... There should be more people having this problem!
Gotten from https://developer.android.com/reference/com/google/android/gms/common/api/PendingResult.html#setResultCallback(com.google.android.gms.common.api.ResultCallback)
After the result has been retrieved using await() or delivered to the result callback, it is an error to attempt to retrieve the result again. It is the responsibility of the caller or callback receiver to release any resources associated with the returned result. Some result types may implement Releasable, in which case release() should be used to free the associated resources.
After you retrieve the result, an error is given when you try to get the results again, until you free the resources associated with the returned result, which is why clearing the cache works to make them visible again. You need to either access the device's cache and display results from there as well, or clear the associated resources (within the program) whenever you want to access the results again.
I had the same problem until I found "Saved Games" in my Developer Console:
Go to Game Services -> Game Details -> Saved Games
Set the item to "On"
This should solve your issue.

phonegap mobile apps and version control and updates

I have currently built an application using phone gap targeting the android and blackberry platforms.
I use a combination of Jquery mobile and Phonegap for my application, since both are open source frameworks and improvements as well as bug fixes keep happening I wanted to know what would be a good solution for alerting my users to update their application when I upgrade the above frameworks in my application.
One solution I had in mind is maintain a version numbering on my server for the apps, when the app is loaded on the users device we can make an ajax call to check for version update and then alert the user to upgrade their application.
Android market also has an auto update feature how does that work! How do I go about this what would be a good approach.
If you are planning to build "native", in this case localy installed apps. You don't have to worry about informing the user. As soon as you uplad the new versions to the Android market or App World the App market systems will let the users know automatically.
I think (in most cases) it is not necessary to let the user know about updates within the app. Some apps do that but I see it less often since it really does not make much sense.
But in case you want to build such a feature, I would store a version number somwhere in the code and make a server request eg. when the app starts which then compares the latest version number of your app stored on your server.
Eg.
Client:
$.ajax({
url: webservice_host + '&callback=?',
dataType: 'jsonp',
success: function (data) {
//data -> remote version
var local_version;
if (local_version < data ){
alert("There is a newer version available");
}
}
});
Server (php in this case):
<?php
print mysql_real_escape_string($_GET['callback']). '( 1.1 )';
?>
I didn't test the code for typos etc. But this should do the trick.

Categories

Resources