-
Notifications
You must be signed in to change notification settings - Fork 84
BuildFire Device Features
This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/device-features/
This section of buildfire.js helps you access different features on the device that normally wouldnt be accessible to a browser
this function allows you to add an event to the devices calendar
-
eventan object with the following properties *titlea string representing the title of the event *location (optional)a string representing the location of the event *notes (optional)a string of representing event notes *startDatea JavaScript Date property (not a string) representing the date and time of when the event begins *endDate (optional)a JavaScript Date property (not a string) representing the when event ends. if you leave empty the OS will default a value *options*firstReminderMinutes (optional)minutes before the event before it reminds the user. Default is 60, pass in null for no reminder (alarm) *secondReminderMinutes (optional)minutes before the event before it reminds the user again. Pass in null for no reminder (alarm) *recurrence (optional)a string with one of the following values [daily, weekly, monthly, yearly] *recurrenceEndDatea JavaScript Date that represents when the recurrence will end. Leave null to add events into infinity and beyond -
callbackis a function that is called on completion with two arguments-
erroran object with error information, null it no error -
resultan OS's return value of adding a calendar event
-
buildfire.device.calendar.addEvent(
{
title: 'Dannys Birthday'
, location: '1950 Main st, NYC, NY'
, notes: 'Better bring a gift'
, startDate: new Date(2015, 10, 20, 8, 0, 0)
, endDate: new Date(2015, 10, 20, 10, 0, 0)
, options: {
firstReminderMinutes: 120
, secondReminderMinutes: 5
, recurrence: "yearly"
, recurrenceEndDate: new Date(2025, 6, 1, 0, 0, 0, 0, 0)
}
}
,
function (err,result) {
if (err)
alert(err);
else
alert('worked ' + JSON.stringify(result) );
}
);
this function allows you to share a message
-
messageObjan object with the following properties (one or more of these properties must be filled) *subjecta string representing the subject of the message *texta string representing the text of the message *imagea string representing an image url (This option will cause issue with some share applications.) *linka string representing a url -
callbackis a function that is called on completion with two arguments-
erroran object with error information, null it no error -
resultreturns true when there is no error
-
buildfire.device.share({
subject:'my message title',
text:'my message text',
image: 'http://myImageUrl',
link: 'http://anyLink'
}, function (err,result) {
if (err)
alert(err);
else
alert('sharing invoked');
});
Note that this function requires the plugin to have the build feature 'sharing' set in plugin.json
When the device 'sharing' feature is not available the message will be sent to the user's mail client using mailto protocol which is helpful when testing on the web emulator
Sharing on Facebook:
- On iOS/Android a message text can not be shared. Only a link or an image can be shared (Facebook App Issue)
- On Android urls must be real domain names like .com, .net
Sharing on Mail App:
- No support for images
this function allows you to add an event to fires when an application is put into the background.
-
callbackis a function that is called on when the application is put into the background -
allowMultipleHandlersoptional bool param that tells the method to override all other handlers. Default false
buildfire.device.onAppBackgrounded(
function () {
alert('application is put into the background');
}
);
this function allows you to add an event to fires when an application is retrieved from the background.
-
callbackis a function that is called on when the application is retrieved from the background -
allowMultipleHandlersoptional bool param that tells the method to override all other handlers. Default false
buildfire.device.onAppResumed(
function () {
alert('application is retrieved from the background');
}
);