Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

andorid: update lib, readme #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:

```
Expand Down Expand Up @@ -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)**
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Binary file removed android/dist/eu.rebelcorp.parse-android-1.0.0.zip
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 18 additions & 1 deletion android/src/eu/rebelcorp/parse/ParseModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down