Method signature

Method downloads and saves a file to user’s device.

Supported on following platforms:

  • android;
  • iOS.
FAPI.invokeUIMethod("downloadFile", fileUrl, fileName);

Где:

  • fileUrl - file URL. Required parameter;
  • fileName - file name. Required parameter.

Example usage

/*
* Method downloads and saves a file to user's device
*/
FAPI.invokeUIMethod("downloadFile", "https://sun9-28.userapi.com/c846420/v846420985/1526c3/ISX7VF8NjZk.jpg", "test.jpg");

Callback example

When a method is called a dialog will be shown where user can either accept or decline file download. Depending on user’s action a callback will be sent

Callback if a user accepts file download

method: “downloadFile”

result: “ok”

data: “true”

Callback if a user declines file download

method: “downloadFile”

result: “error”

data: “false”