8 Replies Latest reply on Jun 13, 2014 4:17 AM by Marcel Bierens

    System.openUrl does not work (RMS 4.1)

    Gerbrand Stap

      Opening an image using System.openUrl does no longer seem to work on Android since RhoMobile Suite version 4.1.1

      An image can be opened in the attached test app by clicking on 'Images' and 'Test'. This works fine in the simulator and worked on Android in RMS 4.0. But when I run this using RMS 4.1, I get the attached log and all available image viewers give an error.


      Any thoughts on how this is possible?

        • Re: System.openUrl does not work (RMS 4.1)
          Kutir Mobility

          Hi Gerbrand,

          I can reproduce it . It's look like issue on Rho 4.1. This issue needs help from Motorola. We will raise this issue with them to get an answer.


          Visnupriya R

          Kutir Mobility

          1 of 1 people found this helpful
          • Re: System.openUrl does not work (RMS 4.1)

            Hi Gerbrand,

            Try to add next param to application's build.yml


               no_compression: [png, html, js, css, dat, ttf, txt]

            By default it contains next list: [html, htm, js, css]

            The main element in the list is png for your case and you need to add other file extensions (except jpg!) which can be requested by browser using file protocol or can be accessed by third party application using System.openUrl(url)

              • Re: System.openUrl does not work (RMS 4.1)
                Gerbrand Stap

                Unfortunately this didn't help.

                We encountered this problem in our application when opening photos taken by the user, which are jpeg files (which do not need to be added to the no_compression list). So this does not seem to be the cause of the problems.


                I've also tried to use Intents, because the no_compression setting was also mentioned there. I used the following code:

                intent_params = {

                  :action     => "android.intent.action.VIEW",

                  :intentType => Rho::Intent::START_ACTIVITY,

                  :uri        => "content://com.rhomobile.openimagetest/rhodata/apps/android_icon.png"


                Rho::Intent.send intent_params


                But this caused the same error message in the viewers.

                  • Re: System.openUrl does not work (RMS 4.1)

                    Hi Gerbrand,


                    Would you please try to run it with rhodes master (from github)?


                    From my experience it depends on application used to open the file... Some apps tries to load the content title using Rhodes content provider additionally to requesting the file content. Rhodes content provider does not support this operation and fires UnsupportedOperationException... Opening application should be care of this else it crashes.


                    In master the behavior is changed slightly - it returns null instead of firing an exception. But this does not guarantied stable client behavior


                    PS: In logs you sent initially there is strange file path: /data/data/com.rhomobile.openimagetest/rhodata/apps/android_icon.png


                    Are you sure it is right? Usually user files resides in rhodata/apps/public, rhodata/apps/app and its subfolders. I'm even not sure how to pack an asset directly to rhodata/apps folder...

                      • Re: System.openUrl does not work (RMS 4.1)
                        Gerbrand Stap

                        I tried to use the github version, but I can not get it running, something with the android ndk:

                        Can't detect NDK toolchain path (corrupted NDK installation?)

                        I use the latest version, r9d.


                        The path is created using the Rhodes API:

                            path = Rho::RhoFile.join( Rho::Application.userFolder, 'android_icon.png' );

                            File.open( path, 'wb' ) { |f| f.write( Base64.decode64( data ) ) }

                            System.openUrl( path )


                        The file is written to that path, which succeeds, to I assume it is there. And in the previous version (RMS 4.0) it could be opened in exactly the same way, so what is changed?

                        We also use this on other platforms (iOS, WM, Win32) and it works there too.


                        UPDATE: I tested the code in RMS 4.0, and the path used there (i.e. /data/data/com.rhomobile.openimagetest/rhodata/apps/) is the same as on RMS 4.1.1. So the path does not seem to be the problem.


                        UPDATE 2: I tried saving the file to /sdcard and opening it from there. Writing the file succeeds, but System.openUrl causes a message saying that there is no application to open the file. But I am able to open the file from /sdcard manually using a file explorer. This is the same behaviour as mentioned in "Re: Opening files from sdcard". The suggested solution there is the one from "How to show an Image from SDCard for different Platforms ?" where a file is copied to Rho::Application.userFolder. This is what we do, but this does not work anymore.