Hello all I followed the guide
https://learn.microsoft.com/en-us/appcenter/sdk/distribute/android
AppCenter.start(getApplication(), "real app secret ", Distribute.class);
Log.e("Distribute","start worked for Dist without listener");
I am doing this in an onCreate of a library that does the login for my application and i see the log being printed yet no dialog pops up
Any ideas what could be the problem ?
Have you implemented a custom listener? It should extend from the below interface. I have provided an example of what I have that works for me!
Distribute.setListener(new AppCenterUpdateListener());
Distribute.setEnabled(true);
AppCenter.start(getApplication(),"secret", Distribute.class);
class AppCenterUpdateListener : DistributeListener {
override fun onReleaseAvailable(activity: Activity, releaseDetails: ReleaseDetails): Boolean {
// Look at releaseDetails public methods to get version information, release notes text or release notes URL
val versionName = releaseDetails.shortVersion
val versionCode = releaseDetails.version
val releaseNotes = releaseDetails.releaseNotes
val releaseNotesUrl = releaseDetails.releaseNotesUrl
// Build our own dialog title and message
val dialogBuilder = AlertDialog.Builder(activity, R.style.alertDialogNoBar)
dialogBuilder.setTitle("Version $versionName available!")
dialogBuilder.setMessage(releaseNotes)
// Mimic default SDK buttons
dialogBuilder.setPositiveButton(com.microsoft.appcenter.distribute.R.string.appcenter_distribute_update_dialog_download) { _,_ ->
Distribute.notifyUpdateAction(UpdateAction.UPDATE)
}
// We can postpone the release only if the update is not mandatory
if (!releaseDetails.isMandatoryUpdate) {
dialogBuilder.setNegativeButton(com.microsoft.appcenter.distribute.R.string.appcenter_distribute_update_dialog_postpone) { _,_ ->
Distribute.notifyUpdateAction(UpdateAction.POSTPONE)
}
}
dialogBuilder.setCancelable(false)
dialogBuilder.create().show()
// Return true if you are using your own dialog, false otherwise
return true
}
}