9 Replies Latest reply on May 11, 2016 9:43 AM by baublysb

    Why does the file is not saved?

    baublysb

      Here the code: FileSave2

      If you open the code locally via WebView at Android'e, the files are not downloaded.

      Why?

      If I open the html with this js on the same tablet at the Opera, the Save dialog box appears and the files are stored properly, but if you open the apk-app builded by Fonegap, nothing happens. Links are changing their views of the visited, but the Save As dialog box not appears.

      Maybe you have an ideas why this is happening?

      What to send to console.log()? I can already see csvData, what else can I check?

        • 1. Re: Why does the file is not saved?
          kerrishotts Adobe Community Professional

          I wouldn't expect that to work in a mobile environment.

           

          I'd suggest using the File Plugin (https://www.npmjs.com/package/cordova-plugin-file) to store files.

          • 2. Re: Why does the file is not saved?
            baublysb Level 1

            Thank you, kerrishotts for your participation!

            kerrishotts написал(а):

             

            I wouldn't expect that to work in a mobile environment.

             

            I'd suggest using the File Plugin (https://www.npmjs.com/package/cordova-plugin-file) to store files.

             

            The Internet spread the opinion that Phonegap simply displays the html+js+css through WebViw in Android and IOS.

            That's what he attracts inexperienced, but it turns out that's not true.

            If the desktop bunch of js code with html layout work, should work through WebView.

            If this is not so, like advertising moves will honestly be changed to something more real.

             

            As regards the application in each case challenging multi-megabyte crutches in the form of plug-ins and libraries,  this increases the weight of the code and hinders the development.

            I am sure that in my particular case, there is a simpler solution.

            • 3. Re: Why does the file is not saved?
              baublysb Level 1

              Maybe where I look, this feature does not work?

              http://caniuse.com/#feat=download

              How do I find out which browser is used by the application?

              Tablet Built-in browser does not show its name - "Browser" and all the more so :-) Version no. Android 4.2.1.

              And strangely, the default advanced settings set to "Set browser type" = iPad, and encoding = "Latin-1 (ISO-8859-1)", rather than "Unicod (UTF-8)"

              Can I bring in the console version of the browser, which uses an application made in PhoneGap? Any ideas?

              • 4. Re: Why does the file is not saved?
                kerrishotts Adobe Community Professional

                As regards the application in each case challenging multi-megabyte crutches in the form of plug-ins and libraries,  this increases the weight of the code and hinders the development.

                 

                The File plugin I mentioned is quite small. Last I looked, it came in around 2MB, but the majority of that is documentation and tests. The remaining code happens to be for platforms your app will probably never use, and so the actual File plugin code that makes it into your app is very, very small.

                 

                The fact is, most plugins are this way. Only a few outliers require a large amount of space to work.

                 

                I am sure that in my particular case, there is a simpler solution.

                 

                The easiest way to save a file to persistent storage is the File plugin. I'll fully admit that the File API itself is a bit painful, but that's not PhoneGap's fault -- the plugin seeks to implement the (now defunct) W3C standard.

                1 person found this helpful
                • 5. Re: Why does the file is not saved?
                  kerrishotts Adobe Community Professional

                  How do I find out which browser is used by the application?

                   

                  The rendering engine being used is the system web view. This is different by platform. iOS will use UIWebView by default, and Android will use the basic web view that an AOSP browser would use. With plugins, iOS can use WKWebView (far better), and Android can use a Chromium-backed web view that grants a modern browser environment across all supported targets. On recent Androids (4.4+), Google can update the system web view, which can break your app, which is another reason I suggest using Crosswalk.

                   

                  In the "caniuse" link above, you'd look at the "iOS Safari" and "Android Browser" columns. Keep in mind, however, that PhoneGap is not a browser, and there are many features that are provided at the browser level and not at the web view level. Therefore things that a browser might provide may not be available to PhoneGap.

                   

                  In your particular case of saving a file, this is actually a good thing: you should want your app's user interface to appear (if needed) rather than some interface which you can't control. The idea is to create an app that feels like it integrates well with the system, not an app that feels like it's running in a web browser.

                  • 6. Re: Why does the file is not saved?
                    baublysb Level 1

                    kerrishotts написал(а):

                     

                    In your particular case of saving a file, this is actually a good thing: you should want your app's user interface to appear (if needed) rather than some interface which you can't control. The idea is to create an app that feels like it integrates well with the system, not an app that feels like it's running in a web browser.

                    Thank you, kerrishotts, for your help!

                    That's fine, but I would like specifics :-) Something like

                    navigator.userAgent
                    

                    The fact that as a result of build.fonegap I do not see the Java Code, it is very difficult to debug.

                    Or it can download it, I just do not know where?

                    If it is possible, everything would be greatly simplified. I have downloaded the project to Android Studio and worked with him already.

                    Can I get the project code in build.fonegap, not just the apk?

                    • 7. Re: Why does the file is not saved?
                      baublysb Level 1

                      And yet, kerrishotts!

                      apk file - this is the usual zip-archive, is not it? I gutted it and was very surprised that it looks like a manifest file.

                      What is it with him?

                      Maybe that's the point?

                       

                      apk

                      • 8. Re: Why does the file is not saved?
                        kerrishotts Adobe Community Professional

                        If you want to debug the native code, you should use the PhoneGap/Cordova CLI and build your apps locally. PhoneGap Build does not allow you to debug native code.

                         

                        I'm not sure what you want from "navigator.userAgent"? Are you trying to build code that detects the user's device? If so, use the "device" plugin. If it isn't present, you can assume you're on a browser. If it is present, you can query the device platform, OS version, and lots more. You can sniff the user agent, but there's always the risk of sniffing it incorrectly.

                         

                        Yes, APKs are zip files. They contain the compiled code for your app along with your www code and associated assets. I'm not quite sure I follow what your question is here.

                        1 person found this helpful
                        • 9. Re: Why does the file is not saved?
                          baublysb Level 1

                          Thanks for the help, kerrishotts

                          All the best!