PushPlugin register goes to errorhandler showing 'Class not found' with cordova 4.0.0 for android platform -


i'm building hybrid app using cordova (version 4.0.0) android.

i have added pushplugin (https://github.com/phonegap-build/pushplugin) project. while registering goes errorhandler , displays 'class not found'.

i have tried various suggestion

  • added plugin reference in xml. plugin reference there in config.xml file.
  • directly install plugin using cli (tried cordova plugin add https://github.com/phonegap-build/pushplugin.git cordova plugin add com.phonegap.plugins.pushplugin)
  • create new project etc.
  • pushnotification.js added in html (<script type="text/javascript" src="js/pushnotification.js"></script>) , located in www/js/

but still i'm getting same message 'class not found'

i have installed supporting plugins device, file, media used pushplugin

please advice if has solution issue.

code sample:

document.addeventlistener("deviceready", ondeviceready, false);  var pushnotification; function ondeviceready() {     //push notification     pushnotification = window.plugins.pushnotification;     pushnotification.register(successhandler, errorhandler, {"senderid":"xxxxxxxxxx", "ecb":"onnotification"}); } 

finally got working adding google play service library project

steps follow:

  • copy google-play-services_lib folder android sdk /extras/google/google_play_services/libproject/ projects myproject/platform/android folder
  • copy build.xml, local.properties & project.properties files myproject/platforms/android/cordovalib folder myproject/platforms/android/google-play-services_lib folder
  • open project.properties file in myproject/platforms/android/google-play-services_lib folder
  • check if project target android 19 i.e. target=android-19, if not change target=android-19
  • open project.properties myproject/platform/android folder , add reference 2 following, target=android-19 android.library.reference.1=cordovalib android.library.reference.2=google-play-services_lib

  • in cli, goto google-play-services_lib folder in project , run

    android update project -p .

  • followed by, ant debug ant release

  • if error first run ant clean debug again run ant debug ant release

  • in cli, goto myproject/ , build project using cordova build android

got information post, thought helpful others have similar issue.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -