请选择 进入手机版 | 继续访问电脑版

技术控

    今日:1| 主题:61668
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] ForceUpdate

[复制链接]
一瞬间的记忆 发表于 2016-10-7 10:23:37
162 1
Force your users to update the app, or notify about non-critical updates.
  Download

  Download the latest JAR:
  or via Gradle:
  1. compile 'net.skoumal.forceupdate:force-update:0.1.0'
复制代码
Usage

  This library was designed with full customizability in mind. Whole library is based on three simple terms:
  
       
  •       VersionProvider- provides version from some source, for example from your APK, Google Play, your server, or any other third party service. You can choose one of existing VersionProviders, or create your own.      
       
  •       UpdateView- abstraction of the way how we notify user about new version available (recommended update) or about necessary update (forced update). Predefined Activities and dialogs available again.      
       
  •       CheckInterval- how often should we ask        VersionProviderfor new data. The under-the-hood strategy is to ask with every        Activity.onResume()event if        MinIntervalis already reached.      
      
  To init ForceUpdate library use this simple builder in your Application:
  1. new ForceUpdate.Builder()
  2.         // required - needs android.app.Application object
  3.         .application(this)
  4.         // defaults to NULL - no force update view will ever appear
  5.         .minAllowedVersionProvider(new MyCustomVersionProvider())
  6.         // defaults to 24 hours
  7.         .minAllowedVersionCheckMinInterval(4 * 3600)
  8.         // defaults to version from http://carreto.pt/tools/android-store-version/?package=<your package>
  9.         .recommendedVersionProvider(new GooglePlayVersionProvider())
  10.         // defaults to 24 hours
  11.         .recommendedVersionCheckMinInterval(6 * 3600)
  12.         // defaults to NULL - no force update view will ever appear
  13.         .excludedVersionProvider(new MyExcludedVersionListProvider())
  14.         // defaults to 24 hours
  15.         .excludedVersionCheckMinInterval(8 * 3600)
  16.         // defaults to current apk version
  17.         .currentVersionProvider(new ApkVersionProvider())
  18.         // defaults to predefined activity
  19.         .forcedUpdateView(new ForcedVersionActivityView())
  20.         // defaults to predefined dialog
  21.         .recommendedUpdateView(new RecommendedVersionView())
  22.         // alias for .build().init()
  23.         .buildAndInit();
复制代码
Extras

  Library is able to detect crash during last version check and hangs main thread during next app start to avoid any other code execution and allow successful version check. If there is new version available it fires notification automatically.
  License

  1. Copyright 2016 SKOUMAL, s.r.o.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5.    http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
复制代码
lin346516709 发表于 2016-10-15 15:09:18
虽不明,但觉厉,你懂的
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/c.CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表