https://github.com/angelinn/Xam.Plugin.AutoUpdate
Xamarin Forms plugin that auto updates your Android or UWP sideloaded application.
https://github.com/angelinn/Xam.Plugin.AutoUpdate
android apk appx auto-update forms plugin update uwp xamarin
Last synced: 23 days ago
JSON representation
Xamarin Forms plugin that auto updates your Android or UWP sideloaded application.
- Host: GitHub
- URL: https://github.com/angelinn/Xam.Plugin.AutoUpdate
- Owner: angelinn
- License: mit
- Created: 2018-10-26T18:11:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-05T15:47:05.000Z (over 1 year ago)
- Last Synced: 2025-04-24T06:02:22.075Z (about 1 month ago)
- Topics: android, apk, appx, auto-update, forms, plugin, update, uwp, xamarin
- Language: C#
- Homepage:
- Size: 2.28 MB
- Stars: 34
- Watchers: 5
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xamarin-forms - Xam.Plugins.AutoUpdate ★23
README
# Xam.Plugin.AutoUpdate
## This library is not longer supported. If you need some functionality, PRs are accepted.## Auto update for your Android/UWP
![]()
![]()
![]()
![]()
## What is it?
* Check for update and auto install sideloaded Android or UWP application
* Check for update and redirect to play store
* **The auto install part works only with UWP and Android**## How does it work?
* Developer provides a check for updates function, returning if there is an update available and the url to the file, if provided
* The plugin checks for updates every ```RunEvery``` period of time
* When a new version is available and the user clicks the **confirm** button, the file from the provided url is downloaded and started## Installation
Nuget package will be available soon.Install the package on the mobile projects in your solution (.netstandard, Android, UWP, iOS).
## Android
For Android API > **23** a ```FileProvider``` configuration is required:
* Add to AndroidManifest
```xml
```* Create a new file - ```Resources/xml/file_paths.xml```
```xml
```
* Add to ```MainActivity```
```C#
AutoUpdate.Init(this, authority);```
**NOTE:** The authority value is the same as the **android:authorities** in the ```AndroidManifest``` file.
**NOTE:** Since Android Oreo (API 27), every app needs additional access to install APKs. You *must* add this permission if you wish to support Oreo:
```xml```
## Usage
* Create an ```UpdateManagerParameters``` option.
* Use ```UpdateManager.Initialize(parameters, mode)``` somewhere in your forms project. (e.g in **App.xaml.cs**)```C#
UpdateManagerParameters parameters = new UpdateManagerParameters
{
Title = "Update available",
Message = "A new version is available. Please update!",
Confirm = "Update",
Cancel = "Cancel",
// choose how often to check when opening the app to avoid spamming the user every time
RunEvery = TimeSpan.FromDays(1),
CheckForUpdatesFunction = async () =>
{
// check for updates from external url ...
return new UpdatesCheckResponse(true, downloadUrl);
}
}
```Use ```UpdateMode.AutoInstall``` to download and install the application
```C#
UpdateManager.Initialize(parameters, UpdateMode.AutoInstall);
```or ```UpdateMode.OpenAppStore``` to open the corresponding app store
```C#
UpdateManager.Initialize(parameters, UpdateMode.OpenAppStore);
```## Auto install
Using the auto install mode, the plugin will download the file provided in the **DownloadUrl** parameter and launch it as **apk** or **appxbundle**, depending on the platform.**Note:** As stated earlier, this option does not work with **iOS**, due to the restrictions of the operating system.
## Open app store
Using the open app store mode, the plugin will open the specified platform's **app store**, if an update is available.**Note:** Additional logic is used for android to determine that only the **Google Play store** can open the ```market://``` url and no other app that has registered for it.