Skip to content

Commit

Permalink
Merge pull request #95 from m1ga/master
Browse files Browse the repository at this point in the history
Ti SDK 7.0.0.GA Update
  • Loading branch information
progress44 authored Jan 11, 2018
2 parents ad4344c + 7aeaab9 commit 21891e4
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 71 deletions.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,33 @@ TiGoosh.registerForPushNotifications({
```js
TiGoosh.unregisterForPushNotifications();
```

## Subscribe/unsubscribe to topics
```js
// subscribe

TiGoosh.subscribe({
topic: "/topics/myTopic",
success: function(e) {
console.log("unsub done " + e);
},
error: function(e){
console.error("error")
}
})

// unsubscribe

TiGoosh.unsubscribe({
topic: "/topics/myTopic",
success: function(e) {
console.log("unsub done " + e);
},
error: function(e){
console.error("error")
}
})
```
## Are notifications enabled
It will return false if users have disabled notifications from the settings for the app, work from to API 19 (Android 4.4).
Not work for android before API 19 (Android 4.4), return true.
Expand Down Expand Up @@ -237,6 +264,40 @@ echo json_encode($json, JSON_PRETTY_PRINT);
echo exec("curl -X POST -H 'Authorization: key=" . GOOGLE_KEY . "' -H 'Content-Type: application/json' --data " . escapeshellarg(json_encode($json)) . ' https://android.googleapis.com/gcm/send');
```

Sending a message to a topic
```php
<?php
// API access key from Google API's Console
define('API_ACCESS_KEY', '.......');
// prep the bundle
$msg = array
(
'body' => 'This is a message sent from my http server',
'title' => 'From server side',
'priority' => 'high',
'sound' => 'default',
'time_to_live' => 3600
);
$fields = array('to' => '/topics/myTopic', 'notification' => $msg);

$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
```

## Handle the notification on the app

The payload of the notifications is the same that comes from your server.
Expand All @@ -258,4 +319,3 @@ A boolean value indicating if the notification has come when the app was in back
## LICENSE

MIT.

Binary file added android/dist/ti.goosh-android-4.0.0.zip
Binary file not shown.
Binary file modified android/dist/ti.goosh.jar
Binary file not shown.
Binary file removed android/lib/play-services-base-11.0.4.jar
Binary file not shown.
Binary file removed android/lib/play-services-basement-11.0.4.jar
Binary file not shown.
Binary file removed android/lib/play-services-gcm-11.0.4.jar
Binary file not shown.
Binary file removed android/lib/play-services-iid-11.0.4.jar
Binary file not shown.
Binary file removed android/lib/play-services-tasks-11.0.4.jar
Binary file not shown.
Binary file modified android/libs/armeabi-v7a/libti.goosh.so
Binary file not shown.
Binary file modified android/libs/x86/libti.goosh.so
Binary file not shown.
8 changes: 4 additions & 4 deletions android/manifest
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 3.0.3
apiversion: 3
architectures: armeabi-v7a x86
version: 4.0.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: ti.goosh
author: Flavio De Stefano
license: MIT
Expand All @@ -15,4 +15,4 @@ name: ti.goosh
moduleid: ti.goosh
guid: 5ad17cbc-1fed-4f20-8f27-6d1baa49ea9f
platform: android
minsdk: 6.2.0
minsdk: 7.0.0
2 changes: 0 additions & 2 deletions android/proguard/README

This file was deleted.

Binary file removed android/proguard/google-play-services.jar
Binary file not shown.
1 change: 0 additions & 1 deletion android/proguard/make.sh

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
63 changes: 0 additions & 63 deletions android/proguard/proguard.conf

This file was deleted.

3 changes: 3 additions & 0 deletions android/timodule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@

</manifest>
</android>
<modules>
<module platform="android">ti.playservices</module>
</modules>
</ti:module>

0 comments on commit 21891e4

Please sign in to comment.