Having an Android device is beneficial as we can install apps as per our need. Many of us might already be familiar with Google play store which is the app store for Android and have been using it for downloading apps. It is Play Store which is responsible for notifying us of any updates to the installed app. These updates might carry bug fixes, enhancements to existing features or may also include addition of new features.
However, it is up to the users to decide whether to permit Play Store to update these installed apps to the latest version or not. Despite all these facts, Google has not restricted users to get apps from outside its play store. And this is where Google separates itself from other mobile platforms.
The main issue with Google play store updates is the fact that the store takes its own time for updates. To explain further, once the latest application has been uploaded to the store, it lines up all the existing users in a queue and then starts pushing the updates to the users, one by one. Thus, if the number of users are more, it takes more time. If at all, the new application has to reach all the users immediately, then we may have to handle the update programmatically by leaving Google Play store’s auto -update functionality.
Apart from Google play store, there are many other app stores where you can upload the application binaries (apk files). Even in these stores, users can download the app by sharing app link and also provide updates whenever a latest version of app is available on the store. Some app stores provide free publishing as well.
Given below are a few such app stores for Android:
- Amazon App Store
- Mobile Market
- Opera Mobile Store
However, this is not the only way you can install an app. You can install apps even without publishing it in any of the above mentioned third-party stores.
How to programmatically install/update apps?
Given below are instructions to achieve successful installation/updation of a mobile app without using Google Play store or any other store.
- For devices, if it is the first time that you are installing any app outside Google Play Store, you can go to Settings and select Applications to check the “Unknown Sources”.
- Build your app always with a valid version code and version name, and always ensure that manifest file of the app is updated to the next incremental number in version code.
<manifest xmlns_android="http://schemas.android.com/apk/res/android" package="com.example.app" android_versionCode="1" android_versionName="1.0" >
Once the build is ready it can then be either placed in phone storage for installing it and upgrading to the latest build directly by using any file manager. Or can be placed in any webserver or a cloud space provider like dropbox and can use that link for downloading and then installing on the device.
- The best approach to follow will be in instances where the user gets a notification for new updates using custom GCM push notification. The user can then decide on whether he wants to update the app immediately or later. But once clicked on notification, the code can be put to download the file and then go for installation.
- Following code can be used to install/update the application after successful download of apk:
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + appFilelocation.toString()), "application/vnd.android.package-archive"); startActivity(intent);
AndroidManifest.xml requires following permission:
<uses-permission android_name="android.permission.INTERNET" /> <uses-permission android_name="android.permission.INSTALL_PACKAGES" /> <uses-permission android_name="android.permission.WRITE_EXTERNAL_STORAGE" />
User vs System Mobile Apps
These apps can be just User Apps or System Apps. User Apps are ordinary apps which do not interact with internally restricted features on the device. System apps can be a combination of user apps along with codes written to interact with system restricted features. If your app is System App, then it can change the entire way of downloading and installing the new updates for the device to a whole new level. Instead of asking user permission for updating, it can be coded to an extent that the power of installing the updates is decided by the app itself and can be automatically updated without the user’s notice!
Enjoy Building!! In case you need expert help, reach out to us. Trigent’s mobility experts have decades of experience working on different platforms, tools, and technologies to guide and support your application development.