fluttercommunity / flutter_downloader

Flutter Downloader - A plugin for creating and managing download tasks.
https://pub.dev/packages/flutter_downloader
BSD 3-Clause "New" or "Revised" License
905 stars 508 forks source link

android api 34, sendCancelIfRunning: isInProgress=falsecallback=io.flutter.embedding.android.FlutterActivity #969

Open andrew2558 opened 1 month ago

andrew2558 commented 1 month ago

Android API 34 Describe the bug When I use flutter_downloader to download files in flutter, the following information is displayed in the android emulator

W/WindowOnBackDispatcher( 5234): sendCancelIfRunning: isInProgress=falsecallback=io.flutter.embedding.android.FlutterActivity$1@98a3d9

flutter code:

FlutterDownloader.cancelAll();

      final taskId = await FlutterDownloader.enqueue(
        url: url,
        savedDir: savedDir,
        fileName: fileName,
        showNotification: true,
        saveInPublicStorage: true,
        openFileFromNotification: false,
      );

      FlutterDownloader.registerCallback(_downloadCallback);

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="aaa">

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

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

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <!-- <uses-permission android:name="android.permission.READ_PHONE_STATE"/> -->

    <!-- <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> -->

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

    <application
        android:label="aaa"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
        android:enableOnBackInvokedCallback="true"
        android:requestLegacyExternalStorage="true">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <provider
            android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
            android:authorities="${applicationId}.flutter_downloader.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>

    </application>
</manifest>

There is no other information and the callback function is not called I have no idea where I'm going wrong, can anyone provide some help?

ncptuan commented 1 week ago

same issue :(

chaitanyak175 commented 1 week ago

I am also facing the same issue.

smin9 commented 1 day ago

I had the same problem