Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading not Starting on OPPO with android 11 #963

Open
SherazAsghar37 opened this issue Jun 25, 2024 · 1 comment
Open

Downloading not Starting on OPPO with android 11 #963

SherazAsghar37 opened this issue Jun 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SherazAsghar37
Copy link

I've been debugging it for a day but the issue persists, when I start downloading it prints "set process for client: com.example.igb" and nothing happens.
I've tested it on several Android 11 phones such as One Plus and it worked fine, but on Oppo, it didn't.

My AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.igb"

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
    android:label="igb"
    android:name="${applicationName}"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:exported="true" 
        android:launchMode="singleTop"
        android:taskAffinity=""
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize"
        android:requestLegacyExternalStorage="true">
        <!-- 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>
        <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>
        <!-- Begin FlutterDownloader customization -->
        <!-- disable default Initializer -->
        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>

        <!-- declare customized Initializer -->
        <provider
            android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
            android:authorities="${applicationId}.flutter-downloader-init"
            android:exported="false">
            <!-- changes this number to configure the maximum number of concurrent tasks -->
            <meta-data
                android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
                android:value="3" />
        </provider>
        <!-- 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" />
</application>
<!-- Required to query activities that can process text, see:
     https://developer.android.com/training/package-visibility and
     https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

     In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
    <intent>
        <action android:name="android.intent.action.PROCESS_TEXT"/>
        <data android:mimeType="text/plain"/>
    </intent>
</queries>

My code:

@OverRide
void initState() {
super.initState();
FeedbackController feedbackController =
Provider.of(context, listen: false);
IsolateNameServer.registerPortWithName(
port.sendPort, "downloader_send_port");
port.listen((dynamic data) {
printError("here");
String id = data[0];

  DownloadTaskStatus status = DownloadTaskStatus.values[data[1]];
  double progress = data[2] / 100;
  printWarning(
      "Received download update - id: $id, status: $status, progress: $progress%");
  feedbackController.updateStatus(id, status, progress);
  setState(() {});
});
FlutterDownloader.registerCallback(downloadCallback);

}

@OverRide
void dispose() {
IsolateNameServer.removePortNameMapping("downloader_send_port");
super.dispose();
}

@pragma('vm:entry-point')
static void downloadCallback(String id, int status, int progress) {
// printWarning("Download callback - progress: $progress");
IsolateNameServer.lookupPortByName('downloader_send_port')
?.send([id, status, progress]);
}

@SherazAsghar37 SherazAsghar37 added the bug Something isn't working label Jun 25, 2024
@shrutgyan
Copy link

shrutgyan commented Jul 13, 2024

Facing same issue on Android 10 also. Did you find any solution to this problem??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants