[Offline Apps] OS Now TakePicture

[Offline Apps] OS Now TakePicture

  
Forge Component
(25)
Published on 2015-11-19 by OutSystems Labs
25 votes
Published on 2015-11-19 by OutSystems Labs

Hi,

I was using OS Now TakePicture. It works fine but when the page was included in the cache manifest, the button won't work anymore. How can I make it work in an offline page?

Thanks.
Hi!

The TakePicture plugin from OS Now should work offline. When you say the button doesn't work, do you mean it doesn't open the phone's camera, or it doesn't do anything after taking a picture?

The Inspections App has an implementation of the camera when offline, so you may check what was done there and compare it to your implementation.
João Pedro Abreu wrote:
Hi!

The TakePicture plugin from OS Now should work offline. When you say the button doesn't work, do you mean it doesn't open the phone's camera, or it doesn't do anything after taking a picture?

The Inspections App has an implementation of the camera when offline, so you may check what was done there and compare it to your implementation.
 
 Hi, Thank you for the quick response. Yes it doesn't open the phone's camera.
 I looked at the inspections App, and the difference is; I don't have the <javascript to capture photos> part.  Do I need that part? because I don't see any part where it used the Camera Button?
Solution
The <javascript to capture photos> is just business logic for the application. it isn't needed for the camera.

Do you have the latest version of OutSystems Now installed on your server? Old versions didn't support offline.

Also, do you have any logic to display the button only when inside OS Now? If you do, you'll have to remove it, because it doesn't work with offline.
Solution
Hey there, Dus,

Here's where I suspect there might be a problem: when you first access the app using OutSystems Now (the mobile app), you download all the resources present in the cache manifest to the App Cache. At this point, the server must render the pages as if they were accessed by a OutSystems Now app (meaning that any plugin functionality should be present in the page's code).

If by chance this request follows without the proper OutSystemsNowApp User-Agent (that's what we're using to identify that it's a request from a OutSystems Now mobile app), then the screen would have the functionality disabled always.

To clear-up if this is the case, try placing a IsUsingOutSystemsNow() call in the screen's preparation, set a breakpoint next to it and open the app for the first time after installing it on the phone (this will trigger the mentioned App Cache resource fetch).  If the return value is false, then this is the case.

I believe this was already fixed in a previous version of the OutSystems Now server application. Have you upgraded? If you have, you may also be able to work-around by removing the "IsUsingOutsystemsNow" UI If from the "TakePicture" web block.

Thanks, It works now.
I updated my OS Now and build the manifest using a mobile device and not the web url.