目錄 - Xamarin.Forms
前言
本文介紹版本更新钧萍。
環(huán)境
1.Visual Studio 2019
2.Xamarin.Froms 4.0.0.232914-pre6
3.Android 5.0(API 21)或更高版本
4.約定:XF代表Xamarin.Forms
5.Xam.Plugins.DownloadManager 1.4.0
內(nèi)容
版本更新的流程基本固定:
1.判斷App的本地版本與服務(wù)器版本是否一致磨澡;
2.若小于服務(wù)器版本,則提示用戶(hù)升級(jí)扒吁;
3.用戶(hù)確定升級(jí),跳轉(zhuǎn)App商店或在A(yíng)pp內(nèi)下載安裝Apk室囊,本文介紹后者雕崩。
Xam.Plugins.DownloadManager項(xiàng)目地址:https://github.com/SimonSimCity/Xamarin-CrossDownloadManager
實(shí)現(xiàn)效果
實(shí)現(xiàn)方式
第一步:新建項(xiàng)目,并安裝Xam.Plugins.DownloadManager包融撞。
第二步:在A(yíng)ndroid項(xiàng)目中的AssemblyInfo.cs中添加相關(guān)權(quán)限晨逝。
第三步:配置File Provider
(1)在A(yíng)ndroid項(xiàng)目的AndroidManifest.xml中的application節(jié)點(diǎn)下添加provider。
(2)在A(yíng)ndroid項(xiàng)目的Resource文件夾下添加xml文件夾懦铺,并添加file_paths.xml文件捉貌。
第四步:在共享庫(kù)中添加IVersionManager接口。
第五步:在MainPage中添加檢查更新按鈕冬念,并實(shí)現(xiàn)點(diǎn)擊方法趁窃。
第六步:在A(yíng)ndroid項(xiàng)目中實(shí)現(xiàn)IVersionManager接口。
第七步:創(chuàng)建WebApi急前,添加Apk下載接口醒陆。
源碼
下載鏈接:https://pan.baidu.com/s/1yMP6pD74vw100YoeVRkM4A
提取密碼:3tlc
后語(yǔ)
下篇介紹百度地圖,待續(xù)...