将 Parse 推送通知与 Phonegap 集成

Integrate Parse Push Notifications with Phonegap

我正在 phonegap 中开发一个支持解析推送通知的应用程序。我遵循了以下步骤:

  1. 创建 coredova 项目,并使用终端导航到项目文件夹。

  2. 运行解析插件安装命令:

    cordova插件添加https://github.com/benjie/phonegap-parse-plugin

  3. 在我的 DeviceReady 方法中,我已经初始化了解析:

    onDeviceReady: function() {
    var PARSE_APP = "MYPARSEAPPID";
    var PARSE_CLIENT = "MYCLIENTID";
    parsePlugin.initialize(PARSE_APP, PARSE_CLIENT, function() {
                           alert('done');
                           }, function(e) {
                           alert('error');
                           });}
    

    当我执行我的代码时,我成功地完成了警报,但是在解析中没有初始化。我错过了一些步骤吗?

我已经使用 XCode 来 运行 项目。

我会放弃使用解析,因为它们正在关闭 down

一些备选方案here

您尚未复制 git link 中的所有代码。 将 parsePlugin.initialize 更改为

parsePlugin.initialize(appId, clientKey, function() {

parsePlugin.subscribe('SampleChannel', function() {

    parsePlugin.getInstallationId(function(id) {

        /**
         * Now you can construct an object and save it to your own services, or Parse, and corrilate users to parse installations
         * 
         var install_data = {
            installation_id: id,
            channels: ['SampleChannel']
         }
         *
         */

    }, function(e) {
        alert('error');
    });

}, function(e) {
    alert('error');
});

}, function(e) {
alert('error');
});

parsePlugin.subscribe 代码为您的设备安装添加频道。