diff --git a/android/README.md b/android/README.md index 5e3dd13..3ede0c3 100644 --- a/android/README.md +++ b/android/README.md @@ -2,14 +2,17 @@ ## Description -Appcelerator Titanium module for the Parse SDK. This module currently only support Android Push Notifications +Titanium module for the Parse SDK. This module currently only support Android Push Notifications ## Usage -### Get it [![gitTio](http://gitt.io/badge.png)](http://gitt.io/component/eu.rebelcorp.parse) -Download the latest [distribution ZIP-file](https://github.com/timanrebel/Parse/releases) and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli): - -`$ gittio install eu.rebelcorp.parse` +Add +``` +repositories { + maven { url "https://jitpack.io" } +} +``` +to `app/platform/android/build.gradle` ### Example @@ -70,6 +73,12 @@ To handle saved installation }); ``` + +Get the deviceToken with the FCM module and use this to send it to the parse server: +```js +Parse.registerPush(token) +``` + These events are only fired when the app is running. When the app is not running and a notification is clicked, the app is started and the notification data is added to the launching intent. It can be accessed with the following code: ``` @@ -150,7 +159,7 @@ If you want to change the background color of the notification circle, override ## Known Issues -* The current implementation only works in combination with [Facebook module](https://github.com/appcelerator-modules/ti.facebook) version 5.0.0 provided by [Appcelerator](https://github.com/appcelerator). That Facebook module also has a dependency onto the Boltz framework. Both modules should depend on the same version! +* The current implementation only works in combination with [Facebook module](https://github.com/tidev/ti.facebook) version 5.0.0 provided by [TiDev](https://github.com/tidev). That Facebook module also has a dependency onto the Boltz framework. Both modules should depend on the same version! ## Changelog **[v0.13.1](https://github.com/timanrebel/Parse/releases/tag/0.13.1)** diff --git a/android/build.gradle b/android/build.gradle index 657e26a..de24da6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,5 +2,5 @@ maven { url "https://jitpack.io" } } dependencies { - implementation "com.github.parse-community.Parse-SDK-Android:parse:3.0.0" + implementation "com.github.parse-community.Parse-SDK-Android:parse:4.0.0" } diff --git a/android/dist/eu.rebelcorp.parse-android-1.0.0.zip b/android/dist/eu.rebelcorp.parse-android-1.0.0.zip deleted file mode 100644 index d2b2d8e..0000000 Binary files a/android/dist/eu.rebelcorp.parse-android-1.0.0.zip and /dev/null differ diff --git a/android/dist/eu.rebelcorp.parse-android-1.1.0.zip b/android/dist/eu.rebelcorp.parse-android-1.1.0.zip new file mode 100644 index 0000000..d3717e5 Binary files /dev/null and b/android/dist/eu.rebelcorp.parse-android-1.1.0.zip differ diff --git a/android/manifest b/android/manifest index 1550afa..2a1140a 100644 --- a/android/manifest +++ b/android/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 1.0.0 +version: 1.1.0 apiversion: 4 architectures: arm64-v8a armeabi-v7a x86 x86_64 description: Titanium module wrapping the Parse Android SDK. diff --git a/android/src/eu/rebelcorp/parse/ParseModule.java b/android/src/eu/rebelcorp/parse/ParseModule.java index 3ba7f9a..379f1fc 100644 --- a/android/src/eu/rebelcorp/parse/ParseModule.java +++ b/android/src/eu/rebelcorp/parse/ParseModule.java @@ -25,7 +25,6 @@ import com.parse.ParsePush; import com.parse.ParseAnalytics; import com.parse.ParseInstallation; -//import com.parse.PushService; import com.parse.ParseUser; import com.parse.LogInCallback; import com.parse.SaveCallback; @@ -157,6 +156,24 @@ public void enablePush() { // Deprecated. Now happens automatically } + @Kroll.method + public void registerToken(String token) { + ParseInstallation installation = ParseInstallation.getCurrentInstallation(); + if (installation != null && token != null) { + installation.setDeviceToken(token); + // even though this is FCM, calling it gcm will work on the backend + installation.setPushType("gcm"); + installation.saveInBackground( + e -> { + if (e == null) { + Log.i("Parse", "FCM token saved to installation"); + } else { + Log.i("Parse", "FCM token error: " + e.getMessage()); + } + }); + } + } + @Kroll.method public void authenticate(@Kroll.argument String sessionToken) { ParseUser.becomeInBackground(sessionToken, new LogInCallback() {