javiersantos / AppUpdater

A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 9+ required.
Apache License 2.0
1.99k stars 413 forks source link

The JSON updater file is mal-formatted. AppUpdate can't check for updates #118

Closed SankarGaneshKumar closed 6 years ago

SankarGaneshKumar commented 6 years ago
Details
Builder
AppUpdaterUtils appUpdaterUtils = new AppUpdaterUtils(getContext())
                .setUpdateFrom(UpdateFrom.JSON)
                .setUpdateJSON("https://somesite.com/MyApp/update-changelog.json")
                .withListener(new AppUpdaterUtils.UpdateListener() {
                    @Override
                    public void onSuccess(Update update, Boolean isUpdateAvailable) {
                    Intent updateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(update.getUrlToDownload().toString()));
                        updateIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        getContext().startActivity(updateIntent);
                    }

                    @Override
                    public void onFailed(AppUpdaterError error) {
                        Log.d("AppUpdater Error", "Something went wrong");
                    }
                });
        appUpdaterUtils.start();

JSON I used

{
  "latestVersion": "1.0.1",
  "latestVersionCode": "2",
  "url": "https://somesite.com/app-debug.apk",
  "releaseNotes": [
    "- First evolution",
    "- Second evolution",
    "- Bug fixes"
  ]
}
Expected Result

Invoking Update Intent

Actual Result

The JSON updater file is mal-formatted. AppUpdate can't check for updates

deepakkaku commented 6 years ago

Even I am getting the same result. Any updates from anyone?

javiersantos commented 6 years ago

I'm looking into it.

deepakkaku commented 6 years ago

this format worked for me. I don't see any difference to be honest

{ "latestVersion": "1.2", "latestVersionCode": "2", "url": "http://www.google.com", "releaseNotes": ["v1.2","- New Scanner Scenario", "- Bug Fixes"] }

javiersantos commented 6 years ago

I'm not able to reproduce the issue. I have tested using Android 5.1 & 8.1 and uploading your JSON to Pastebin.

Does uploading the JSON to another server solve the problem?

deepakkaku commented 6 years ago

what happens when I set showEvery(5) and How long does it wait to show the dialog again?

javiersantos commented 6 years ago

When .showEvery(5) is set, the dialog (snackbar or notification) will be displayed the first time that a new update has been found. Then it will only be displayed every 5 times that the builder has been called.