native

bim. Namespace

native

Description:
  • Collection of functions which control the App natively.

Source:
Properties:
Name Type Description
device Object

Object which stores the OS of the current device. See bim.native.device for more details.

backButton Object

Native backbutton API. See bim.native.backButton for more details.

keyboard Object

Native keyboard setting API. See bim.native.keyboard for more details.

removeHistory function

Function to remove history of visited plugins. See bim.native.removeHistory for more details.

internalBrowser function

Function to open URL with internal browser. See bim.native.internalBrowser for more details.

shareUrl function

Function to share url through native feature. See bim.native.shareUrl for more details.

loadService function

Function to load service. See bim.native.loadService for more details.

exec function

Function to call native functions. See bim.native.exec for more details.

cameraChooser function

Function to make file-input to save file data internally. See bim.native.cameraChooser for more details.

plugin function

Function to run native functions. See bim.native.plugin for more details.

load function

Function to run native functions. See bim.native.load for more details.

call function

Function to call native functions. See bim.native.call for more details.

handleCallback function

Callback function saved by bim.native.call. See bim.native.handleCallback for more details.

handleCallbacks Object

Object saving callback functions seperated by name. See bim.native.handleCallbacks for more details.

callback function

Function to read media file and save into local database. See bim.native.callback for more details.

fileSystem Object

Object to manage local files in the device. See bim.native.fileSystem for more details.

Members

(static) device

Description:
  • Object which stores separately whether OS of the current device matches each iOS or Android.

Source:
Properties:
Name Type Description
ios boolean

Whether current device is ios or not

android boolean

Whether current device is android or not

Object which stores separately whether OS of the current device matches each iOS or Android.

(static) backButton

Description:
  • Native backbutton API. Currently, only works for Android.

Source:
Properties:
Name Type Description
set function

Function to set how native backbutton works.

Native backbutton API. Currently, only works for Android.

Examples
bim.native.backButton.set({
 backplugin: ${1:backplugin},
 backpage: ${2:backpage},
 backButton: ${3:backButton}
});
bim.native.backButton.set({
 backplugin: MAIN_PLUGIN,
 backpage: true,
 backButton: "enabled"
});
bim.native.backButton.set({
 backpage: false
});

(static) keyboard

Description:
  • Native keyboard setting API. Currently, only works for Android OS now.

Source:
Properties:
Name Type Description
set function

Function to set callback function, which runs when native keyboard is opened or closed. Currently only works for Android OS now.

onOpen function

Callback function which runs when keyboard is opened. Must be set through function bim.native.keyboard.set.

onClose function

Callback function which runs when keyboard is closed. Must be set through function bim.native.keyboard.set.

Native keyboard setting API. Currently, only works for Android OS now.

Example
bim.native.keyboard.set({
 onOpen: function () {
   // Do Something ...
 },
 onClose: function () {
   // Do Something ...
 }
});

(static) handleCallbacks :Object

Description:
  • Object saving callback functions seperated by name. Values are set by bim.native.call.

Source:

Object saving callback functions seperated by name. Values are set by bim.native.call.

Type:
  • Object

(static) fileSystem :Object

Description:
  • Object to manage local files in the device.

Source:
Properties:
Name Type Description
read function

Function to read.

readByPath function

Function to read file from device by file path.

get function

Function to get recently read file data.

reset function

Function to remove reserved read file data.

Object to manage local files in the device.

Type:
  • Object

Methods

(static) removeHistory()

Description:
  • Function to remove history of visited plugins and reload whole plugins except current plugin.

    Currently only works for Android OS now.

    :: PROBLEM ::

    HARD TO USE WITH bim.app.storyboard.moveTo, DUE TO SYNC PROBLEM.

    RECOMMENDED TO USE AFTER bim.app.storyboard.moveTo, NOT BEFORE.

Source:
Example
bim.native.removeHistory();
Returns:

(static) internalBrowser(url) → {Object|void}

Description:
  • Function to open URL with internal browser. Currently only works for Android OS now.

Source:
Example
bim.native.internalBrowser(${1:url});
Parameters:
Name Type Description
url string

Required.

Returns:

if url is empty, returns error object with errno, message, description. | void

Type
Object | void

(static) shareUrl(url) → {Object|void}

Description:
  • Function to share url through native feature. Currently only works for Android OS now.

Source:
Example
bim.native.shareUrl(${1:url});
Parameters:
Name Type Description
url string

Required.

Returns:

if url is empty, returns error object with errno, message, description.

Type
Object | void

(static) loadService(params) → {Object|void}

Description:
  • Function to load service. Used in bundle.js in APP. Currently only works for Android now.

Source:
Parameters:
Name Type Description
params Object

Required.

Returns:

if params is empty, returns error object with errno, message, description.

Type
Object | void

(static) exec(params)

Description:
  • Function to call native functions. Currently, only works for Android OS now.

Source:
Example
bim.native.exec({
 hardware: 'gallery',
 event: 'event_name',
 fn: 'my_callback_function_name',
 data: 'my_data'
});
Parameters:
Name Type Description
params Object

Required.

Properties
Name Type Description
hardware string
event string

Custom parameters for a native function

fn string

The name of callback function

callback string
data Object | string
Returns:

(static) cameraChooser(paramsopt)

Description:
  • Function to make file-input and save data to internal database of the App. Used in AnimalZ - post feature in App.

Source:
Parameters:
Name Type Attributes Description
params Object <optional>

(static) plugin(params)

Description:
  • Function to run native functions. Currently only works for Android OS now.

Source:
Example
bim.native.plugin(${1:params});
Parameters:
Name Type Description
params Object

Required.

(static) load(params)

Description:
  • Function to run native functions. Currently only works for Android OS now.

Source:
Example
bim.native.load(${1:params});
Parameters:
Name Type Description
params Object

Required.

(static) call(params)

Description:
Source:
Examples
bim.native.call({
 'name': ${1:name},
 'method': ${2:method},
 'callback': ${3:callback},
 'params': ${4:params}
});
bim.native.call({
 'name': 'Login',
 'method': 'kakaoLogin',
 'callback': () => {
   // Do Something ...
 },
 'params': null
});
Parameters:
Name Type Description
params Object

Required.

Properties
Name Type Description
name string
method string
callback function
params Object

(static) handleCallback()

Description:
Source:

(static) callback(data)

Description:
  • Function to read media file and save into local database. This method runs in native source camera feature.

Source:
Parameters:
Name Type Description
data string

Required. Stringfied data. Would be used after JSON.parse(data);

Properties
Name Type Description
source string

File full path url.

type string

Type of the file. Should be in ["image", "video"]

page string

The page to go to after all the work is done.

plugin string

The plugin to go to after all the work is done.

Returns: