Skip to content

Commit f18c2ae

Browse files
committed
correct hash in config
2 parents 32cc1df + bc51208 commit f18c2ae

File tree

5 files changed

+208
-120
lines changed

5 files changed

+208
-120
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
forge-error.log
12
urbanairship_demoapp/hooks/postbuild/uaplugin/AirshipConfig.plist
23
urbanairship_demoapp/hooks/postbuild/uaplugin/airshipconfig.properties
34
urbanairship_demoapp/local_config.json
45
urbanairship_demoapp/.lib/
56
urbanairship_demoapp/.template
67
urbanairship_demoapp/development/
7-
forge-error.log
8+
urbanairship_demoapp/release
9+
urbanairship_demoapp/misc/

README.md

Lines changed: 116 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,13 @@
33
plugin for trigger.io platform allowing integration with push messaging service provided by Urban Airship
44
Ported and modified with permission, from the official phonegap plugin.
55

6-
###License (BSD 2-part)
7-
8-
Copyright (c) 2013, On Device Research Ltd.
9-
All rights reserved.
10-
11-
Redistribution and use in source and binary forms, with or without
12-
modification, are permitted provided that the following conditions are met:
13-
14-
1. Redistributions of source code must retain the above copyright notice, this
15-
list of conditions and the following disclaimer.
16-
2. Redistributions in binary form must reproduce the above copyright notice,
17-
this list of conditions and the following disclaimer in the documentation
18-
and/or other materials provided with the distribution.
19-
20-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
24-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30-
31-
The views and conclusions contained in the software and documentation are those
32-
of the authors and should not be interpreted as representing official policies,
33-
either expressed or implied, of the FreeBSD Project.
346

357
**************************************************************************************
368
****IMPORTANT THIS PLUGIN REQUIRES THE USE OF BUILD HOOKS - SEE BELOW FOR DETAILS!****
379
**************************************************************************************
3810

3911
### project url
40-
https://github.com/Ansr-io/trigger.io-ua-push
12+
[https://github.com/Ansr-io/trigger.io-ua-push](https://github.com/Ansr-io/trigger.io-ua-push)
4113

4214
### project author
4315
petehobo @ gmail DOT com
@@ -50,68 +22,76 @@ setup urbanship account
5022

5123
Follow setup steps for ios and Android from :
5224

53-
ios :http://docs.urbanairship.com/build/ios.html
54-
android : http://docs.urbanairship.com/build/android.html
25+
[http://docs.urbanairship.com/build/ios.html](http://docs.urbanairship.com/build/ios.html)
26+
27+
[http://docs.urbanairship.com/build/android.html](http://docs.urbanairship.com/build/android.html)
28+
5529

5630
You will end with two configured services:
5731

58-
Apple Push Notification Service (APNS)
59-
&
32+
- Apple Push Notification Service (APNS)
33+
- Google Cloud Messaging (GCM)
6034

61-
Google Cloud Messaging (GCM)
62-
NB. set ‘gcmSender’ in ‘hooks/postbuild/uaplugin/airshipconfig.properties’ equal to GCM Project Number,
35+
NB. set `gcmSender` in `hooks/postbuild/uaplugin/airshipconfig.properties` equal to GCM Project Number,
6336
see https://code.google.com/apis/console/ > project overview.
6437

38+
6539
### Build Plugin (optional)
6640

6741
Import the plugin inspectors to your forge workspace.
6842
Build and upload the libiary versions of the plugin following:
6943

70-
https://trigger.io/docs/current/api/native_plugins/index.html (Section Building/packaging your plugin)
44+
[https://trigger.io/docs/current/api/native_plugins/index.html](https://trigger.io/docs/current/api/native_plugins/index.html) (see section 'Building/packaging your plugin').
7145

7246

7347
### Run Test App
7448
Import the plugin
7549
Import the demo app /UA
7650

77-
IMPORTANT - USE OF HOOKS. The Urban Airship system needs to modify the generated forge project during
51+
** IMPORTANT - USE OF HOOKS. **
52+
The Urban Airship system needs to modify the generated forge project during
7853
the build process. This is accomplished by use of build hooks
79-
( https://trigger.io/docs/current/tools/hooks.html ) .
54+
[https://trigger.io/docs/current/tools/hooks.html](https://trigger.io/docs/current/tools/hooks.html).
8055
When developing your own project you must copy the Hooks folder from the demo project.
8156
PLEASE NOTE - special attention will be required if your project uses build hooks.
57+
8258
Further, the Android version of the plugin makes direct modifications to the generated
83-
Android-manifest .xml file - this could potentially cause unexpected results.
84-
***************USE WITH CAUTION**************
59+
60+
`Android-manifest.xml` file - this could potentially cause unexpected results.
61+
62+
** >>> USE WITH CAUTION <<< **
8563

8664

87-
Modify local UA settings:
65+
### Modify local UrbanAirship settings
8866

8967
#### Android
9068

91-
Update the UA settings file in hooks/postbuild/uaplugin/airshipconfig.properties
69+
Update the UA settings file `hooks/postbuild/uaplugin/airshipconfig.properties`
9270

93-
Open hooks/postbuild/hook.py, and set APP_PACKAGE_NAME to your app package name.
71+
Open `hooks/postbuild/hook.py`, and set `APP_PACKAGE_NAME` to your app package name.
9472

95-
N.B. package_names is defined in src/config.json.
73+
N.B. package_names is defined in `src/config.json`.
9674
- package name must be a valid Java package name (lowercase, no hyphens)
9775
- package name may not contain underscores - Apple rejects bundle identifiers with underscores as invalid.
9876

9977

10078
#### iOS
10179

102-
Update the UA settings file in hooks/postbuild/uaplugin/airshipConfig.plist
80+
Update the UA settings file `hooks/postbuild/uaplugin/airshipConfig.plist`
81+
82+
83+
## API documentation
10384

85+
All methods without a return value return null or undefined.
86+
87+
### enablePush()
88+
Enable push notifications on the device. This sends a registration request to the backend service.
10489

105-
### API documentation
10690

10791
```
10892
forge.urbanairship = {
109-
showAlert: function (text, success, error) {
110-
// does nothing ????
111-
// remove this - or fix it.
112-
},
11393
enablePush: function (success, error) {
114-
// Enable push notifications on the device. This sends a registration to the backend service.
94+
// Enable push notifications on the device. This sends a registration request to the backend service.
11595
},
11696
disablePush: function (success, error) {
11797
// Disable push notifications on the device. The device will no longer recieve push notifications.
@@ -128,6 +108,23 @@ forge.urbanairship = {
128108
disableBackgroundLocation: function (success, error) {
129109
// Disable background location updates on the device.
130110
},
111+
registerForNotificationTypes: function (bitmask) {
112+
// Note:: iOS Only
113+
//
114+
// On iOS, registration for push requires specifying what combination of badges,
115+
// sound and alerts are desired. This function must be explicitly called in order
116+
// to begin the registration process. For example:
117+
//
118+
// push.registerForNotificationTypes(push.notificationType.sound | push.notificationType.alert)
119+
//
120+
// If your are unfamiliar with bitmasks, see: https://en.wikipedia.org/wiki/Bitmask#Uses_of_bitmasks
121+
//
122+
// Available notification types:
123+
//
124+
// notificationType.sound
125+
// notificationType.alert
126+
// notificationType.badge
127+
},
131128
// ------------------------------------------------------------
132129
isPushEnabled: function (callback) {
133130
// Callback arguments : Boolean : enabled
@@ -209,9 +206,74 @@ forge.urbanairship = {
209206
// Report the location of the device.
210207
}
211208
};
209+
```
210+
211+
## Events
212+
213+
### Incoming Push
214+
215+
This is called when a push is received, but ONLY while the app is active.
216+
See also getIncoming.
217+
218+
```
212219
forge.internal.addEventListener("urbanairship.pushReceived", function (data) {
213-
// Register for our native push events
214-
// this is called when a push is received: ONLY while the app is active
215-
// see also getIncoming
220+
var txt = 'pushReceived: '+JSON.stringify(d);
221+
console.log(txt);
216222
});
217223
```
224+
225+
### Registration
226+
227+
Callback arguments: (Object)
228+
```
229+
{
230+
valid: Boolean
231+
pushID: String
232+
}
233+
```
234+
235+
This event is trigerred when a registration response is recieved from UrbanAirship.
236+
237+
```
238+
var registered = false;
239+
forge.internal.addEventListener("urbanairship.registration", function (d) {
240+
var txt;
241+
242+
if (!registered) {
243+
registered = d;
244+
txt = 'registration: '+JSON.stringify(registered);
245+
console.log(txt);
246+
}
247+
});
248+
```
249+
250+
251+
252+
## License (BSD 2-part)
253+
254+
Copyright (c) 2013, On Device Research Ltd.
255+
All rights reserved.
256+
257+
Redistribution and use in source and binary forms, with or without
258+
modification, are permitted provided that the following conditions are met:
259+
260+
1. Redistributions of source code must retain the above copyright notice, this
261+
list of conditions and the following disclaimer.
262+
2. Redistributions in binary form must reproduce the above copyright notice,
263+
this list of conditions and the following disclaimer in the documentation
264+
and/or other materials provided with the distribution.
265+
266+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
267+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
268+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
269+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
270+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
271+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
272+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
273+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
274+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
275+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276+
277+
The views and conclusions contained in the software and documentation are those
278+
of the authors and should not be interpreted as representing official policies,
279+
either expressed or implied, of the FreeBSD Project.

urbanairship_demoapp/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
## trigger.io-ua-push demo app
22

33

4+
### dependencies
5+
6+
The demo app depends on the following forge modules:
7+
- logging
8+
- package names
9+
10+
411
TODO: add instructions to setup via Trigger-Toolkit.app
512

613
### manual setup

urbanairship_demoapp/src/config.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
"logging": {
1010
"level": "DEBUG"
1111
},
12+
1213
"contact": true,
1314
"file": true,
1415
"is": true,
15-
"media": {},
16+
1617
"prefs": true,
1718
"request": {
1819
"permissions": [
@@ -22,16 +23,21 @@
2223
},
2324
"tools": true,
2425
"reload": true,
26+
27+
"media": true,
28+
2529
"package_names": {
2630
"ios": "com.ondeviceresearch.ondeviceresearch",
2731
"android": "com.plugtester"
28-
}
32+
},
33+
"is": true
2934
},
3035
"plugins": {
3136
"urbanairship": {
3237
"hash": "ed805d5b8b932d8c0879319aaa3a462e2a80ad17",
3338
"type": "project"
3439
}
3540
},
36-
"trusted_urls": []
41+
"trusted_urls": [],
42+
"uuid": "ef4904c2d9bf11e2a0e312313d00ecf3"
3743
}

0 commit comments

Comments
 (0)