Monday, August 15, 2022
HomeiOS Developmentflutter - flutter_downloader would not present notification of downloading in iOS

flutter – flutter_downloader would not present notification of downloading in iOS

[ad_1]

I take advantage of flutter_downloader in app to permit downloading pdf recordsdata .
It’s working nicely in Android,however in IOS,the notification of beginning downloading the file would not seem though the file downloaded within the system.

I adopted all directions like described from Allow background mode,Add sqlite library,Configure AppDelegate

code:

                                       ultimate standing = await Permission.storage.request();
                                        if (standing.isGranted) {

                                          // Listing _path  = await getExternalStorageDirectory();
                                          //  String _localPath = _path.absolute.path + Platform.pathSeparator + 'ESPRS_Docs';

                                          var savedDir;
                                          if (Platform.isIOS) {
                                            savedDir = await getApplicationDocumentsDirectory();
                                          } else {
                                            savedDir = Listing('/storage/emulated/0/Obtain');
                                            // Put file in international obtain folder, if for an unknown motive it did not exist, we fallback
                                            // ignore: avoid_slow_async_io
                                            if (!await savedDir.exists()) savedDir = await getExternalStorageDirectory();
                                          }

                                          String random_no =randomAlphaNumeric(6) ;
                                          var split_name=p_title.replaceAll(" ","-");

                                           await FlutterDownloader.enqueue(
                                            url: p_link,
                                            savedDir: savedDir.path,
                                            fileName: "${split_name}-${random_no}.pdf",
                                            showNotification: true,
                                            saveInPublicStorage: true,
                                            openFileFromNotification: true,
                                            headers: {"auth": "Downloader"},

                                          );


                                        }else {
                                          print("Permission deined");
                                        };

[ad_2]

RELATED ARTICLES

Most Popular

Recent Comments