Cordova Parse插件无法正常工作

时间:2015-01-22 12:27:39

标签: android cordova parse-platform ionic

我在离子项目中遇到实施Avivais Phonegap-Plugin-parse的问题。以下是我遵循的步骤。

问题

我总是得到Reference Error: parsePlugin not defined

遵循的步骤

一个。在Ionic项目目录中运行此命令。

cordova plugin add https://github.com/benjie/phonegap-parse-plugin

湾添加android平台。 ionic platform add android

℃。在www/js/app.js中添加此代码。

.run(function($ionicPlatform) {
  $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.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
    try{
        parsePlugin.initialize('XXX', 'YYY', function() {
            alert('success');
        }, function(e) {
            alert('error');
        });

    }catch(err){
        alert('Parse Error '+err.message); //this gets executed all time
    }
  });
})

注意

一个。该插件已安装并显示在plugins/org.apache.cordova.core.parseplugin

platforms/android/res/xml/config.xml

<feature name="ParsePlugin">
        <param name="android-package" value="org.apache.cordova.core.ParsePlugin" />
 </feature>

℃。 index.html<script src="cordova.js"></script>

d。 AndroidManifest.xml

<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.USER_PRESENT" />
    </intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
    <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <category android:name="com.ionicframework.ecopulse420832" />
    </intent-filter>
</receiver>

任何人都可以告诉我在这里添加或检查的是什么?

0 个答案:

没有答案
相关问题