I'm trying to send a push notification using https://github.com/Redth/PushSharp
I'm using the sample project as is (having commented out the non ios stuff from program.cs), I confirmed that the app i'm using is the correct app, I've regenerated the developer push cert.
I'm running the app from xcode, so that it is devlopment providsioned..
The message seems to go fine, but then comes back
Waiting for Queue to Finish...
Sent: Apple -> {"aps":{"alert":"1 Alert Text!","badge":7,"sound":"default"}}
Queue Finished, press return to exit...
Device Subscription Expired: Apple -> [Device Id Removed]
I'm getting the device id from my app, to confirm it coumes out broken into Hex Octets, and i simply remove the spaces
So... not sure where to go from here, seems that apns is saying the app doesn't exist on my device, but it certainly does..
This is almost always due to a mismatch between the development and production provisioning profile certificates.
Check you're using the correct one... if this is still a problem!
Related
I am having trouble trying to pair & bond a Bluetooth LE device using btframework (www.btframework.com), specifically the Nonin Wristox 3150 BLE
The documentation for the device states...
The 3150 BLE uses the Just Works
pairing method with bonding support. Upon successful pairing, the collector should initiate bonding, and the 3150 BLE will save the long term bonding key associated with the collector. The 3150 BLE requires the
collector to be bonded in order to encrypt the connection. When bonding is complete, the collector should
encrypt the connection.
I'm trying to work out what I should be doing to get connected. I've actually managed to get it connected once, which is how I've done all my development, but what I've done does not seem to have worked when I try it again. Using the BTFramework demo application, their "GattClient" - I can discover my device no problem, but when I click on "Connect", it connects to the device with a 0 error code (indicates success) , but the device disconnects a second later. I'm guessing this is because I haven't done all the pairing above.
So I've used their "Bluetooth Manager" to try pairing. I set the MITM to "ProtectionRequiredBonding", IOCap to "DisplayOnly" and BLE Protection to "Encryption", and click "Pair".
This actually worked once - I was paired, and then I was able to use the GattClient to Connect and get the services, characteristics and see the characteristic changes.
However I haven't been able to repeat the exercise. When I use Windows to remove the device, I'm back to the previous state where I can connect but get disconnected by the device, and I tried the above again. It doesn't seem to work now though. I usually get error 0x005105C (device not found) when I try to connect now. In the Window settings devices page, the status seems to change between "Connected" and "Paired" at random, and sometimes the device itself just starts reporting a connection error. (The device is not very forthcoming about what's causing the error). It always reports the pairing itself to be a success though
There is also this:
If the encryption process fails, it is likely that either the collector or 3150 BLE has deleted its bond key. When this occurs, the 3150 BLE will delete its bond key if present. It is recommended that the collector also delete its bond key if present.
Is this something I need to be doing? How is this done with btframework?
It appeared becasue your device has random MAC which changes each time you connect.disconnect.
So the correct sequence is:
Discover device.
Pair with it.
Connect.
Do what you need.
Disconnect.
Unpair (through your code, not through Windows device manager.)
If need connect to it once again go to step 1 so the device will be found with new MAC.
Should you have any questions it faster to get answered if you contact us by e-mail (support#btframework.com).
Just to follow up on this, it turned out to be a quirk specific to my device. It only allows pairing for the first 2 minutes after putting in you're batteries. If I remove the batteries and put them back in, I can pair with the device.
It seems that we programmed everything correctly because when we use a test app that we made everything works fine. But now that were trying to create the real app it doesn't work. When we try to send a push message from Notification Hubs we get the message "message was successfully sent but there were no matching targets". We tripple checked all the necessary fields and everything is the same. Somehow the message is not being delivered and we can't find the reason why.
We're using ActiveMQ locally to transfer data between 5 processes that turn simultaneously.
I have some data I need to send to a process, both at runtime (which works perfectly fine), but also a default value on start. Thing is it is published when the process starts, it just doesn't read because it wasn't subscribed to the topic at the time the data was sent.
I have multiple solutions : I could delay the first publishing for a moment so that the process has time to launch (which doesn't seem very appealing) ; or is there a way to send all stored previously non-treated messages to some process that just subscribed ?
I'm coding in C#.
I don't have any experience with ActiveMQ, but other message system usually have an option which marks the subscription as persistent, which means that; after the first subscription; the message queue itself checks if a certain message is delivered to that system and retries with a timeout. In this scenario you need to start the receiver at least 1 time.
If this is not an option and you want to plug in receiver afterwards, you might want to consider a setup of your messages which allows you to retrieve the full state, i.e. if you send total-messages instead of differential- messages.
After a little google, I came upon this definition durable subscribers, I hope this helps:
See:
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
and
http://activemq.apache.org/manage-durable-subscribers.html
since you are using C# client i don't konw if this is supported
topic = new ActiveMQTopic("TEST.Topic?consumer.retroactive=true");
http://activemq.apache.org/retroactive-consumer.html
So, another solution is to configure this behavior on the broker side by adding that to the activemq.xml and restart :
The subscription recovery policy allows you to go back in time when
you subscribe to a topic.
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" >
<subscriptionRecoveryPolicy>
<timedSubscriptionRecoveryPolicy recoverDuration="10000" />
<fixedCountSubscriptionRecoveryPolicy maximumSize="10000" />
</subscriptionRecoveryPolicy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
http://activemq.apache.org/subscription-recovery-policy.html
I went around the issue by sending a message from each process when they're launched back to the main one, and then only sending the info I needed to send.
I'm trying to test talking to apple's push notification sandbox server.
I made a certificate following this link
(enabled push notification, requested certificate authority, uploaded, generated cert, export p12)
I made a sample C# console application that looks like the following
PushBroker push = new PushBroker();
var appleCert = File.ReadAllBytes(#"devapns.p12");
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;
push.RegisterAppleService(new ApplePushChannelSettings(false,appleCert,"password"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(token)
.WithPasskitUpdate());
push.StopAllServices(waitForQueuesToFinish: true);
When I run I get
The maximum number of Send attempts was reached
The version of PushSharp I'm currently using is 2.2.1.0
Is there something else I need to do? Do I need to enable SSL somewhere? Is my certificate not properly installed on my local machine. I'm not sure where I am going wrong.
NOTE: the p12 file is about 3KB
I installed the development certificate on my local computer just for testing when running this console application
UPDATE:
I managed to get notifications successfully being sent to apns. However, the only problem is that passes do not update on the user device. According to this link, my webservice is to get a list of valid serial numbers once invoked by the device after receiving a passbook update notification from APNS. However, this never happens.
It seems as if I can successfully send my notification to the Apple Notification Service, but from there the apns cannot send it to the device. Any thoughts?
Right now I am signing the pass and sending a notification to APNS using the same pass type ID certificate.
So I was finally able to update a pass in passbook using APNS. It was an arduous process and there were many different things I didn't take into account. Here are a couple things to keep in mind.
Be sure you use the same .p12 file when signing the pass and using pushsharp. (I had originally used a different .p12 associated with regular push notifications). So the link I originally posted in the question is a tad bit misleading, you would follow those steps for regular push notifications. But for passbook notifications, you need use the .p12 file associated with your Pass Type ID
In PushSharp, be sure to disable the production/sandbox certificate check. There is no sandbox environment for passbook, so everything should point to production. In this line, add an extra true parameter to disable the check
push.RegisterAppleService(new ApplePushChannelSettings(false,appleCert,"password", true));
Be sure you aren't using a test device when testing. Also you cannot use the simulator
The push token you receive is different than the DeviceIDToken you would receive when registering for regular push notifications. The push token is passbook exclusive
Ensure the proper certificates are installed on your server. For example I had to install the pass type ID certificate
Do a telnet feedback.push.apple.com 2196 to ensure you can hit the apns server
We are trying to use the NotificationHubClient in Microsoft.ServiceBus.Notifications. We are having a strange problem which the code below shows where we register the Device like so:
NotificationHubClient client = GetHubclient();
var task = client.CreateMpnsNativeRegistrationAsync(deviceToken, tags);
Task.WaitAll(task);
This registers the device fine and if we send a test toast message from the azure portal debug page it comes through to the windows phone without issue. However if we call the following:
var sentTask = client.SendMpnsNativeNotificationAsync(GetPayload());
Task.WaitAll(sentTask);
private static string GetPayload()
{
return "<wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>Great News</wp:Text1><wp:Text2>Great News</wp:Text2></wp:Toast></wp:Notification>";
}
No toast notification arrives on the phone and if we then go and try to send a test toast notification again from the debug page of the azure portal it no longer works and the following error is displayed:
The Push Notification System handle for the registration is invalid
None of this is making sense, we have enabled testSend and there are no errors coming back from the client in the code, in fact it says everything was successful the first time even though this appears to break the PNS handle.
Has anyone come across this before?
It turns out that if the Xml declarations are missing:
<?xml version="1.0" encoding="utf-8"?>
Then you can no longer send push notifications to any phones you tried to send a push notification to as it is invalidated. This seems pretty awful, sure don't send the notification if the payload is invalid but why invalidate the PNS.