A Cordova plugin for Airship's iOS and Android SDK.
Please visit https://support.airship.com/ for any issues integrating or using this plugin.
Urban Airship integration with Apache Cordova
Home Page: https://docs.airship.com/platform/mobile/setup/sdk/cordova/
License: Other
A Cordova plugin for Airship's iOS and Android SDK.
Please visit https://support.airship.com/ for any issues integrating or using this plugin.
Hi,
I am working on a phonegap mobile application meant to be built for both Android and iOS. The application works fine on both platforms, but I haven't been able to have Push notifications working on iOS.
I work in development mode, with an iPad connected to the Internet.
I followed every steps from those manuals:
http://docs.urbanairship.com/build/phonegap.html
http://docs.urbanairship.com/build/ios.html
in apple developer site, I have my appID in the folling state:
Push notifications -> development:Enabled , Distribution : Configurable
and I still get this error
2013-11-25 18:23:01.506 DocvadisMobile[648:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 147] Server: https://device-api.urbanairship.com
2013-11-25 18:23:01.509 DocvadisMobile[648:60b] [D] -[UAirship configureUserAgent] [Line 311] Setting User-Agent for UA requests to DocvadisMobile 0.0.1 (iPad; iPhone OS 7.0.2; UALib 3.0.1; ***********; fr_FR)
2013-11-25 18:23:01.523 DocvadisMobile[648:60b] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-11-25 18:23:01.534 DocvadisMobile[648:60b] [I] +[UAirship executeUnsafeTakeOff:] [Line 190] Registering UAURLProtocol
2013-11-25 18:23:01.546 DocvadisMobile[648:60b] [CDVTimer][pushnotificationplugin] 51.708043ms
2013-11-25 18:23:01.548 DocvadisMobile[648:60b] [CDVTimer][TotalPluginStartup] 54.153025ms
2013-11-25 18:23:02.395 DocvadisMobile[648:60b] [E] -[UAAutoAppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] [Line 43] Failed To Register For Remote Notifications With Error: Error Domain=NSCocoaErrorDomain Code=3000 "aucune autorisation « aps-environment » valide détectée pour l’application" UserInfo=0x16d3c220 {NSLocalizedDescription=aucune autorisation « aps-environment » valide détectée pour l’application}
2013-11-25 18:23:02.402 DocvadisMobile[648:60b] Resetting plugins due to page load.
could you help me please?
Regards,
Jean-Francois Baraton
I've been posting this to the Phonegap Group, but I have narrowed it down to only happening when the UA plugin is present, so I figured I'd post it here.
https://groups.google.com/forum/?fromgroups=#!topic/phonegap/m-6aqTDJpRQ
I'm no Objective-C expert, so that's why I'm not opening a pull request, but lines 472 and 473 of PushNotificationPlugin.m were crashing my app with a complaint that the pointers being freed were not allocated. I removed autorelease from both lines and everything works for me now, but maybe allocating them would be better, I don't know.
It would be awesome if this plugin had plugman support ( if not already ) and was submitted to https://build.phonegap.com/plugins as a supported 3rd party app. This would allow phonegap build users to use this plugin as well.
It seems that the project may already meet all of the other requirements.
I’ve been following the directions on:
https://docs.urbanairship.com/display/DOCS/Client%3A+PhoneGap%3A+Android+Integration#ClientPhoneGapAndroidIntegration-Gettingthesampleappworking
To get the sample Android app running so I can verify configuration before continuing to troubleshooting a custom app. The sample Android app has an error when you follow the directions. I tried the process twice to make sure I hadn’t missed anything. The error is:
ACTION_LOCATION_SERVICE_BOUND cannot be resolved or is not a field IntentReceiver.java /UAPhonegapSample/src/com/urbanairship/phonegap/sample line 107 Java Problem
Hi,
I started i a project using cordova and sensa touch that builds both iOS and android applications. It is running well and I wanted to add the push notification feature from UrbanAirship plugin.
it works (push notifications as well) but I still need to copy
js/PushNotification.js
into platforms/XXX/assets/www/
everytime i build my android application
any idea why it is not automatically placed here by the build command?
cordova build
(from the phonegap project folder)
It is strange because the src/com.urbanairship.phonegap is correctly copied into the android "project".
Regards,
J.F. Baraton
Please look at this log:
08-14 16:44:15.120: I/MyApp - UALib(17746): Javascript Calling back: window.pushNotification.pushCallback({"message":"TEST MSG2224445new","extras":{key1=value1}});
The extras did not return json format,so this code will "alert undefined" :
push.getIncoming(function (incoming) {
if (incoming.message) {
alert("Incoming push message: " + incoming.message;
}
if (incoming.extras.url) {
alert(incoming.extras.url);
}
})
And if I return JSONObject from JAVA,it works.
i'm sorry about my poor English,hope you understand it @@
I have installed the latest phonegap via npm and this plugin via the phonegap cli.
Having some issues registering the device token.
What can i do to get rid of this warning:
warning: no rule to process file '$(PROJECT_DIR)/HelloWorld2/Plugins/com.urbanairship.phonegap.PushNotification/libUAirship-2.0.1.a' of type archive.ar for architecture armv7
warning: no rule to process file '$(PROJECT_DIR)/HelloWorld2/Plugins/com.urbanairship.phonegap.PushNotification/libUAirship-2.0.1.a' of type archive.ar for architecture armv7s
and here is my xcode console log:
2013-08-15 22:22:25.929 HelloWorld2[292:907] Multi-tasking -> Device: YES, App: YES
2013-08-15 22:22:26.020 HelloWorld2[292:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 149] App Key: Ka*********
2013-08-15 22:22:26.022 HelloWorld2[292:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 150] App Secret: f2d*********
2013-08-15 22:22:26.024 HelloWorld2[292:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 151] Server: https://device-api.urbanairship.com
2013-08-15 22:22:26.027 HelloWorld2[292:907] [D] -[UAirship configureUserAgent] [Line 287] Setting User-Agent for UA requests to HelloWorld2 0.0.1 (iPad; iPhone OS 6.0.2; UALib 2.0.1; Ka********* en_US)
2013-08-15 22:22:26.038 HelloWorld2[292:907] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-08-15 22:22:26.055 HelloWorld2[292:907] [CDVTimer][pushnotificationplugin] 67.519963ms
2013-08-15 22:22:26.056 HelloWorld2[292:907] [CDVTimer][TotalPluginStartup] 68.742990ms
2013-08-15 22:22:26.336 HelloWorld2[292:907] [E] -[UAAutoAppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] [Line 43] Failed To Register For Remote Notifications With Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x1f58cc30 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
2013-08-15 22:22:26.402 HelloWorld2[292:907] Resetting plugins due to page load.
2013-08-15 22:22:27.925 HelloWorld2[292:907] Finished load of: file:///var/mobile/Applications/1642CAA1-E389-40AD-B4DF-7ED8035565FB/HelloWorld2.app/www/index.html
2013-08-15 22:22:28.501 HelloWorld2[292:907] [D] -[PushNotificationPlugin registerForNotificationTypes:] [Line 228] PushNotificationPlugin: register for notification types
2013-08-15 22:22:28.502 HelloWorld2[292:907] [D] -[PushNotificationPlugin registerForNotificationTypes:] [Line 235] bitmask value: 7
2013-08-15 22:22:28.526 HelloWorld2[292:5a03] [D] -[UAPush updateRegistrationForcefully:] [Line 492] Device token is nil. Registration will be attempted at a later time
2013-08-15 22:22:28.534 HelloWorld2[292:5a03] [D] -[UAPush updateRegistrationForcefully:] [Line 492] Device token is nil. Registration will be attempted at a later time
2013-08-15 22:22:28.544 HelloWorld2[292:907] [E] -[UAAutoAppDelegate application:didFailToRegisterForRemoteNotificationsWithError:] [Line 43] Failed To Register For Remote Notifications With Error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x20878cf0 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
2013-08-15 22:22:41.071 HelloWorld2[292:1803] [D] +[UAKeychainUtils getDeviceID] [Line 236] Retrieved device id info from keychain.
2013-08-15 22:22:41.072 HelloWorld2[292:1803] [D] +[UAKeychainUtils getDeviceID] [Line 246] Loaded Device ID: 57D4718D-7446-4E15-BB95-D05B9BC10F14
2013-08-15 22:22:41.073 HelloWorld2[292:1803] [D] +[UAKeychainUtils getDeviceID] [Line 247] Loaded Model Name: iPad2,7
2013-08-15 22:22:41.797 HelloWorld2[292:907] [D] __39-[UAAnalytics sendOperationWithEvents:]_block_invoke [Line 622] Analytics data sent successfully. Status: 200
Any advice appreciated, running a macbook with xcode Version 4.6 (4H127)
Hi,
I'm trying to integrate UA into our Cordova 2.2.0 app and so I tried to use PhoneGap_2_2_0_Update
branch, but it looks like I can't build it for iOS simulator.
I downloaded iOS library 1.3.5, copied it to this project, removed library search paths that were missing on my computer (
"$(SRCROOT)/../../dev-ios-library/Airship"
and
"$(SRCROOT)/../../../Library/Developer/Xcode/DerivedData/AirshipLib-drxxzexkdjzwtzdbobeowgblzgsd/Build/Products/Debug-iphoneos"
)
and now I'm getting the following errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_UALocationService", referenced from:
objc-class-ref in PushNotificationPlugin.o
"_OBJC_CLASS_$_UAPush", referenced from:
objc-class-ref in PushNotificationPlugin.o
objc-class-ref in UAAppDelegateSurrogate.o
"_OBJC_CLASS_$_UA_SBJsonWriter", referenced from:
objc-class-ref in PushNotificationPlugin.o
"_OBJC_CLASS_$_UAirship", referenced from:
objc-class-ref in PushNotificationPlugin.o
"_UAAnalyticsOptionsLoggingKey", referenced from:
-[PushNotificationPlugin takeOff] in PushNotificationPlugin.o
"_UAirshipTakeOffOptionsLaunchOptionsKey", referenced from:
-[PushNotificationPlugin takeOff] in PushNotificationPlugin.o
"_logging", referenced from:
-[PushNotificationPlugin validateArguments:forExpectedTypes:] in PushNotificationPlugin.o
-[PushNotificationPlugin pluginResultForValue:] in PushNotificationPlugin.o
-[PushNotificationPlugin performCallbackWithArgs:expecting:withBlock:] in PushNotificationPlugin.o
-[PushNotificationPlugin raisePush:withExtras:] in PushNotificationPlugin.o
-[PushNotificationPlugin raiseRegistration:withpushID:] in PushNotificationPlugin.o
-[PushNotificationPlugin registerForNotificationTypes:withDict:] in PushNotificationPlugin.o
-[PushNotificationPlugin application:didRegisterForRemoteNotificationsWithDeviceToken:] in PushNotificationPlugin.o
...
-[PushNotificationPlugin validateArguments:forExpectedTypes:] in PushNotificationPlugin.o
-[PushNotificationPlugin pluginResultForValue:] in PushNotificationPlugin.o
-[PushNotificationPlugin performCallbackWithArgs:expecting:withBlock:] in PushNotificationPlugin.o
-[PushNotificationPlugin raisePush:withExtras:] in PushNotificationPlugin.o
-[PushNotificationPlugin raiseRegistration:withpushID:] in PushNotificationPlugin.o
-[PushNotificationPlugin registerForNotificationTypes:withDict:] in PushNotificationPlugin.o
-[PushNotificationPlugin application:didRegisterForRemoteNotificationsWithDeviceToken:] in PushNotificationPlugin.o
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Looks like the version of the library I'm using can't be used with iOS simulator. Is there some other version of UA iOS library that I could use? I know that push notifications won't work on simulator, but I want my project to work on it, so that I can test other features without having to deploy it to real device every time.
Could you repost a working sample iOS app for the latest Xcode?
I had it wokring but after upgrading Xcode, it wont build any more..
Trying to run the enclosed sample app, I get:
[...]/phonegap-ua-push/ios-sample/UAPhonegapSample/Plugins/PushNotificationPlugin/UAAppDelegateSurrogate.h:5:9: 'UAGlobal.h' file not found
When downloading the plugin, via the link provided in the email, the build that is provided is missing the exception handling for the PushNotificationPlugin.java raisePush() method when attempting to call this.sendJavascript(js), line 65.
Without the exception handling in place the application will perform as expected when in the foreground and for a while when in the background but will crash when the application is no longer in memory (I believe). A NullPointerException is thrown when the plugin attempts to call the before mentioned method when a notification is received ect.
The PushNotificationPlugin.java in this repo has the exception handling present, they're just not in the zipped builds.
Cheers!
I'm getting an error similar to the following when I try to call any of the functions exposed on the return value from window.pushNotification:
[D] -[UAPush registerDeviceTokenSucceeded:] [Line 774] Device token registered on Urban Airship successfully.
CDVPlugin class PushNotificationPlugin (pluginName: PushNotificationPlugin) does not exist.
ERROR: Plugin 'PushNotificationPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
"PushNotificationPlugin1030349137",
"PushNotificationPlugin",
"getPushID",
[
]
]
My JavaScript is typical:
var _window = null
, push = null;
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
_window = window.open("http://example.org", "_blank");
_window.addEventListener('loadstop', enablePushNotification);
}
function enablePushNotification() {
// push it real good.
push = window.pushNotification;
push.getPushID(function(thePushId) {
alert(thePushId);
});
}
Using PhoneGap 2.8 my config.xml was generated with a deprecation notice on an empty plugins element:
<!-- Deprecated plugins element. Remove in 3.0 -->
<plugins>
</plugins>
It's not clear to me if the library needs to be updated to reflect the deprecation of PG's plugin architecture or if I can work with the existing UA plugin version if I require the runtime dependencies in a different way. Alternatively I could downgrade to PG 2.6 though I was planning to leverage InAppBrowser.executeScript a bit so that'd stink.
I'm running:
Thanks in advance for any advice, etc.
We control the badge value from our server (since in a multi-device setup—web client, mobile client, etc—there may be actions outside of the phone that affect the badge value, hence only adjusting the badge from our server is easiest).
So, it would be great if there was a config setting with which we could turn off the badge reset on startup.
Here is a short illustration:
if ([settings valueForKey:@"com.urbanairship.reset_badge"]) {
[[UAPush shared] resetBadge];//zero badge on startup
}
https://github.com/urbanairship/phonegap-ua-push/blob/master/src/ios/PushNotificationPlugin.m#L70
I was wondering if there are any plans to support Windows Phone 8?
Could some one please specifically say which version of Xcode, phone gap, and UA lib this is supposed to go with?
Is there something wrong with setAlias on ios? doesn't seem to work here.
I am just tying to get the demo phonegap UA plugin working.
Im getting the iOS and android versions registering token, alias's and tags into urbanairship in a dev app. But I cant get a push to actually come thru to the devices(either iOS or android).
Two things pop up:
I have searched the index.html file, and javascripts but cant find onload() any where but the opening body tag. Where is it?or is a typo in the example?
this comes up heaps in the xcode log. Should this be coming up so much?
In iOS I'm getting the following logs:
From the safari inspector(to the actual ipad device):
file:///var/mobile/Applications/BBB212C9-5861-4B0A-AB1A-03135C9B878E/Snowsports.app/www/css/images/ajax-loader.gifFailed to load resource: The requested URL was not found on this server.
index.html:222ReferenceError: Can't find variable: onLoad
index.html:125Got push ID: a7a537dabe9c07a775859e9a095f0a951e9a6a94948851d6c8ff3e4b00b77549
index.html:132Got alias: Ipad3
index.html:25No incoming message
And in Xcode:
2013-08-19 16:58:36.962 Snowsports[780:907] Multi-tasking -> Device: YES, App: YES
2013-08-19 16:58:37.053 Snowsports[780:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 149] App Key: KaRQR_x9SFqOYyscIVPgFg
2013-08-19 16:58:37.055 Snowsports[780:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 150] App Secret: f2dgi3YWTmOQ5AdIQ8tNnA
2013-08-19 16:58:37.056 Snowsports[780:907] [I] +[UAirship executeUnsafeTakeOff:] [Line 151] Server: https://device-api.urbanairship.com
2013-08-19 16:58:37.059 Snowsports[780:907] [D] -[UAirship configureUserAgent] [Line 287] Setting User-Agent for UA requests to Snowsports 1.0.0 (iPad; iPhone OS 6.1.3; UALib 2.0.1; KaRQR_x9SFqOYyscIVPgFg; en_US)
2013-08-19 16:58:37.073 Snowsports[780:907] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-08-19 16:58:37.102 Snowsports[780:907] [CDVTimer][pushnotificationplugin] 80.592990ms
2013-08-19 16:58:37.103 Snowsports[780:907] [CDVTimer][TotalPluginStartup] 81.825972ms
2013-08-19 16:58:37.446 Snowsports[780:907] [D] -[UAUserAPIClient updateDeviceToken:forUsername:onSuccess:onFailure:] [Line 137] Updating device token.
2013-08-19 16:58:37.454 Snowsports[780:907] [D] -[UADeviceAPIClient registerWithData:onSuccess:onFailure:forcefully:] [Line 131] Running device registration.
2013-08-19 16:58:37.530 Snowsports[780:907] Resetting plugins due to page load.
2013-08-19 16:58:38.575 Snowsports[780:907] [I] __34-[UAUser updateDefaultDeviceToken]_block_invoke [Line 257] Device token updated to: a7a537dabe9c07a775859e9a095f0a951e9a6a94948851d6c8ff3e4b00b77549
2013-08-19 16:58:38.577 Snowsports[780:907] [D] __39-[UAPush updateRegistrationForcefully:]_block_invoke [Line 499] Device token registered on Urban Airship successfully.
2013-08-19 16:58:38.578 Snowsports[780:907] [I] -[PushNotificationPlugin registerDeviceTokenSucceeded] [Line 535] PushNotificationPlugin: registered for remote notifications
2013-08-19 16:58:38.966 Snowsports[780:907] Finished load of: file:///var/mobile/Applications/BBB212C9-5861-4B0A-AB1A-03135C9B878E/Snowsports.app/www/index.html
2013-08-19 16:58:39.204 Snowsports[780:907] [D] -[PushNotificationPlugin registerForNotificationTypes:] [Line 228] PushNotificationPlugin: register for notification types
2013-08-19 16:58:39.206 Snowsports[780:907] [D] -[PushNotificationPlugin registerForNotificationTypes:] [Line 235] bitmask value: 7
2013-08-19 16:58:39.215 Snowsports[780:907] THREAD WARNING: ['PushNotificationPlugin'] took '10.459961' ms. Plugin should use a background thread.
2013-08-19 16:58:39.229 Snowsports[780:5007] [D] -[UADeviceAPIClient registerWithData:onSuccess:onFailure:forcefully:] [Line 131] Running device registration.
2013-08-19 16:58:39.230 Snowsports[780:5007] [D] -[UADeviceAPIClient runRequest:withData:succeedWhere:retryWhere:onSuccess:onFailure:forcefully:] [Line 120] Ignoring duplicate request.
2013-08-19 16:58:39.244 Snowsports[780:5007] [D] -[UADeviceAPIClient registerWithData:onSuccess:onFailure:forcefully:] [Line 131] Running device registration.
2013-08-19 16:58:39.245 Snowsports[780:5007] [D] -[UADeviceAPIClient runRequest:withData:succeedWhere:retryWhere:onSuccess:onFailure:forcefully:] [Line 120] Ignoring duplicate request.
2013-08-19 16:58:39.259 Snowsports[780:907] [D] -[UADeviceAPIClient registerWithData:onSuccess:onFailure:forcefully:] [Line 131] Running device registration.
2013-08-19 16:58:39.260 Snowsports[780:907] [D] -[UADeviceAPIClient runRequest:withData:succeedWhere:retryWhere:onSuccess:onFailure:forcefully:] [Line 120] Ignoring duplicate request.
2013-08-19 16:58:52.123 Snowsports[780:524f] [D] +[UAKeychainUtils getDeviceID] [Line 236] Retrieved device id info from keychain.
2013-08-19 16:58:52.124 Snowsports[780:524f] [D] +[UAKeychainUtils getDeviceID] [Line 246] Loaded Device ID: DB3A467E-EB5A-4417-8BC5-9FBB796E23E1
2013-08-19 16:58:52.126 Snowsports[780:524f] [D] +[UAKeychainUtils getDeviceID] [Line 247] Loaded Model Name: iPad3,3
2013-08-19 16:58:52.916 Snowsports[780:907] [D] __39-[UAAnalytics sendOperationWithEvents:]_block_invoke [Line 622] Analytics data sent successfully. Status: 200
"Currently Registering, will check cache state when current registration is complete" never goes away.
I was able to register my devices (development, tried 2 devices), but I cannot update registration (alias, re-register after removing all device tokens, etc) because the above message never goes away. Any time I try to register or update tags, or update alias, this message is logged, and the device is not registered.
I see that you can overwrite notifications by adding code like this to PushAutoPilot.java
com.urbanairship.push.BasicPushNotificationBuilder nb = new com.urbanairship.push.BasicPushNotificationBuilder();
nb.constantNotificationId = 1;
nb.iconDrawableId = R.drawable.ic_stat_notify;
com.urbanairship.push.PushManager.shared().setNotificationBuilder(nb);
This is ok and works, but it would be better if we could either stack them or show them with a number in the notification tray. If this isn't currently possible it would be a good addition to the api.
Does any one know if this works with phonegap 3.xx ios and android?
Does any one know if this works with phonegap 3.xx ios and android?
I want to get the message object when a user resumes the app by clicking on the notification. However when calling the getIncoming() function it returns an empty Push object. I noticed getIncoming only returns something when launching the app instead of resuming.
I placed a question about this on the urban airship support forum but i don't have much faith in the response time.
Happens on iOS, not yet tested on Android.
Hello,
I implemented phonegap plugin including (cordova 2.2.0). But there is a problem with my communication from client side to java. When i debug the project, methods that i am calling from javascript is never triggered from PushNotificationPlugin.java. I am using the same libraries in your sample app. Also i copy and paste the androidmanifest.xml file from the sample app and changed the package name. There is no communication problem between android application and urbanairship cause it is registering and getting id from urbanairship i can see that in the urbanairship web site. Any suggestions will be greatly appreciated.
I followed all of the steps listed here to import into Android and have checked on Urban Airship to see that it is connecting but I cannot receive push notifications from the server. I have the same code copied over to iPhone with Phonegap and have had no issues.
Generally the notification icon is supposed to black and white in the Notification Drawer. However this plugin appears to be just using the app icon for the notification. Is there any way to get at the underlying android.app.Notification object to customize how it is displayed?
I have tried adding this to my main Activity after PhoneGap generates it, but it doesn't seem to take:
com.urbanairship.push.BasicPushNotificationBuilder nb = new com.urbanairship.push.BasicPushNotificationBuilder();
nb.iconDrawableId = R.drawable.ic_stat_notify;
com.urbanairship.push.PushManager.shared().setNotificationBuilder(nb);
I had the UA lib working fine, today I updated it to 1.3.7 for iOS 6, then I got the error
Undefined symbols for architecture i386:
"_logging", referenced from:
-[UALocationSettingsViewController viewDidLoad] in UALocationSettingsViewController.o
-[UALocationSettingsViewController getLocationPressed:] in UALocationSettingsViewController.o
-[UALocationSettingsViewController tableView:cellForRowAtIndexPath:] in
....
but when I archived an adhoc build with v1.3.7 it worked. very strange. any idea? thanks
One of the things that tripped me up on a recent project was the fact that PushNotificationPlugin.java contains a line that must be modified on a project by project basis.
Specifically, line 23:
https://github.com/urbanairship/phonegap-ua-push/blob/master/android-sample/src/com/urbanairship/phonegap/plugins/PushNotificationPlugin.java#L23
That line is hidden amongst a bunch of other import lines that don’t need to be modified.
Ideally, that line wouldn’t be in the plugin and the plugin would be the same from project to project. If that isn’t possible, it would be nice to separate out that line from the rest of the imports so that it is easier to identify as something that needs to be changed.
Is there any development going on for these platforms?
Or has anyone forked this plugin and done it?
m.
Just updated UA with phonegap cli. Had to manually link libsqllite3.dylib and libz.dylib. UAirship takeoff not called in and PushNotificationPlugin does not exist.
Please see output from Xcode below:
2014-03-20 22:29:01.844 XXX[3863:60b] Multi-tasking -> Device: YES, App: YES
2014-03-20 22:29:01.851 XXX[3863:60b] Unlimited access to network resources
2014-03-20 22:29:01.919 XXX[3863:60b] [CDVTimer][splashscreen] 21.817982ms
2014-03-20 22:29:01.919 XXX[3863:60b] CDVPlugin class PushNotificationPlugin (pluginName: pushnotificationplugin) does not exist.
2014-03-20 22:29:01.920 XXX[3863:60b] [CDVTimer][pushnotificationplugin] 0.478983ms
2014-03-20 22:29:01.920 XXX[3863:60b] [CDVTimer][TotalPluginStartup] 23.279965ms
2014-03-20 22:29:01.926 XXX[3863:60b] [E] +[UAirship handleAppDidFinishLaunchingNotification:] [Line 208] [UAirship takeOff] was not called in application:didFinishLaunchingWithOptions:
2014-03-20 22:29:01.926 XXX[3863:60b] [E] +[UAirship handleAppDidFinishLaunchingNotification:] [Line 209] Please ensure that [UAirship takeOff] is called synchronously before application:didFinishLaunchingWithOptions: returns
2014-03-20 22:29:02.102 XXX[3863:60b] Resetting plugins due to page load.
I'm using PG 2.2.0 and the latest UA plug-in. When I try to use the setBadgeNumber function like this:
push = window.pushNotification;
push.setBadgeNumber(count);
I get the following error in the Console:
[PushNotificationPlugin validateArguments:forExpectedTypes:] [Line 58] type mismatch in cordova callback: expected (
NSNumber
) and received (
2
)
(this was obviously for a submission for the variable 'count' of 2)
The way to make this work is to call it like the following:
push.setBadgeNumber(parseInt(count));
However, since count is a number, it seems like it should work without having to force the type, especially because JavaScript is loosely typed.
The urbanairship.registration event only fired when I upgraded from Cordova 3.0.0 to Cordova 3.1.0
Hello,
On my mac, I am trying to build a test app that will receive push notifications, and when I create a new app with these steps using Phone Gap 3.3.0-0.18.0
phonegap create myApp
cd myApp
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
phonegap local plugin add https://github.com/urbanairship/phonegap-ua-push.git
I pulled the example files from the plugin and added my keys and secrets to config.xml
When I load the project in xcode 5.02 I get this error message:
warning: no rule to process file '...platforms/ios/HelloWorld/Plugins/com.urbanairship.phonegap.PushNotification/libUAirship-iOS5-3.0.1.a' of type archive.ar for architecture armv7
I am getting notifications successfully:
[PushNotificationPlugin launchedFromNotification:] [Line 550] The application was launched or resumed from a notification
But the notification is not making it all they way back to example code.
How can I make the example app work? Am I missing something?
screenshot
http://screencast.com/t/NPpUXywAs4c
Hello I dont have very much experience working with phonegap plugins and I want a little more detailed help about using urban airship push notifications plugin and implementing to my projects.
Now I want to know what to do next. My project is writen in JQuery Mobile and I want to implement push notifications to that app.
My phonegap version is the lastest Phonegap 3.2.0 but when I run this command:
phonegap run android
(from Node,js command prompt) and after the app is uploaded I noticed that in build.phonegap.com into my app the Phonegap version says 2.9.0 and no plugins installed notice.
Working on a project for a client of mine. Trying to get push notifications running on phonegap 2.9.0
I get this fatal error:
2013-07-27 17:21:53.170 myproject[7987:907] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* setObjectForKey: object cannot be nil (key: gena)'
*** First throw call stack:
(0x37d743e7 0x36c00963 0x37cd65ef 0x97881 0x97723 0x98173 0x9239d 0x91dab 0x389ce5db 0x389cf58b 0x91d87 0x8877d 0x886af 0x67f47 0x703f3 0x6f597 0x6f101 0x6ecf7 0x6ee83 0x6edad 0x38050cb1 0x37d498f7 0x37d4915d 0x37d47f2f 0x37cbb23d 0x37cbb0c9 0x34ff433b 0x370ab291 0x87b33 0x87af4)
I cloned the example into the www directory added the required preferences (app key, secret key, gcm_sender & enable_push_onlaunch) into config.xml added the plugin through cordova cli as mentioned in the documentation and finally launched the application on an android device and nothing happened neither the device was added to the web interface nor the device showed any alerts.
Adding a weinre
debugging to the app and checking the console i can't see anything, checking isPushEnabled
returned true. Can anyone help me to get it working?
We've had two crashes of this sort, both on Android 4.2.
(out of a fairly small user-base, since we pushed this just now, so only ~10-20 devices or so in total running Urban Airship)
Any thoughts on what may cause this?
Can I provide more details somehow?
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2589)
at android.app.ActivityThread.access$1700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1377)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.urbanairship.Preferences.migratePreferencesFromFileToDb(Preferences.java:173)
at com.urbanairship.analytics.AnalyticsPreferences.(AnalyticsPreferences.java:32)
at com.urbanairship.analytics.EventService.(EventService.java:58)
... 13 more
A bit of context:
I was using 2.0.0 (from the plug man branch) when the migration were just made, before merge the branch and everything worked fine, however i had to create a new project, then when I installed the plugin for that project ( 2.0.1 ) the registration callback function ( from javascript ) sometimes was not fired. and when i tab a notification the getIncoming (javascript) function never get the notification object.
I have also noticed this warning:
THREAD WARNING: ['Notification'] took '21.087891' ms. Plugin should use a background thread.
I know there is a 2.0.3 library for ios,
do you think the issue is fixed in there ? if so, is there a upgrade guide that i can follow ?
I had some days of drama subitting to google play, and the upload not getting excepted, with a no descriptive error. But after extensive searching, found and resolved that the line:
needs to above the tag.
In the demo its below. At least for this was a huge issue in uploading to google play, and resolved it. :)
I thought i'd mention it here in case any else hits the same issue.
We have downloaded the github sample app(using Xcode 4.3.2, iOS 5.1 and cordova 2.0.0) from this repository and running the app, we have added app key and master key in the airship config file but for some reason the device token is not at all registering.
We are verified the certificates and provisioning file all are fine. It would be great u can help us to resolve this issue.
The issue is that when an app receives a notification and it's used to open the app, then when phone is locked and unlocked and the app calls #getIncoming
on resume
event, then the app will receive the same notification again.
UA Android plugin stores alert and extras on PushNotificationPlugin class (https://github.com/urbanairship/phonegap-ua-push/blob/master/android-sample/src/com/urbanairship/phonegap/sample/IntentReceiver.java#L86-L87) and returns them when getIncoming
is called (https://github.com/urbanairship/phonegap-ua-push/blob/master/android-sample/src/com/urbanairship/phonegap/plugins/PushNotificationPlugin.java#L144-L148).
These values are never cleared, unless another notification is used to open the app. This way successive calls to getIncoming
will always return the same notification over and over again.
I'm not sure if it's "by design" or it's a bug, but it can be fixed by clearing PushNotificationPlugin.incomingAlert
and incomingExtras
when getIncoming
is called. Also I'm not sure if it happens on iOS as well.
Working through the UA plugin install with Cordova CLI 3.1.0-0.2.0.
Can you clarify whether or not the file "PushNotification.js" is supposed to auto copy over to the relevant Cordova platforms www sub-directories when the command "cordova plugin add https://github.com/urbanairship/phonegap-ua-push.git" is executed.
Right now it looks the js file is not part of the auto-integration. Or is it a potential bug?
When i try to install the plugin using
cordova plugin add https://github.com/urbanairship/phonegap-ua-push.git
I get this error
[Error: Expected Fetched plugin to have ID "org.apache.cordova.core.device" but got "org.apache.cordova.device".]
I think change the id in the next plugin.xml line, could solve the problem
It seems the instructions are either wrong or incomplete... I am not able to get the USConfig settings to be read from the www/config.xml noted in the instructions for "automatic integration":
https://github.com/urbanairship/phonegap-ua-push#automatic-installation-using-phonegapcordova-cli-ios-and-android
OR
http://docs.urbanairship.com/build/phonegap.html#automatic-integration-using-phonegap-cordova-cli-android-and-ios
I have done a build & run via Xcode from which, the console showed the following errors:
2013-09-11 13:09:36.493 MyApp[11872:c07] Multi-tasking -> Device: YES, App: YES
2013-09-11 13:09:36.507 MyApp[11872:c07] [W] -[UAConfig validate] [Line 155] Development App Key is not valid.
2013-09-11 13:09:36.507 MyApp[11872:c07] [W] -[UAConfig validate] [Line 159] Development App Secret is not valid.
2013-09-11 13:09:36.508 MyApp[11872:c07] [W] -[UAConfig validate] [Line 163] Production App Key is not valid.
2013-09-11 13:09:36.508 MyApp[11872:c07] [W] -[UAConfig validate] [Line 167] Production App Secret is not valid.
2013-09-11 13:09:36.508 MyApp[11872:c07] [E] -[UAConfig validate] [Line 171] Current App Key ((null)) is not valid.
2013-09-11 13:09:36.509 MyApp[11872:c07] [E] -[UAConfig validate] [Line 176] Current App Secret ((null)) is not valid.
2013-09-11 13:09:36.509 MyApp[11872:c07] [E] +[UAirship executeUnsafeTakeOff:] [Line 143] The AirshipConfig.plist file is missing and no application credentials were specified at runtime.
2013-09-11 13:09:36.509 MyApp[11872:c07] [CDVTimer][pushnotificationplugin] 2.90900
I've noticed that setAlias doesn't work - it seems to just be missing the line which actually sets the alias:
PushManager.shared().setAlias(alias);
The code therefore for com.urbanairship.phonegap.plugins.setAlias(JSONArray data, CallbackContext callbackContext) should be:
void setAlias(JSONArray data, CallbackContext callbackContext) {
try {
String alias = data.getString(0);
if (alias.equals("")) {
alias = null;
}
PushManager.shared().setAlias(alias);
Logger.debug("Settings alias: " + alias);
callbackContext.success();
} catch (JSONException e) {
Logger.error("Error reading alias in callback", e);
callbackContext.error("Error reading alias in callback");
}
}
I am getting the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UAAppDelegateSurrogate application:supportedInterfaceOrientationsForWindow:]: unrecognized selector sent to instance 0x8d26840'
I am using Cordova 2.1 (not yet released). The UA plugin was working perfectly on Cordova 2.1 prior to upgrading xcode to 4.5. If I comment out UAAppDelegateSurrogate.m and PushNotificationPlugin.m (effectively disabling Urban Airship) my app runs fine in IOS 6, so the issue is definitely originating in the UA code somewhere.
registerEvent is not there, have you updated the plugin (if yes, documents are not updated), I can't get the APID for my test device.
Manual call for getPushId in Chrome console returns this:
processMessage failed: Message: S01 PushNotificationPlugin753390493 s cordova.js:1034
processMessage failed: Error: TypeError: Object # has no method 'lof' cordova.js:1035
processMessage failed: Stack: TypeError: Object # has no method 'lof'
at :3:11
at Object.cordova.callbackFromNative (file:///android_asset/www/cordova.js:292:54)
at processMessage (file:///android_asset/www/cordova.js:1029:21)
at Function.androidExec.processMessages (file:///android_asset/www/cordova.js:1063:13)
at pollOnce (file:///android_asset/www/cordova.js:933:17)
at pollOnceFromOnlineEvent (file:///android_asset/www/cordova.js:928:5)
Adobe Cordova: 3.2.0
Phone: Motorola Moto X Android 4.4
WebView Chrome: (Version/4.0 Chrome/30.0.0.0)
I Just Installed the Current Version and Its giving me the Following Error while running in my Device.
UAPhonegapSample/Plugins/PushNotificationPlugin/PushNotificationPlugin.m:3:9: 'UAPush.h' file not found
The PushNotification.m code as-is does not set the badge number due to two reasons:
The below code from PushNotification.m shows both of these:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UALOG(@"PushNotificationPlugin: Received remote notification: %@", userInfo);
[[UAPush shared] handleNotification:userInfo applicationState:application.applicationState];
[[UAPush shared] setBadgeNumber:0]; // zero badge after push received
NSString *alert = [self alertForUserInfo:userInfo];
NSMutableDictionary *extras = [self extrasForUserInfo:userInfo];
[self raisePush:alert withExtras:extras];
}
Rather than attempt to handle in JS, I made the change so that PushNotification.m sets the badge number, as shown below.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UALOG(@"PushNotificationPlugin: Received remote notification: %@", userInfo);
[[UAPush shared] handleNotification:userInfo applicationState:application.applicationState];
//[[UAPush shared] setBadgeNumber:0]; // zero badge after push received
NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];
NSNumber *newBadgeNum = [apsInfo objectForKey:@"badge"];
int theValue = [newBadgeNum intValue];
[[UAPush shared] setBadgeNumber:theValue]; // set badge number to what is sent in the userInfo
NSString *alert = [self alertForUserInfo:userInfo];
NSMutableDictionary *extras = [self extrasForUserInfo:userInfo];
[self raisePush:alert withExtras:extras];
}
Note: I am definitely not an iOS programmer, so the above just gets it working, but I imagine requires other code to make it robust.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.