##MAC OS下安装和配置android-sdk
###安装
在MAC上安装android-sdk,标准的安装方法是使用homebrew
,运行如下命令:
brew update
brew install android-sdk
app.controller(['$cordovaFileTransfer', function ( $cordovaFileTransfer ) { | |
// 一定要将代码放在事件监听中 | |
// 表示设备准备好了之后才能执行里面的代码 | |
document.addEventListener('deviceready', function () { | |
var uploadOptions = new FileUploadOptions(), | |
server = 'your_server_api', | |
imgPath = 'your_img_path'; | |
// 注意此处设置的fileKey,Express服务端中也需要这个 | |
uploadOptions.fileKey = 'file'; |
function calcDaysDiff( start, end ) { | |
var currentDate = start || new Date(), | |
timeDiff = end - currentDate, | |
timeUnit = 24 * 60 * 60 * 1000, | |
diff = 0; | |
diff = (timeDiff - currentDate % timeUnit) / timeUnit + 1; | |
return Math.floor(diff); | |
} |
function convertMS( milliseconds ) { | |
var day, hour, minute, seconds; | |
seconds = Math.floor(milliseconds / 1000); | |
minute = Math.floor(seconds / 60); | |
seconds = seconds % 60; | |
hour = Math.floor(minute / 60); | |
minute = minute % 60; | |
day = Math.floor(hour / 24); | |
hour = hour % 24; | |
return { |
##MAC OS下安装和配置android-sdk
###安装
在MAC上安装android-sdk,标准的安装方法是使用homebrew
,运行如下命令:
brew update
brew install android-sdk