技术控

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

[其他] MAHAndroidUpdater

[复制链接]
以后为自己醉 发表于 2016-10-11 13:44:57
249 3
MAHAndroidUpdater - MobAppHome android update helper library

   MAHAndroidUpdater is library for notifing update information to installed android apps on android device. By it's help old application gets notified about update information from Google Play Market Library has build on IDE Android Studio and binaries have added to jcenter() maven repository.
   You can check jCenter() download statistics on this link - https://bintray.com/hummatli/maven/mah-android-updater#statistics
  PlayStore

      MAHAndroidUpdater - Sample app has published on Google PlayStore. You can easly test module functionality with downloading it.
   

MAHAndroidUpdater

MAHAndroidUpdater
    Images

   

MAHAndroidUpdater

MAHAndroidUpdater

MAHAndroidUpdater

MAHAndroidUpdater

  Service structure

  To provide update information to your app you need to implement service responding json data about application current state. Structure of the json data is as below.
  Json with sample data
  1. {
  2.     "is_run_mode":"true",
  3.     "name":"MAHUpdater Sample",
  4.     "uri_current":"com.mobapphome.mahandroidupdater.sample",
  5.     "version_code_current":"2",
  6.     "version_code_min":"1",
  7.     "update_info":"On version 1.0 we added bla bla",
  8.     "update_date":"16/07/2016"
  9. }
复制代码

       
  • is_run_mode - service mode: if it's false modul will not react to service and will not show dialogs   
  • name - name of the belonging app   
  • uri_current - current package path   
  • version_code_current - current version code avilable   
  • version_code_min - Minimum version code, which does not work normal and had to force to update   
  • update_info - Update information   
  • update_date - Update date  
  If one of the variables would not be on json, then modul will not repond to service and act, Try to implement all data.
  Library structure

  Library contains from to Dialog component
  
       
  • MAHUpdaterDlg - In this situation dialog show to user to update or install newer version and lets to postpone the action to later time and use application   
  • MAHRestricterDlg - In this situation dialog urges user to update or install newer version and dont alow use older version  
   The porpose of lib to show automatically these dialogs on application start if there are any need for it. - MAHUpdaterDlg opens on following situation.
  
       
  • Or uri_current value is different from app's installed package url   
  • Or version_code_current value is greater than app's installed version on device  
   - MAHRestricterDlg opens on all situation MAHUpdaterDlg opens and following situation.
  
       
  • version_code_min value is greater than app's installed version on device  
  But when you develop your apps UI and want to show these dialogs there are test modes also and you can open dialogs by calling methods relatively
  
       
  • MAHUpdaterController.testUpdaterDlg(activity); - MAHUpdaterDlg   
  • MAHUpdaterController.testRestricterDlg(activity); - MAHRestricterDlg  
  Installation manual

    1) To import library to you project add following lines to project's build.gradle file. The last stable version is 1.0.12
  1. dependencies {
  2.             compile 'com.mobapphome.library:mah-android-updater:1.0.14'
  3.     }
复制代码
   2) On the start of your application call MAHUpdaterController.init() method to initialize modul. For example: MainActivity's onCreate() method or in splash activity. Check http url is correct and points to your service on the web. Code:
  1. MAHUpdaterController.init(activity,"http://highsoft.az/mah-android-updater-sample.php");
复制代码
   3) When you quit app, you have to call MAHUpdaterController.end() method to finalize modul. For example: MainActivity's onDestroy() method.
  1. MAHUpdaterController.end();
复制代码
   4) To customize MAHAndroidUpdater dialog UI and overide colors set these values on your main projects color.xml file
  1. <color name="mah_android_upd_window_background_color">#FFFFFFFF</color>
  2.     <color name="mah_android_upd_title_bar_color">#FF3F51B5</color>
  3.     <color name="mah_android_upd_info_txt_color">#FF3F51B5</color>
  4.     <color name="mah_android_upd_restricter_dlg_btn_pressed_color">#a33F51B5</color>
  5.     <color name="mah_android_upd_restricter_dlg_btn_dark_state_color">#ff3F51B5</color>
  6.     <color name="mah_android_upd_restricter_dlg_btn_light_state_color">#ffffffff</color>
  7.     <color name="mah_android_upd_upd_dlg_btn_text_color">#ffFF4081</color>
复制代码
   5) Localization: Module now supports 4 languages (English, Azerbaijan, Russia, Turkey) . To set localization to app use your own method or if it is static and don't change in program session you can just simply add LocaleUpdater.updateLocale(this, "your_lang"); in the start of your app. For examlpe LocaleUpdater.updateLocale(this, "ru");
    6) To customize MAHAndroidUpdater UI texts and overide them add these lines to main projects string.xml and set them values
  1. <string name="mah_android_upd_dlg_title">Update info</string>
  2.     <!-- Button texts-->
  3.     <string name="mah_android_upd_dlg_btn_no_later_txt">Later</string>
  4.     <string name="mah_android_upd_dlg_btn_no_close_txt">Close</string>
  5.     <string name="mah_android_upd_dlg_btn_yes_update_txt">Update</string>
  6.     <string name="mah_android_upd_dlg_btn_yes_install_txt">Install</string>
  7.     <string name="mah_android_upd_dlg_btn_yes_open_new_txt">Open new version</string>
  8.     <string name="mah_android_upd_dlg_btn_no_uninstall_old_txt">Uninstall old</string>
  9.     <!-- Info texts-->
  10.     <string name="mah_android_upd_updater_info_install">Application has moved to new address. Please install newer version</string>
  11.     <string name="mah_android_upd_updater_info_update">"New version is available. Please update application"</string>
  12.     <string name="mah_android_upd_restricter_info_install">This is old version and does not operate. An application has moved to new address. \nPlease install newer version</string>
  13.     <string name="mah_android_upd_restricter_info_update">"This is old version and does not operate. Please update application"</string>
  14.     <string name="mah_android_upd_restricter_info_open_new_version">"This is old version and does not operate. Please open new version"</string>
  15.     <!-- Additional information-->
  16.     <string name="mah_android_upd_internet_update_error">Check your internet connection</string>
  17.     <string name="mah_android_upd_info_popup_text">MAHAndroidUpdater library</string>
复制代码
   7) As modul takes information from web servcie you need add INTERNET permission to main project.
  1. <uses-permission android:name="android.permission.INTERNET" />
复制代码
Proguard configuration

   MAHAndroidUpdater uses Gson and Jsoup libs. There for if you want to create your project with proguard you need to add following configuration to your proguard file.
  1. ##---------------Begin: proguard configuration for Gson  ----------
  2. # Gson uses generic type information stored in a class file when working with fields. Proguard
  3. # removes such information by default, so configure it to keep all of it.
  4. -keepattributes Signature
  5. # For using GSON @Expose annotation
  6. -keepattributes *Annotation*
  7. # Gson specific classes
  8. -keep class sun.misc.Unsafe { *; }
  9. #-keep class com.google.gson.stream.** { *; }
  10. # Application classes that will be serialized/deserialized over Gson
  11. -keep class com.google.gson.examples.android.model.** { *; }
  12. ##---------------End: proguard configuration for Gson  ----------
  13. ##---------------Begin: proguard configuration for Jsoup--------------------------------
  14. -keep public class org.jsoup.** {
  15. public *;
  16. }
  17. ##---------------End: proguard configuration for Jsoup--------------------------------
复制代码
End

   Thats all. If you have any probelm with setting and using library please let me know. Write to [email protected] . I will help.
  Contribution

  I am open to here offers and opinions from you
  
       
  • Fork it   
  • Create your feature branch (git checkout -b my-new-feature)   
  • Commit your changes (git commit -am 'Added some feature')   
  • Push to the branch (git push origin my-new-feature)   
  • Create new Pull Request   
  • Star it  
  Contribution for localization

   We need help to add new language localization support for libarary. If you have any hope to help us we were very happy and you can check following GitHub Issues URL to contribute. To contribute get res/values/string.xml file and translate to newer language. Place it on res/values-"spacific_lang"/string.xml
   If you have any question please ask to me on [email protected]
  Developed By

   Sattar Hummatli - [email protected]
  License

   Copyright 2016 - Sattar Hummatli
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
   http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
回复

使用道具 举报

dasher 发表于 2016-10-11 14:39:21
嘘,低调。
回复 支持 反对

使用道具 举报

士大夫但是 发表于 2016-11-1 13:24:11
以后为自己醉很热情啊!
回复 支持 反对

使用道具 举报

111252 发表于 2016-11-21 08:16:40
锻炼肌肉,防止挨揍!  
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


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

© 2001-2017 Comsenz Inc.

返回顶部 返回列表