How to download an image to the mobile device and show it in the application

Follow steps below to download an image file to the mobile device and show the picture in the mobile application:

Step 1: Install the Appeon File Server. Detailed instructions can be found in Configuring and deploying Appeon File Server.

Step 2: Upload the image file to the Appeon File Server, and then download it from the Appeon File Server to the mobile device. Here are the specific steps:

  1. Add Appeon Workarounds PBL to your PowerBuilder application.

  2. Define a variable and create an instance for the AppeonFileService object.

  3. Call of_logonfileserver to connect to the file server.

  4. Call of_appeonupload to upload the image file to the file server.

  5. Call of_appeondownload to download the image file from the file server to the mobile device.

    The file is automatically saved to the %cachedir%/plugin/ directory. %cachedir% indicates the cache directory for the current mobile application. You can determine the cache directory by calling the AppeonGetCacheDir function.

  6. Call of_logofffileserver to disconnect from the file server.

Step 3: Access the image file through AppeonGetCacheDir()+"/plugin/"+%filename% in your mobile application.

Alternatively, if you only need to show the image file in the application and does not need to download the image to the mobile device, you can also take advantage of an Appeon enhanced feature to efficiently implement it. Appeon has enhanced the PictureName property of the Picture/PictureButton/PictureHyperLink control, the DataWindow column's content (when Display as Picture option is on), and the DataWindow Bitmap function to support the Internet URL. Therefore, you can post the image file to a Web site that is accessible by the mobile device, and utilize the aforementioned features to directly show the picture in the mobile application.