Chromecast sender app from Chrome on Android failing - chromecast

I'm building a Cast app with a chrome sender and custom HTML/CSS/JS receiver. While it works correctly from desktop chrome, I've noticed that I can't connect via the Android Chrome app.
With Android, when clicking the Cast button and selecting the correct receiver device in the Popup, nothing happens (my listener for SESSION_STATE_CHANGE is not called). After clicking the button again, my session listener says:
{type: "sessionstatechanged",
session: null,
sessionState: "SESSION_START_FAILED",
errorCode: "invalid_parameter"}
At first, I thought my setup was incorrect, but after looking at the official chrome sender app and following the same steps as above, I noticed a similar problem with a different error code:
Request session failure:
{"code":"invalid_parameter",
"description":"Already requesting session",
"details":null}
In the above case the visual indicator starts it's 'active' state on first click, but there's no change/activity otherwise it just stays in that state.
This was working before, so I know this is a relatively new issue (at least since Feb, possibly sooner). I also know since it's working on desktop, there's nothing wrong with the setup per se -- but it's still failing for Android.
Any help or feedback here would be great, thank you!

Okay, after updating my Android phone (missed an update this morning) it seems to be fixed.
EDIT:
Turns out, it was due to the restart. So as a patch, restarting your mobile device will reset your Chrome and allow it to send correctly.

Related

My windows phone application runs when ran though visual studio (onclick of device button) but when I disconnect and run it doesn't?

I have written file picker code in my project. When i run the project in my windows phone by clicking on device button in visual studio, the app runs fine(I mean it opens pictures library and i can select a photo and preview it).
But when I disconnect my usb and then open the app in the phone and when i open pictures library on click of a button , the pictures library opens briefly and then the app crashes immediately(My app closes).
Can anyone please help me with this??
As written in the blog post , the AndContinue method run in a different process and to do so, the current running app goes into the background or even gets closed sometimes, that is what you are experiencing in your app as far i can tell but not sure why different things happening during debug & deploy.
There must be a callback inside app.xaml.cs specifically to handle the condition when calling application(which was sent into background) comes in foreground, read this blog post carefully & you'll understand as what you need to change in your code :
using-the-andcontinue-methods-in-windows-phone
http://blogs.msdn.com/b/wsdevsol/archive/2014/05/08/using-the-andcontinue-methods-in-windows-phone-silverlight-8-1-apps.aspx
I just dealt with this issue and one of the reasons why there are differences between debug and deploy is because of the suspending event.
During debug, the application does not actually get suspended until you manually do it through Lifecycle Events. This means that when you pick a file on debug and the app is put to the background to load the file picker, it is not actually suspended, while when the app is deployed, it actually gets suspended.
Look into your app_resuming method and OnSuspending methods in your app.xaml that may be causing errors not occurring during debug.

Pebble.js WatchApp displays: "Disconnected - run the pebble phone app"

I can't find much documentation around this issue. All other running apps on my pebble have a connection to my phone, and work as expected. However, a Pebble.js application I'm currently working on simply displays Disconnected - run the pebble phone app.
I have noticed that in my Developer Settings that the Connection Manager is listed as Disconnected. Is this part of the problem? I see nothing in the logs.
For reference, the application is doing a simple ajax request and displaying the result.
This message is often caused by the JavaScript crashing on the phone (undefined reference, unknown function, etc) and so the watch thinks it is not running.
Some ideas to debug this:
Replace your code with one very simple console.log("hello world") statement and see if this works.
Look at the Logs (View Logs button in CloudPebble or pebble logs on the command line).
Very rarely, on Android, I have seen situation where the Pebble app is in a bad state where it cannot execute the JS for only one app. When this happens, you need to force-kill the Pebble app and relaunch it.
I have had the same experience.
I usually kill and restart the pebble app on my phone and then I also do refresh the browser. Sometimes you have to log out of and then log back into Cloudpebble.

Why does calling chrome.cast.initialize break the connection to the Chromecast device?

I am trying to build a custom Chromecast sender/receiver application, but I can't seem to connect to the device from my custom sender or even Chrome once my custom sender page is loaded.
The Chromecast device appears to be functioning properly (I can cast tabs and YouTube videos). However, when I load the custom sender, it seems to break Chromes connection to the device. The Chromecast icon in Chrome shows "No Cast devices found".
I have found if I comment out chrome.cast.initialize, I can see the Chromecast device again. There are no errors reported in the Chrome debug console and I've commented out all of my code that is called from event handlers related to that call and I still have the same problem. I've also tried resetting the Chromecast device to factory. I've tried a few of the network tweaks recommended in a few other posts as well (though I get the impression they couldn't connect to the device at all).
This was working perfectly yesterday, then it mysteriously stopped. That seems to point to something I might have done, but the only thing I changed was in the receiver app and since I can't get that to start, I don't think it is that.
I also got this error before and I solved it by closing then re-openning the Chrome browser. If you are sure 100% that your js code works as expected when calling chrome.cast.initialize (no error show in Console mode but you got no ChromeCast extension found error), then simply close your Chrome browser and re-open it. If in your console, after calling chrome.cast.initialize, you see the line ChromeCast extension found :.... then you should be able to see your ChromeCast device when clicking into ChromeCast extension icon. If re-open browser does not work, clear your browser cache and try again.
Hope it helps.

Debugging javascript running on the chromecast device

I have my app working with some very basic receiver html however I would now like to do more on the receiver end. Is there a way for me to debug what is happening on the chromecast side? At this point I'm not even sure if my web page is getting refreshed each time.
Open your Chrome browser on port 9222 of your ChromeCast device: http://192.168.0.x:9222
By default the console tab will just show the current app's output, but if you jump from one app to another or your app receiver closes for some reason, you won't know why. To fix that, click on the settings icon (lower right corner) and enable "Preserve log upon navigation"
There appears to be a bug on the ChromeCast device where it caches older versions of the reciever. Just restart the device to force it to download the latest version.

WP7 app won't launch from app list

I have a simple Windows Phone 7 application which is working perfectly when started from Visual Studio. However, if I deactivate the app (press Windows button or back button from the application's MainPage) and then click the app's icon to relaunch, the screen will flash and return to the list/home screen. I assumed this was an issue with the emulator but when I got a developer device I have the same issue.
Note that reactivating without a complete tombstone works (pressing Windows button from the app and then back).
I have no idea what causes this or how to proceed with debugging. Hopefully someone else has experienced this and knows a fix.
Turns out there is a bug, i found the solution here http://forums.create.msdn.com/forums/p/67522/416995.aspx
In short, it turns out that the Microsoft.Xna.Framework.Media.MediaLibrary class (which I am using to display pictures on applications main page) is not properly initialized when the user has not opened a media hub prior to you calling it. So picture collection properties are null or empty. The solution is to add a call to MediaPlayer.Queue.ToString(), it will force the initialization of the native media library allowing you to invoke the MediaLibrary later on.
Sounds like an unhandled error on startup is causing the app to crash.
Trap/log/handle/display any unhandled exceptions. Also check what you're doing on startup.
IF you are saving something (to Isolated Storage) after first run and then opening it on subsequent launches then that's where I'd look first.
If it works when launched from Visual Studio then this will probably be due to the way you are rebuilding/redeploying the app before launching it in that case.

Resources