This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.file({ | |
act: 'upload', | |
filepath: '/example/file/path/image.jpg', | |
server: 'http://example.com/upload' | |
}, function (res) { | |
alert("Response is " + res.res + ". Sent data : " + res.size); | |
}, function (err) { | |
alert("Error " + err); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.cam({ | |
act: 'picture', | |
source: 'photo', | |
uri: true | |
}, function (res) { | |
if (res.uri) { | |
$('#result').html('<p>' + res.uri + '</p>'); | |
var img = new Image(); | |
img.src = res.uri; | |
$('#result').css('width', '100%').css('height', '90%').append(img); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.cam({act:'picture'}, function(res){ | |
var img = new Image(); | |
img.src='data:image/'+res.format+';base64,'+res.b64; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.cam({ | |
act: 'picture', | |
source: 'photo', | |
uri: true | |
}, function (res) { | |
if (res.uri) { | |
filetoupload = res.uri; | |
$('#result').html('<p>' + res.uri + '</p>'); | |
var img = new Image(); | |
img.src = res.uri; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.data( {act:'save', key:'foo', val:'bar'} ); | |
$fh.data( {key:'foo'}, function(res) { | |
alert( res.key+'='+res.val ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fh.push({act:'register', params:{bb:{port:bb_push_port, appId:bb_push_appId, serverUrl: bb_push_serverUrl}}}, function(e){ | |
var token = e.deviceToken || e.apid || e.devicePIN; | |
alert(token); | |
}, function(){ | |
//do something here | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the receive function need to be placed in $fh.ready so that it will receive messages when the app starts up | |
$fh.ready({}, function(){ | |
$fh.push({act:'receive'}, function(notification){ | |
alert(notification.message); | |
}, function(err){ | |
//error handler | |
} | |
) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var token = $params.token; | |
var platform = $params.platform; | |
$fh.push({'act':'register', 'type':'dev', 'params':{'id':token, 'platform':platform}}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = "hello from FH"; | |
var deviceToken = "xxxxxxxxxxxxxxxxxxxxxx"; | |
var ios_message = {'device_tokens': [deviceToken],'aps':{'alert':message}}; | |
$fh.push({'act':'push', 'type':'dev', 'params':ios_message}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = "hello from FH"; | |
var android_message = {'android':{'alert':message}}; | |
$fh.push({'act':'broadcast', 'type':'dev', 'params':android_message}); |
OlderNewer