diff --git a/android/example/app.js b/android/example/app.js index d9301a3..ab79df9 100644 --- a/android/example/app.js +++ b/android/example/app.js @@ -1,5 +1,8 @@ var Parse = require('eu.rebelcorp.parse'); +Parse.addEventListener("tokenReceived",function(e) { + Ti.API.info("::PARSE::tokenReceived::"+JSON.stringify(e.deviceToken)); + }); Parse.start(); // Subscribe of unsubscribe to Parse Channels diff --git a/android/src/eu/rebelcorp/parse/ParseModule.java b/android/src/eu/rebelcorp/parse/ParseModule.java index 54936fa..e094004 100644 --- a/android/src/eu/rebelcorp/parse/ParseModule.java +++ b/android/src/eu/rebelcorp/parse/ParseModule.java @@ -8,6 +8,8 @@ */ package eu.rebelcorp.parse; +import java.util.HashMap; + import org.appcelerator.kroll.KrollModule; import org.appcelerator.kroll.annotations.Kroll; @@ -128,6 +130,13 @@ public void done(ParseException e) { if (e != null) { Log.e(TAG, "Installation initialization failed: " + e.getMessage()); } + else + { + String deviceToken = (String)ParseInstallation.getCurrentInstallation().get("deviceToken"); + HashMap dict = new HashMap(); + dict.put("deviceToken",deviceToken); + fireEvent("tokenReceived", dict); + } } }); }