Open xml777 opened 9 years ago
gulp 是一个js的自动 build 工具, 就类似于 c语言的make, gulpfile.js
也就类似于 makefile
, gulpfile.js
里面是纯js, 只不过利用了 gulp 模块, 从而方便了js, css代码的预处理压缩等等。
gulpfile.js里面定义了不同的task, 通过命令行来触发, 这里的lpush-install
也是一个task, 他做的事情
AndroidManifest.xml
里插入属性platforms/Android
)自己没用过vs做过cordova的开发, 不过应该只要安装上gulp, 都是一样的
npm install -g gulp
在该目录下创建gulpfile.js, 并插入Readme中提到的代码(注意加上var gulp = require('gulp')
)
.
..
/platforms
/plugins
/www
/config.xml
/package.json
etc...
然后npm install --save-dev xml2js
之后 gulp lpush-install
应该就可以了
谢谢,我先试试
麻烦看一下这么写对么?用的是 ionic 框架。 用visutal studio 2015 远程在 mac 上面编译后部署到手机。leancloud后面没有注册的用户。
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
//通知回调函数
var notifyCallBack = function (event,notice) {
var test = 100;
};
try{
window.LeanPush.init();//初始化
window.LeanPush.subscribe(['ABC'], //订阅 abc 频道
function (e) {
},
function (e) {
}
);
window.LeanPush.getInstallation( //提供 installationId 和 deviceToken
function (data) {
data = {
deviceType: 'ios', installationId: '1234', deviceToken: '1234'
};
}, function (data) {
alert('error!');
});
//$rootScope.on('leancloud:notificationReceived', notifyCallBack);
window.LeanPush.onNotificationReceived(notifyCallBack);
} catch (e) {
alert(e);
}
});
那个 onNotificationReceived
没有event
那个参数
$rootScope.on('leancloud:notificationReceived', function(event, notice){});
window.LeanPush.onNotificationReceived(function(notice){});
修改了还是不行
请详细说明
您要方便的话可以看一下这个代码,我是完全安装例子来做的,gulp没有搞懂,不过我也按lean-install.js中的内容手工替换了 app-key等。
gulpfile.js是做什么用的?我用的是 visual studio 2015 生成cordova 工程,目录下没有这个文件。