What to do with HTTP 412 (Precondition Failed) - The device is in an inactive state - windows-phone-7

I'm getting this error whenever I try to send a push notification to a Nokia WP7 device.
Other push URI's don't return this error but with this one, every try failed, even when the phone is "awake" and with wi-fi on.
Checking MSDN docs, I came to this:
http://msdn.microsoft.com/en-us/library/ff941100(v=vs.92).aspx
The device is in an inactive state. The web service may re-attempt sending the request one time per hour at maximum after receiving this error. If the web service violates the maximum of one re-attempt per hour, the Push Notification Service will de-register or permanently block the web service."
Which didn't help much, as all I can do is honor the "retry after 1 hour" and try to send again.
I suspect that it can be related to the device never had a SIM card in it and therefore could not "activate" but, if this is true, why does MSPN returned a push URI for the app?
Thanks in advance

I've noticed that Microsoft generates a new ChannelUri for a device often (in the past 2 days for my 2 devices i have 5 channel uris)
It may be that a new channeluri has been generated for the device.

Related

How to find factory reset happened on device

I need to find the applied policy status on device.
How to find if registered device on my group done factory reset, using Android Management API.
You can find it via the Key : "DeviceState" in the GET API response of a device which indicates the states that may be applied to a device. GET Device
If the STATE is DELETED then it means the device is no longer enrolled. This state will never be returned by an API call, but is used in the final status report published to Cloud Pub/Sub when the device acknowledges the deletion. DeviceStates

Why is whitelisted Chromecast IP for development blocked with err_connection_refused?

I already read this (Can not access Chromecast receiver debug page by http://chromecastIP:9222?) and similar threads. I am not sure if they are outdated from the pre-release SDK but at any rate here is my tale of woe...
Chrome is giving me these details when attempting to browse my Chromecast IP:
Google Chrome's connection attempt to 192.168.2.78 was rejected. The website may be down, or your network may not be properly configured.
NOTE - I did remember to add the :9222 suffix
My Chromecast device appears to be whitelisted.
From the cast.google.com/publish/#/overview console page it lists both my Application ID and my Serial #.
The App ID is fine if that even matters as I have successfully run many github sample apps using it.
The serial # I entered is correct as I was meticulous reading it with a magnifying glass off the device (felt like Sherlock Holmes).
The status for my Serial # lists, "Ready for testing"
I did this all after a factory reset today.
I then unplugged the USB cable from the Chromecast dongle and counted to 30 and reseated it.
This is exactly what the instructions on the cast developer site instructed.
I have seen some posts where people say it could take hours but that seems to be pre-release posts where there were alot of issues.
So basically I ready every stackoverflow post on this, followed all instructions, everything looks good and works right (I can cast no problem) even with my own code for both Android & Web but I just cannot browse, http://:9222
I just get err_connection_refused
I can ping it without the :9222 suffix as well.
Since it says, "Ready for testing" I assume I do not have to wait for Google to process this.
Finally I was triple sure to check, "Send Serial # to Google for updates" in installation app.
Can anyone provide guidance please?
Thanks!!
These are the instructions I followed (meticulously I might add)
https://developers.google.com/cast/docs/registration
To register your Google Cast device:
Sign in to the Google Cast SDK Developer Console.
From either the Overview page or Devices page, click Add New Device.
Enter the serial number of your device. ( I TRIPLE CHECKED THIS)
The serial number on a Chromecast is a 12-digit alphanumeric string, laser-etched (not printed) on the back of the device and begins with a 3, 4 or 5. It may be easier to read if you take a picture of the serial number then enlarge it. The serial number is also printed on the package.
Enter a description, and click OK.
This is just a friendly name for your device (it does not need to match the name you gave to the device during user setup).
Wait fifteen minutes before continuing. (I waited till it says, "Ready for testing")
Once registration is complete, the Status for the device will read "Ready for Testing."
In the Chromecast setup app, select your Chromecast and check the box, Send this Chromecast's serial number when checking for updates.
Restart your Chromecast by disconnecting the USB cable from the device, then reconnecting it.
After restarting the device, check whether you can access http://:9222 from a chrome browser on the same WiFi network.
** AFTER ALL THIS STILL GET ERR CONNECTION REFUSED **
Once you can access the URL, your device is ready for development. If you can't access the URL, check the serial number you entered in step 3, above.
Please read the documentation here (search for Debugging). The Registration page will be updated later today or tomorrow to remove item number 8 at the bottom of the page. In short, you need to have your own application running on the Chromecast device to be able to attach your chrome debugger to it. Also see this post.

Getting disconnected from Chromecast after switching to custom receiver

I recently switched my Chromecast app to a custom receiver. I'm still using the Cast Companion Library. The custom receiver is basically based on this https://github.com/googlecast/cast-custom-receiver/blob/master/sample_media_receiver.html the only changes are the adding of a logo and loading screen and commenting out this line appConfig.maxInactivity = 6000; although at first I didn't have it commented out and still had the same issue.
Anyways the issue is pretty simple and only happens to a few people. It happens to me with one of my test devices, not all and not always. Basically I start streaming a video and it is all fine, then the device screen goes off, when I turn it off again the app has disconnected from the Chromecast. I do not have wifi set to turn off when sleeping, and all of the users who have complained about this claim their devices also don't have that setting turned on.
It could be a coincidence that this happened when I switched to the custom receiver but I just wanted to make sure there wasn't something I needed to add to my custom receiver to tell the CCL code to stay connected?
Thanks.
I faced similar issue today. Main cause for this behaviour is that as soon as the sender (in your case phone) is locked (sleep mode) then senderDisconnected event is fired on the receiver side. And if you check the event.reason, it will be unknow, so you could probably check for the reason, if it unknown then dont stop the playback on receiver (window.close).
When the sender itself disconnects, event.reason is "disconnected_from_sender".
I hope this helps.
It has nothing to do with maxInactivity.
The policy for disconnecting wifi when your phone goes to sleep does depend on the brand and vendor . Currently, the Cast SDK holds a lock to keep the wifi connected as long as there is a cast connection but even that is not a 100% guarantee to work for all phones/models/vendors/.... This has nothing to do with your receiver. The proper solution is not to try to fight against the wifi disconnect when phone goes to sleep, instead you have to consider adding some logic to recover the cast connectivity when phone wakes up and wifi connectivity is re-established (register a broadcast receiver to listen for wifi connectivity changes).

Unable to Open SCOAudio connection with phone

I am trying to use IOBluetooth framework on OS X 10.8.2 to connect with the bluetooth enabled phones emulating computer as a hands free device. I can successfully make a connection with the phone and phone can recognise the connection as a HandsFree connected to the phone.
But when I try to make a call with the phone and want to send the audio to the mac (by selecting the source as handsfree), the audio never reaches the computer.
As at this point the bluetooth framework tries to open a SCO Audio connection with the device, but the connection establishment is never successful and I get the error code 0x0D status code in scoConnectionOpened status.
I am using IOBluetoothAddSCOAudioDevice function to attach the SCO Audio device with bluetooth device and it is always successful.
//btDevice is paired
res=IOBluetoothAddSCOAudioDevice((IOBluetoothDeviceRef) btDevice,NULL);
if(res != kIOReturnSuccess)
{
self.error.title = [NSString stringWithFormat:
#"Could not attach the Audio device. Try paring device again"];
}
The console log says
24/11/2012 4:02:13.000 PM kernel[0]: [SendHCIRequestFormatted] ###
ERROR: [0x0428] (Setup Synchronous Connection) -- Send request failed
(err = 0x000D (kBluetoothHCIErrorHostRejectedLimitedResources))
24/11/2012 4:02:13.000 PM kernel[0]: REQUIRE_NO_ERR failure: 0xd -
file:
/SourceCache/IOBluetoothFamily_kexts/IOBluetoothFamily-4090.4.33/Core/Family/Drivers/IOBluetoothSCOAudioDriver/IOBluetoothSCOAudioDevice.cpp:872
Although console log says limited resources but I have tried it with multiple phones having their batteries full.
I am stumped on this and just thinking if I need to do any thing special or different?
Thanks in advance for much appreciated help.
This error ("Connection Rejected due to Limited resource") typically happens when a T2 request is sent to a T1-only SCO listener. If you read the patch notes to version 5 you can get a discussion about this problem linux-bluetooth v5 patch notes

Apns test with ad hoc provisioning

I'm developing an App that works with Apple push notifications but I have some problems testing.
I have tested the app in the sandbox and it all works fine: it can send and receive push notifications, but for one single device (I think that is the correct behavior for an sandbox release).
But when I have create an ad hoc version with his production provisioning I have the same behavior: only one device works fine, it sends and receives the push, but the others devices do not receive any push. All devices can send a push but only the the first one can receive.
After installing 'PersistentConnectionLogging.mobileconfig' on devices that can't receive a push, I can read on the console:
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Received message for enabled topic 'myapp.name' with payload '(null)'
Sep 7 13:17:51 unknown apsd[49] <Warning>: <APSCourier: 0x25a0a0>: Failed to parse JSON message payload for topic 'myapp.name': The operation couldn’-t -b-e -c-o-m-p-l-e-t-e-d-. -(-C-o-c-o-a -e-r-r-o-r -3-8-4-0-.-)
I can't resolve the issue, I have regenerated the provisioning profile many times and all work fine on server sides connections, the Apple feedback is OK.
I have checked my stored devices token and sandbox and production are different, any suggestions?
Amalgamation of comments posted as an answer, on request: (these helped to break the problem down and identify where the error was occuring)
How/where are you storing your device tokens? How are you generating the message to be pushed?
Your code that connects to the push servers and creates the payload... how is it sending to >1 devices?
I don't know the easyApns code, but either your other device tokens are invalid or the code is not looping correctly to push the message to the other devices. Also, have a browse through Google for the cocoa error 3840 and see if anything helps you to better understand the issue. Else pick some different push code, have a look at [link below] as a starting point.
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

Resources