SDK contains 4 method groups:
- FAPI.init - SDK initialization. Must be called before calling any method (both when launching applications for the first time and when doing internal transitions across the frame).
- FAPI.Util.getRequestParameters - getting parameters when addressing the application
- FAPI.UI.getPageInfo - information about the page (height, width, scrolling position, position of the application iframe)
- FAPI.UI.postMediatopic - posting media topic with the user’s confirmation
- FAPI.UI.scrollTo - scrolls the page to a specific position
- FAPI.UI.scrollToTop - scrolls the page to the top
- FAPI.UI.setWindowSize - changing the size of application container
- FAPI.UI.showInvite - dialog for inviting friends to the application
- FAPI.UI.showNotification - dialog for sending notifications (unlike invitations, notifications can be sent to friends that are already using the application)
- FAPI.UI.showPayment - dialog for buying game currency or game items
- FAPI.UI.showPaymentPromo - window informing about a current payment system promotion
- FAPI.UI.showPermissions - dialog for requesting permissions (e.g. to change the user status)
- FAPI.UI.showPortalPayment - dialog for buying OKs (Odnoklassniki’s internal currency)
- FAPI.invokeUIMethod(“prepareMidroll”) - prepare a video ad to show during game session
- FAPI.invokeUIMethod(“showMidroll”) - shows a video ad previously prepared during game session
- FAPI.invokeUIMethod(“showPaymentSubscription”) - dialog for purchasing a game’s subscription.
Connecting a library:
When using js + flash in a flash application, the “wmode=opaque” parameter must be set.
After every transition inside an iframe it is necessary to perform an initialization again with the FAPI.init method, as well as pass the following parameters:
Methods from the FAPI.UI group don’t require the callback function to be passed. After the method is executed, a global function will be called, and the developer must realize it. The function must have the signature:
- method - the name of the method called
- result - the result of the execution (“ok” if successful, “cancel” if the user canceled the action)
- data - additional information, for example, for showInvite() – a list of IDs of invited friends, separated by commas, in the string format.