1

I have below code from another forum and I'm using WVersionManager from github.

  1. Add update with a button click

I have assigned to a button click, ie., if user clicks button it will check for new update.

public class about extends ActionBarActivity {

Button updateButton;

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

    updateButton = (Button)findViewById(R.id.button_Update);

    updateButton.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
    WVersionManager versionManager = new WVersionManager(this);
    versionManager.setVersionContentUrl("http://link_to_version_test_file/version.txt");
    versionManager.setUpdateUrl("http://link_to_updated_apk_file/latest.apk");
    versionManager.checkVersion();
        }
    });
}

2 . Contents of version.txt file

The version.txt contains these codes :

{"version_code":6,"content":"Version 1.5 <p>Added feature 1</p><li>Added feature 2</li><li>Added feature 3</li><li>Added feature 4</li><li>Added feature 5</li>"}

version_code and content:version is your application's version code and version name respectively as mentioned in manifest file.

to add more features, just add

  • Added feature title
  • 3 . Giving Internet permission to your app

    and in mu application's manifest file.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    

    Well This is all I have done by Far now, Now I want to If I could add code so that when Button pressed would Return Updating an app notification if new updates are available if not Return your app is up to date.

    Any Help would be appreciated.

    Phantômaxx
    • 37,901
    • 21
    • 84
    • 115
    • That project is deprecated... – litelite Jul 26 '17 at 19:12
    • so Does that mean will it work for me or not ? Is there any new project to help me with update functionality? – Sagar Rawal Jul 26 '17 at 19:24
    • It seem to be deprecated for only a few month, so it probably still works. But if anything breaks, it will be broken forever. I would advise you to find another tool to do the job or to be prepared to maintain it yourself. I don't know any tool like that(but i did no research so it might exists) and the author did not mention any replacement. – litelite Jul 26 '17 at 19:28
    • And anyway, you should not update the app youself, since thats a sure way to get blocked by Google. And if you just need to check if an update is available then you can probably [do it yourself](https://stackoverflow.com/a/25201516/3072566) – litelite Jul 26 '17 at 19:31

    0 Answers0