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

OnClick Listeners Issue #121

Closed mikemike396 closed 6 years ago

mikemike396 commented 6 years ago
Details

I am trying to use the OnClick listeners to log a few events in our analytics system. The issue is when I set the onClick listeners the library doesnt fire the library code. What I mean is if I click update it does nothing. Once I remove the onClickListeners it works fine. Am I missing something?

        final AppUpdater appUpdater = new AppUpdater(this)
                .setButtonDismissClickListener(new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        UpdateAppDialogEventLog updateAppDialogEventLog = new UpdateAppDialogEventLog();
                        updateAppDialogEventLog.didCancelUpdate = 1;
                        EventLoggingManager.logEventUpdateAppDidShowDialogWithSelection(updateAppDialogEventLog);
                    }
                })
                .setButtonDoNotShowAgainClickListener(new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        UpdateAppDialogEventLog updateAppDialogEventLog = new UpdateAppDialogEventLog();
                        updateAppDialogEventLog.didSkipAppVersion = 1;
                        EventLoggingManager.logEventUpdateAppDidShowDialogWithSelection(updateAppDialogEventLog);
                    }
                })
                .setButtonUpdateClickListener(new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        UpdateAppDialogEventLog updateAppDialogEventLog = new UpdateAppDialogEventLog();
                        updateAppDialogEventLog.didOpenAppStore = 1;
                        EventLoggingManager.logEventUpdateAppDidShowDialogWithSelection(updateAppDialogEventLog);
                    }
                })
                .setUpdateFrom(UpdateFrom.GOOGLE_PLAY);
        appUpdater.start();
javiersantos commented 6 years ago

The custom callbacks seems to be working properly. Keep in mind that when you use custom callbacks you will have to implements the actions manually (it will not launch the Intents automatically, for example).