microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
277 stars 134 forks source link

DistributeListener not resuming when returning from release notes #1604

Closed zamgill closed 2 years ago

zamgill commented 2 years ago

Description

When using a DistributeListener the update dialog disappears when "View Release Notes" button is clicked and release notes url is opened. If Distribute.checkForUpdate() is called manually at this point when returning to the app, it does not work. Log messages show the following:

D/AppCenterDistribute: Resetting workflow on entering foreground.
D/AppCenterDistribute: Resume distribute workflow...
V/AppCenterDistribute: Already checking or checked latest release.
D/AppCenterDistribute: The receiver for installing a new release was registered.
D/AppCenterCustomModule: checkForUpdate clicked!
I/AppCenterDistribute: A check for update is already ongoing.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Setup a distribute listener with a custom dialog that has the setNeutralButton as follows:
    dialogBuilder.setNeutralButton(com.microsoft.appcenter.distribute.R.string.appcenter_distribute_update_dialog_view_release_notes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
      try {
          activity.startActivity(new Intent(Intent.ACTION_VIEW, releaseNotesUrl));
          Log.d("AppCenterCustom", "release notes clicked!");
      } catch (ActivityNotFoundException e) {
          AppCenterLog.error(AppCenterLog.LOG_TAG, "Failed to navigate to release notes.", e);
      }
    }
    });
  2. Then when an update dialog pops up in App, tap "View release notes" which opens the browser and then click back to return to the app.

Details

  1. Which SDK version are you using?
    • 4.4.2
  2. Which OS version did you experience the issue on?
    • Android 10
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • Google Pixel 3a emulator
  4. What third party libraries are you using? -Nothing in tandem with this.
  5. Please enable verbose logging for your app using AppCenter.setLogLevel(Log.VERBOSE) before your call to AppCenter.start(...) and include the logs here:
    2022-03-03 20:51:45.112 15179-15179/ca.example.app.debug I/AppCenter: App Center SDK configured successfully.
    2022-03-03 20:51:45.113 15179-15179/ca.example.app.debug D/AppCenter: Cannot read instrumentation variables in a non-test environment.
    2022-03-03 20:51:45.123 15179-15179/ca.example.app.debug D/AppCenterDistribute: The receiver for installing a new release was registered.
    2022-03-03 20:51:45.124 15179-15241/ca.example.app.debug D/AppCenter: Loaded stored sessions: {1646355391614=1646355391614//1646355391608, 1646355422782=1646355422782//1646355422765, 1646355648353=1646355648353//1646355648346, 1646356059674=1646356059674//1646356059666, 1646357672584=1646357672584//1646357672577, 1646357782329=1646357782329//1646357782320, 1646357809646=1646357809646//1646357809638, 1646358262064=1646358262064//1646358262058, 1646358373904=1646358373904//1646358373899, 1646358466751=1646358466751//1646358466748}
    2022-03-03 20:51:45.131 15179-15244/ca.example.app.debug D/AppCenter: Network 101 is available.
    2022-03-03 20:51:45.131 15179-15244/ca.example.app.debug D/AppCenter: Network has been connected.
    2022-03-03 20:51:45.134 15179-15179/ca.example.app.debug D/AppCenterDistribute: The receiver for installing a new release was registered.
    2022-03-03 20:51:45.138 15179-15241/ca.example.app.debug I/AppCenter: Changed maximum database size to 10485760 bytes.
    2022-03-03 20:51:45.138 15179-15241/ca.example.app.debug D/AppCenter: addGroup(group_core)
    2022-03-03 20:51:45.142 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
    2022-03-03 20:51:45.144 15179-15241/ca.example.app.debug D/AppCenter: App Center initialized.
    2022-03-03 20:51:45.145 15179-15241/ca.example.app.debug D/AppCenter: removeGroup(group_distribute)
    2022-03-03 20:51:45.145 15179-15241/ca.example.app.debug D/AppCenter: removeGroup(group_distribute/one)
    2022-03-03 20:51:45.145 15179-15241/ca.example.app.debug D/AppCenter: addGroup(group_distribute)
    2022-03-03 20:51:45.147 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_distribute) pendingLogCount=0 batchTimeInterval=3000
    2022-03-03 20:51:45.147 15179-15241/ca.example.app.debug D/AppCenter: addGroup(group_distribute/one)
    2022-03-03 20:51:45.153 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_distribute/one) pendingLogCount=0 batchTimeInterval=3000
    2022-03-03 20:51:45.155 15179-15241/ca.example.app.debug D/AppCenterDistribute: The receiver for installing a new release was registered.
    2022-03-03 20:51:45.155 15179-15241/ca.example.app.debug I/AppCenter: Distribute service started from application.
    2022-03-03 20:51:45.164 15179-15241/ca.example.app.debug D/AppCenter: Storing a log to the Persistence database for log type startService with flags=1
    2022-03-03 20:51:45.206 15179-15241/ca.example.app.debug D/AppCenter: Stored a log to the Persistence database for log type startService with databaseId=15
    2022-03-03 20:51:45.206 15179-15241/ca.example.app.debug D/AppCenter: enqueue(group_core) pendingLogCount=1
    2022-03-03 20:51:45.206 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_core) pendingLogCount=1 batchTimeInterval=3000
    2022-03-03 20:51:45.297 15179-15179/ca.example.app.debug D/AppCenterDistribute: Resume distribute workflow...
    2022-03-03 20:51:45.298 15179-15179/ca.example.app.debug D/AppCenterDistribute: InstallerPackageName=null
    2022-03-03 20:51:45.301 15179-15179/ca.example.app.debug D/AppCenterDistribute: Hide the install progress dialog.
    2022-03-03 20:51:45.301 15179-15179/ca.example.app.debug D/AppCenterDistribute: Get latest release details...
    2022-03-03 20:51:45.301 15179-15179/ca.example.app.debug D/AppCenterDistribute: Check if we need to report release installation..
    2022-03-03 20:51:45.301 15179-15179/ca.example.app.debug D/AppCenterDistribute: New release was downloaded but not installed yet, skip reporting.
    2022-03-03 20:51:45.308 15179-15229/ca.example.app.debug V/AppCenterDistribute: Calling https://api.appcenter.ms/v0.1/public/sdk/apps/****************************5eaee77e/releases/latest?release_hash=4e5cbec8d98eda950d30d465a9...
    2022-03-03 20:51:45.308 15179-15229/ca.example.app.debug V/AppCenterDistribute: Headers: {}
    2022-03-03 20:51:45.671 15179-15229/ca.example.app.debug V/AppCenter: HTTP response status=200 payload={"app_name":"App-Dev-1","app_display_name":"App - Dev","app_os":"Android","app_icon_url":"https://appcenter-filemanagement-distrib3ede6f06e.azureedge.net/3a63757f-92fa-45bf-8625-1cadwadadwa6/ic_launcher.png?sv=2019-02-02&sr=c&sig=Odz94v8iJa%2Fc211dawdwadwa1UnIIiHKrbun937JAsTg%2B48%3D&se=2022-03-10T22%3A46%3A40Z&sp=r","release_notes_url":"https://install.appcenter.ms/orgs/CompanyA/apps/App-Dev-1/distribution_groups/App%20-%20Dev%20Testers","owner":{"name":"CompanyA","display_name":"Company A"},"is_external_build":false,"origin":"appcenter","id":2,"version":"5","short_version":"1.8.0","size":59264969,"min_os":"5.0","android_min_api_level":"21","device_family":null,"bundle_identifier":"ca.example.app.debug","fingerprint":"c4e7d3e25d4307f920a3b1510d4cdf49","uploaded_at":"2022-03-03T22:46:39.881Z","download_url":"https://appcenter-filemanagement-distrib2ede6f06e.azureedge.net/0bceeef0-f46d-4af5-9bed-038b158671d2/app-debug.apk?sv=2019-02-02&sr=c&sig=VODuR0qR5PzpDDPIMpYjAkcWLnh2T%2FIXJAwNCJyXiP8%3D&se=2022-03-04T23%3A08%3A18Z&sp=r","install_url":"https://appcenter-filemanagement-distrib2ede6f06e.azureedge.net/0bceeef0-f46d-4af5-9bed-03cadsawd/app-debug.apk?sv=2019-02-02&sr=c&sig=VODuR0qR5PzpDDPIMpYjAkcWLnh2T%2FIXJAwNCJyXiP8%3D&se=2022-03-04T23%3A08%3A18Z&sp=r","mandatory_update":false,"enabled":true,"fileExtension":"apk","is_latest":true,"release_notes":"- To test new update handling","can_resign":null,"package_hashes":["dc231991c8b515ff2220cce749a0a57dff1e5e6125bbfeb7e1fbaca8cc1c40d1"],"destination_type":"group","status":"available","distribution_group_id":"4bd53e7b-ce0b-4a29-a9d1-9adwawd","distribution_groups":[{"id":"4bd53e7b-ce0b-4a29-a9d1-96bcadawdawd","name":"App - Dev Testers","origin":"appcenter","display_name":"App - Dev Testers","is_public":true}]}
    2022-03-03 20:51:45.680 15179-15179/ca.example.app.debug D/AppCenterDistribute: Stored release hash doesn't match current installation, probably downloaded but not installed yet, keep in store
    2022-03-03 20:51:45.680 15179-15179/ca.example.app.debug D/AppCenterDistribute: Check if latest release is more recent.
    2022-03-03 20:51:45.680 15179-15179/ca.example.app.debug D/AppCenterDistribute: Latest release more recent=true
    2022-03-03 20:51:45.681 15179-15179/ca.example.app.debug D/AppCenterDistribute: Latest release is more recent.
    2022-03-03 20:51:45.681 15179-15179/ca.example.app.debug D/AppCenterDistribute: Calling listener.onReleaseAvailable.
    2022-03-03 20:51:48.210 15179-15241/ca.example.app.debug D/AppCenter: triggerIngestion(group_core) pendingLogCount=1
    2022-03-03 20:51:48.210 15179-15241/ca.example.app.debug D/AppCenter: Trying to get 1 logs from the Persistence database for group_core
    2022-03-03 20:51:48.214 15179-15241/ca.example.app.debug D/AppCenter: Returning 1 log(s) with an ID, 70527ea5-8888-4751-b70e-fd42a479528a
    2022-03-03 20:51:48.214 15179-15241/ca.example.app.debug D/AppCenter: The SID/ID pairs for returning log(s) is/are:
    2022-03-03 20:51:48.214 15179-15241/ca.example.app.debug D/AppCenter:   null / 15
    2022-03-03 20:51:48.214 15179-15241/ca.example.app.debug D/AppCenter: ingestLogs(group_core,70527ea5-8888-4751-b70e-fd42a479528a) pendingLogCount=0
    2022-03-03 20:51:48.215 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
    2022-03-03 20:51:48.217 15179-15227/ca.example.app.debug V/AppCenter: Calling https://in.appcenter.ms/logs?api-version=1.0.0...
    2022-03-03 20:51:48.217 15179-15227/ca.example.app.debug V/AppCenter: Headers: {Install-ID=01da377c-bfa0-4c6a-9d41-32caf4cde19e, App-Secret=****************************5eaee77e, Content-Type=application/json}
    2022-03-03 20:51:48.218 15179-15227/ca.example.app.debug V/AppCenter: {
      "logs": [
        {
          "type": "startService",
          "timestamp": "2022-03-04T01:51:45.163Z",
          "distributionGroupId": "4bd53e7b-ce0b-4a29-a9d1-96cad1dad214",
          "device": {
            "sdkName": "appcenter.android",
            "sdkVersion": "4.4.2",
            "model": "Android SDK built for x86",
            "oemName": "Google",
            "osName": "Android",
            "osVersion": "10",
            "osBuild": "QSR1.190920.001",
            "osApiLevel": 29,
            "locale": "en_US",
            "timeZoneOffset": -300,
            "screenSize": "1080x2088",
            "appVersion": "1.7.0",
            "carrierName": "Android",
            "carrierCountry": "us",
            "appBuild": "4",
            "appNamespace": "ca.example.app.debug"
          },
          "services": [
            "Distribute"
          ],
          "isOneCollectorEnabled": false
        }
      ]
    }
    2022-03-03 20:51:48.409 15179-15227/ca.example.app.debug V/AppCenter: HTTP response status=200 payload={"status":"Success","validDiagnosticsIds":[],"throttledDiagnosticsIds":[],"correlationId":"76d8a6b0-737c-4a6e-9e23-77cfe243ae93"}
    2022-03-03 20:51:48.422 15179-15241/ca.example.app.debug D/AppCenter: Deleting logs from the Persistence database for group_core with 70527ea5-8888-4751-b70e-fd42a479528a
    2022-03-03 20:51:48.422 15179-15241/ca.example.app.debug D/AppCenter: The IDs for deleting log(s) is/are:
    2022-03-03 20:51:48.422 15179-15241/ca.example.app.debug D/AppCenter:   15
    2022-03-03 20:51:48.434 15179-15241/ca.example.app.debug D/AppCenter: checkPendingLogs(group_core) pendingLogCount=0 batchTimeInterval=3000
    2022-03-03 20:51:57.462 15179-15179/ca.example.app.debug D/AppCenterCustom: release notes clicked!
    2022-03-03 20:52:03.454 15179-15179/ca.example.app.debug D/AppCenterDistribute: Resetting workflow on entering foreground.
    2022-03-03 20:52:03.456 15179-15179/ca.example.app.debug D/AppCenterDistribute: Resume distribute workflow...
    2022-03-03 20:52:03.456 15179-15179/ca.example.app.debug V/AppCenterDistribute: Already checking or checked latest release.
    2022-03-03 20:52:03.456 15179-15179/ca.example.app.debug D/AppCenterDistribute: The receiver for installing a new release was registered.
    2022-03-03 20:52:27.301 15179-15263/ca.example.app.debug D/AppCenterCustomModule: checkForUpdate clicked!
    2022-03-03 20:52:27.301 15179-15241/ca.example.app.debug I/AppCenterDistribute: A check for update is already ongoing.
AnastasiaKubova commented 2 years ago

Hi! Thanks for getting in touch with us! I will label this issue as a bug.

DmitriyKirakosyan commented 2 years ago

Hey @zamgill , we released a new version with this fix included.

zamgill commented 2 years ago

Thanks a lot!