How to work with Android’s in-app update API?

Step 1: Add dependency (build.gradle (app)): dependencies { implementation ‘com.google.android.play:core:1.7.3′ … } Step 2: Check for update availability and start if it’s available private AppUpdateManager mAppUpdateManager; private static final int RC_APP_UPDATE = 11; In onStart() method: mAppUpdateManager = AppUpdateManagerFactory.create(this); mAppUpdateManager.registerListener(installStateUpdatedListener); mAppUpdateManager.getAppUpdateInfo().addOnSuccessListener(appUpdateInfo -> { if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE /*AppUpdateType.IMMEDIATE*/)){ try { mAppUpdateManager.startUpdateFlowForResult( appUpdateInfo, AppUpdateType.FLEXIBLE … Read more

How can I execute something just once per application start?

SharedPreferences seems like ugly solution to me. It’s much more neat when you use application constructor for such purposes. All you need is to use your own Application class, not default one. public class MyApp extends Application { public MyApp() { // this method fires only once per application start. // getApplicationContext returns null here … Read more

Running Microsoft Access as a Scheduled Task

To the best of my knowledge the shortest path for a Windows Scheduled Task to “do something useful in Access VBA” is: Create a Public Function (not Sub) in the database. For example: Option Compare Database Option Explicit Public Function WriteToTable1() Dim cdb As DAO.Database Set cdb = CurrentDb cdb.Execute “INSERT INTO Table1 (textCol) VALUES … Read more

How to disable Google Chrome auto update? [closed]

Have spent a long time trying to disable updates (literally hours, reading forums and testing various (some exotic) solutions), and this was driving me crazy. But there what seems an infallible solution (see further down). Even using the official Google page with the templates did NOTHING: https://support.google.com/installer/answer/146164?hl=en I followed scrupulously the instructions of that page, … Read more

How does one auto update a windows application the way Google Chrome does? [closed]

To replicate this update behavior you need two things: An updater application which checks for updates regularly. If an update is found it should install it automatically. Most commercial setup authoring tools include good updater applications. You can try writing an updater yourself, but it’s not as easy as it sounds. Per-user installations for each … Read more

Auto-update library for .NET? [closed]

ClickOnce has its own security limitations (understandbly so). If you want the full power and control of a Windows application then go with the .NET application updater component. It works like a charm and has even been used by Microsoft internally for their .NET based game (I don’t remember the game name though).

WebView load website when online, load local file when offline

That sounds like a simple webview caching mechanism to me. The following should do what you are looking for: WebView webView = new WebView( context ); webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB webView.getSettings().setAppCachePath( getApplicationContext().getCacheDir().getAbsolutePath() ); webView.getSettings().setAllowFileAccess( true ); webView.getSettings().setAppCacheEnabled( true ); webView.getSettings().setJavaScriptEnabled( true ); webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default … Read more

tech