Nothing happening when sending push notification with raix:push - ios

I am trying to do a push notification from the browser console using raix (version 2.6.1).
I have tried pushing using the php script from this tutorial and it works with the certificate and key I have, but when I tried it with raix, nothing happen on the phone. I tried doing:
Push.send({from: "pushfrom", title:"hello", text:"world", token:{apn: "my_ios_device_token"}});
This is my config.push.json
{
"apn": {
"passphrase": "xxxxxxx",
"key": "aps_key.pem",
"cert": "aps_cer.pem"
},
"badge": true,
"sound": true,
"alert": true,
"vibrate": true
}
I have insecure package, but still, I tried adding the Push.allow and it didn't help.
How do I know whether the notification is actually being pushed to APNS or nothing is happening at all?

I'll try giving as close to an answer as possible:
Try using the $ meteor shell server console to send messages, server doesn't require allow/deny rules for sending (it's a client-side security)
Behind the scenes theres actually two collections:
Push.notifications - containing the pending notifications to send (these are queued)
Push.appCollection - This one keeps and maintain the tokens (eg. removes tokens if revoked by gcm/apn services)
So you can use the meteor shell to check if the client app registres a push token - if it does then you should be ready to send a message to it eg. directly via the meteor shell.
If you don't get tokens from the client in the Push.appCollection - then you have a config or certificate issue - that's the hard part of push notifications.
If you get tokens into the Push.appCollection then it's prop. something with the server setup. This could be certificates, I've added a guide on the raix:push repo for testing server certs. Also think in ports, you need to have some ports open for your server to communicate with the gcm/apn service. Also think in firewalls etc. depending on your/client setup and security level on the wifi etc.
Please help out improving documentation on the project - I built the thing and take alot for granted, so there might be a missing clue etc. the documentation.
You can also use the query: {} instead of sending to one specific token (while testing)
Latest version is at 2.6.6,
Push notifications is besides scrolling the smallest hardest feature to work with.
Kind regards Morten

Related

Send Apple push notification from a Go appengine site

I'm trying to send an Apple push notification from a Go appengine site. I'm using the apns2 library as follows:
cert, err := certificate.FromPemFile(pemFile, "")
if err != nil {
log.Fatalf("cert error: %v", err)
}
client := apns2.NewClient(cert).Development()
n := &apns2.Notification{...}
if res, err := client.Push(n); err != nil { ... }
On a local development server, it works fine; but in production I'm seeing:
Post https://api.development.push.apple.com/3/device/995aa87050518ca346f7254f3484d7d5c731ee93c35e3c359db9ddf95d035003:
dial tcp: lookup api.development.push.apple.com on [::1]:53: dial udp [::1]:53: socket: operation not permitted
It looks like appengine expects you to use its own urlfetch library when sending outbound requests, so I tried setting the underlying HTTPClient to use that:
client.HTTPClient = urlfetch.Client(ctx)
However, the response from the Apple server is now
##?HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 504f5354202f332f6465766963652f393935616138373035
I believe the problem is that Apple push notifications require HTTP/2, but urlfetch only implements HTTP/1.1.
How do I solve this problem? Is there a way for an appengine app to send an HTTP/2 request?
This would require going through the App Engine Sockets API. The documentation states:
Libraries that can accept a net.Conn should work without modification.
You can get a net.Conn from the appengine/socket package and pass it to a lib that will accept one, but in the case of apns2 it doesn't allow you to do this. However another user has submitted a pull request to the apns2 project that adds a distinct GAEClient which can use App Engine sockets.
As of right now it looks like the commits still have not been pulled into the master branch, however you could still merge these updates manually into your own source tree as a workaround for now.
I dont know much about go appengine, but whatever it looks from the code, your client := apns2.NewClient(cert).Development() line seems to be defective, i think for production, you dont need development cert, you need to have distribution cert. So check that is there any option available for it. Also, is certificates from apple's dev site are generated by you or by go appengine. If you have manually created that, then you have to create 2 types of certificates, one for developement and one for distribution/production, and when app is running in production mode, you need to use that certificates.

How do I use Parse.com's push notification feature for a change in PFObjects?

Can I use Parse.com’s push notification feature to send an array of PFObjects to the user when either a new one is added, or an existing one is deleted?? If so, how should I go about it? I’m writing an app for iOS. Any help would be much appreciated.
Edit:
After doing a bit of searching, I see I have to use the cloud code aftersave() method, and then send a push notification through JavaScript.
If anyone could provide examples of how to go about it, that would be great. In the meantime I'm going through the docs. Thanks again all.
The Parse Documentation really contains everything you need to get started. Writing the code that sends the actual notification is only a small part of the whole process that is required to send push notifications. Here are the steps required:
Create an SSL Certificate: create the cert via Apple Developer Center then export it with Keychain Application
Create Provisioning Profile: also done via Apple Dev Center.
Configure Parse App: Change Parse settings, then upload the cert you created in step 1.
Configure App in Xcode: Change app to use provisioning profile you created in step 2.
Add Code to Prompt user for Notifications: write the code in your app that asks a user if they want to receive Push notifications, then store their device ID in Parse Installation class.
Send the Notification: as mentioned earlier this is the easiest step of all. It can be done via the Parse Dashboard (Click on Push notifications when looking at the Data Browser), via the Parse API or via Cloud-code. I did it via Cloud-Code and it looks like this:
// Find the Installation (i.e. iOS Device) that belongs to my user*
var query = new Parse.Query(Parse.Installation);
query.equalTo('user', user);
Parse.Push.send({
where: query, // Set our Installation query
data: {
alert: "This is the notification message",
badge: "Increment"
}
}).then( function(){
console.log("Push notification successfully sent!");
});
*I added a field in my installation class that captures a user. That way I know which device belongs to which user and can send targeted Push Notifications.
Prepare for Release: When you release your app, you will need to do some additional configuration to get everything ready to release.
Again, I recommend the Parse Docs. They are comprehensive and very helpful. Let me know if you have any additional questions. Hope this helps!
** BTW: If you don't have any experience with cloud-code, then you can complete steps 1-5, then manually send the notifications via the Parse Dashboard.

How to use Grocer feedback?

I'm developing a ruby on rails app and I want to send push notifications to iOS devices. I'm using gorcer gem, and I'm also interested in having some feedback but I cannot make it work. I'm following the git tutorial (https://github.com/grocer/grocer#feedback).
feedback = Grocer.feedback(
certificate: "/path/to/cert.pem", # required
passphrase: "", # optional
gateway: "feedback.push.apple.com", # optional; See note below.
port: 2196, # optional
retries: 3 # optional
)
feedback.each do |attempt|
puts "Device #{attempt.device_token} failed at #{attempt.timestamp}"
end
And the console always return nil.
I tried to disable push notifications and to unistall the ios app to check if there are any feedback but I don't receive anything.
Does anyone know what is happening?
Thank you in advance.
I believe that your code is correct and the .each loop does run in your example (if there is at least 1 failed push notification returned from the feedback service).
I think there is a bug in Grocer that only allows iteration on the feedback service a single time, and then after that the feedback object is set to nil. See this bug: https://github.com/grocer/grocer/issues/80
I think this explains why the code would actually work, but then not return anything in the console.
As a side note, it seems that the best way to test the APNs feedback service is to register a valid device token through a production or ad-hoc app. Then delete the app from your device and send another push notification to that token. The feedback service seems to register that as a failed attempt immediately (and repeatably).

I cannot get push notifications to work with ARCGIS after deleting and recreating certificates many times

I have spent hours deleting certificates and remaking them. I've followed this tutorial https://developers.arcgis.com/en/geotrigger-service/guide/ios-push-notifications/ many times and I still cannot get push notifications to work. I was using the geoloqi.com API but they were bought by esri and just released a new api. I had push working with geoloqi.
The only thing questionable about that tutorial is where it says "Paste the pem file in the box" I just copied from finder and pasted it like it said but it's weird because usually there's a browse for file button and then you upload. I don't know, thats probably not the problem but I thought I'd bring it up.
With this test code:
[[AGSGTApiClient sharedClient] postPath:#"device/notify"
parameters:#{#"text": #"Push notifications are working!", #"url": #"http://developers.esri.com"}
success:^(id res) {
NSLog(#"device/notify success: %#", res);
}
failure:^(NSError *err) {
NSLog(#"device/notify failure: %#", err.userInfo);
}];
I get:
device/notify success: {
devices = {
TKhqTzrTSQI0DGBa = queued;
};
But I never receive the push. Does anybody have a suggestion I can try next because I am lost?
The first thing you'll want to check is whether you have the proper certificates configured for your application. The best way to do this is completely outside the Geotrigger API so that it's not adding more steps to the mix. There are any number of ways you can do this, but we have also written a guide you can follow here: https://github.com/Esri/pushlet/tree/master/client
If you are familiar with Node.js, you can run the Pushlet server yourself and send test notifications to your device. If you are not familiar with Node.js, you can follow the first two steps, Set up the Certificates and Test the Connection.
Once you have verified you are not getting any SSL errors communicating with APNS, and you have verified you can use the certificates to send a push notification to your device directly, if you're still having trouble with sending a push notification through the Geotrigger API, you can contact our support at geotrigger-support#esri.com.

Blackberry Push Notification-Push service sdk error

I install the blackberry sdk push server and i get app id and the port and i used the tutorial SamplePushEnabledApp i registred it with those data
Application ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PPG Base URL** http://pushapi.eval.blackberry.com
Push Port: xxxxxxxx
For push initiator application i use the url https://XX.XX.XX.XX:8443/sample-push-initiator/ successfully create application using this, provide APPID, name and service level = Push-Essential. appID is same as provide by RIM.
I am trying to push msg from push menu item but it's give me error INVALID subscribers.
I had add subscribers name as APP_ID given by RIM, I had also tried device PIN No. as subscriber name but same error occurs.
plz help me to solve this issue.
Is there any solution for that?
There are three things required to sent a request from client side: APP id, push port and PPG base url
and three things required to send a response from server side :PPG base url, push username and push password
check whether you are using the exact credentials that are provided by Blackberry. If these dont match, it gives the above error
Though this may be very late to answer your problem/issue faced while implementing push service in BB device, But as, very recently I successfully able to implement this and I know how difficult to do this if you are not a BB app developer.
Hope you have gone through the below url for installing BB push service sdk on your PC.
http://developer.blackberry.com/bbos/java/documentation/push_service_sdk.html
http://developer.blackberry.com/bbos/java/documentation/developing_push_enabled_app.html
So for this if you are able to install the push service sdk(bpss-1.2.0.29.exe) you will be having one BPSS directory and under this the below thing will get created.
apache-tomcat-7.0.26
logs
pushsdk-high-level
pushsdk-low-level
Uninstall_BPSS
Push_Service_SDK_for_Java_InstallLog.log
Now I have used the pushsdk-low-level to push.
you can access this web app(push initiator cum content provider) by
https://localhost:8443/pushsdk-low-level
But before start pushing from this low-level push initiator you need to properly install the sample pushDemo app on your device.
NOTE: You can't test push service using the simulator.
Then you need to register with the Port(XXXXX), AppId(XXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXX) and BPS server URL: http://cpXXXX.pushapi.eval.blackberry.com, Push Initiator Application URL: http://XX.XXXX.XXX.XX:8443/pushsdk-low-level, and use pubic(BIS) network selected.
Now let me tell you what this sample pushDemo does.
first it will try to use the Push initiator application URL to subcribe/store the BB device PIN to have the information about all PINs that have been register with your Push initiator(here our push-low-level app). But for testing this you can ignore by commenting the below code line in RegisterCommand.java class of the sample PushDemo app
ContentProviderProtocol.performCommand( ContentProviderProtocol.CMD_SUBSCRIBE, username, password, isEnterprise, tx );
Now run this modified app on you device and insert all data required for registration, you will be asked to input username/password, give anything. and register it should register successfully.
Once you have successfully registered your app on your BB device.
Now you should be able to push from your push-low-level web app to your pushDemo client app on your device. NOTE: the address that is been asked on push-low-level push page is nothing but the PIN of your device.
Ping me if you any other help on implementing this.

Resources