Software Archive
Read-only legacy content
17061 Discussions

Problem of showing image on other domain inside App Preview

kenneth_k_
Beginner
544 Views

Hi All,

I am new to IntelXDK and hybrid mobile app. I created a blank project using HTML5 + Cordova template. Inside Body, I added following lines

<body>

    <p>Hello, Cordova!</p>

    <img src="https://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/svgs/fi-shield.svg"/>
</body>

The image could be displayed correctly under "Emulate" environment. However, when I publish to testing server and use App Preview app inside android. The image could not be displayed. Is it because of security issue?

I am using LG G4 for the test. Anything I have overlooked? Do I need to do any whitelisting? 

Thanks for helping...

 

 

 

 

 

0 Kudos
3 Replies
PaulF_IntelCorp
Employee
544 Views

Not a good idea to build an app that depends on a network resource. If the network is slow or disabled your app will immediately hang. See this blog for some tips > http://blogs.intel.com/evangelists/2015/12/31/five-useful-tips-on-getting-started-building-cordova-mobile-apps-with-the-intel-xdk/

That said, you should be able to see the image in App Preview, but in a built app you'll have to configure the whitelisting properly. See https://software.intel.com/en-us/articles/cordova-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps

0 Kudos
kenneth_k_
Beginner
544 Views

Thanks for the information. I am just doing some tests and check the app preview could not access the pictures on the internet through my mobile. I am not sure why...

Actually in real case, if the hybrid app should not access internet resource directly as it will hang the app if network is slow or disabled. What can I do if I want to create a hybrid app that is similar to instagram or pinterest that could access photos from the others? 

0 Kudos
PaulF_IntelCorp
Employee
544 Views

The apps you describe need access to the Internet to deliver their full value. However, if there is no network connection, or the connection is very bad, they do not hang; they might say something like "unable to send" or defer the procedure until a later time when the network is available, etc. My point is that you need to plan for that sort of condition. Unlike a pure browser-based app, which can only start if there is a network connection, your mobile device app is different. It can be started by the user even if their device has no network connection, so your app needs to take that situation into consideration. The way you respond to it depends on your app, but at minimum, you need to insure that your app can get to the UI without depending on a network connection, so you can at least let the user know that you are unable to do anything without a network connection. Hope that makes sense.

0 Kudos
Reply