2014-09-27 60 views
0

我可以問你一個問題嗎?更新可用消息自動出現 - android

我構建了一個Android應用程序,但它不在谷歌Play商店。我想在那裏添加更新警報消息,所以我嘗試WVersionManager - https://github.com/winsontan520/Android-WVersionManager。它顯然在測試中運行,但點擊「立即更新」按鈕後沒有任何事情發生。

主要問題是我可以在哪裏添加我的應用程序apk鏈接 - 我上傳了update_content_json_format.txt,它運行良好。該文本文件只適用於更新信息 -

{"version_code":2,"content":"Version 2.0 
<p>New features:</p> 
<li>Added feature A</li> 
<li>Added feature B</li> 
<li>Added feature C</li> 
<li>Added feature D</li> 
<li>Added feature E</li> 
<li>Added feature F</li> 
<li>Added feature G</li>"} 

請點我在哪裏可以添加我的更新應用程序APK鏈接,是不是從Play商店中。

- 或 -

根據這個想法,我想知道如何自動顯示可用的更新對話框,每當我打開應用程序。

非常感謝!

隨着問候,

回答

0

哇..我沒關係的外部下載鏈接!

我改變一點點原有的(有些代碼的不習慣,但我不知道刪除但)

package com.winsontan520.wversionmanager.sample; 

import com.winsontan520.wversionmanager.sample.R; 
import com.winsontan520.wversionmanager.library.WVersionManager; 

import android.os.Bundle; 
import android.app.Activity; 
import android.view.Menu; 
import android.view.View; 
import android.widget.EditText; 

public class CheckVersionActivity extends Activity { 

    // this is just a sample url to retrieve update content, the return content must follow the json format as stated in readme.md 
    public final static String URL_VERSION_2 = "http://......."; // this link is refer to a static text file hosted using dropbox 
    public final static String URL_VERSION_3 = "http://........"; 

    private EditText versionContentUrl; 
    private EditText updateNowLabel; 
    private EditText remindMeLaterLabel; 
    private EditText ignoreThisVersionLabel; 
    private EditText reminderTimer; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.check_version); 

     versionContentUrl = (EditText) findViewById(R.id.versionContentUrl); 
     updateNowLabel = (EditText) findViewById(R.id.updateNowLabel); 
     remindMeLaterLabel = (EditText) findViewById(R.id.remindMeLaterLabel); 
     ignoreThisVersionLabel = (EditText) findViewById(R.id.ignoreThisVersionLabel); 
     reminderTimer = (EditText) findViewById(R.id.reminderTimer); 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.activity_main, menu); 
     return true; 
    } 

    public void onClickHandler(View v){ 
     switch(v.getId()){ 
     case R.id.use_version_2_button: 
      versionContentUrl.setText(URL_VERSION_2); 
      break; 
     case R.id.use_version_3_button: 
      versionContentUrl.setText(URL_VERSION_3); 
      break; 
     case R.id.check_version_button: 
      checkVersion(); 
      break; 
     } 
    } 

    private void checkVersion() { 
     WVersionManager versionManager = new WVersionManager(this); 

     versionManager.setVersionContentUrl(versionContentUrl.getText().toString()); 
     versionManager.setUpdateNowLabel(updateNowLabel.getText().toString()); 
     versionManager.setRemindMeLaterLabel(remindMeLaterLabel.getText().toString()); 
     versionManager.setIgnoreThisVersionLabel(ignoreThisVersionLabel.getText().toString()); 
     versionManager.setReminderTimer(Integer.valueOf(reminderTimer.getText().toString())); 

     versionManager.checkVersion(); 

     versionManager.setUpdateNowLabel("Update Now!"); 
     versionManager.setRemindMeLaterLabel("Not Yet"); 
     versionManager.setIgnoreThisVersionLabel("Remind me soon"); 
     versionManager.setUpdateUrl("http://......../uploads/ExampleListActivity.apk"); // this is the link will execute when update now clicked. default will go to google play based on your package name. 
     versionManager.setReminderTimer(10); 
    } 

} 

,但我還是想知道它自動顯示可用的更新對話框,每當我在不點擊「檢查更新」按鈕的情況下進入應用程序。

順致敬意,