Chromecast sender that knows when session started from Cast Extension - chromecast

The SDK docs for building a Chromecast Sender on Chrome mention this:
There is also a third way of getting a Cast session. A user with the
Cast extension installed in their Chrome browser can mirror any Chrome
tab to a Cast device. If the user lands on your site, for which you
have implemented a Cast app, tab mirroring will automatically trigger
a new Cast session instead of putting the browser in mirroring mode.
And this works just fine; however, I'd like to better understand how my sender code can know when a session has been started this way. Normally, when we set up our own trigger to start a session (i.e. the cast icon), we pass as an argument the callback that will execute when the session connection is ready, If someone visits my app and launches the Cast session directly from the extension, then, how can my app be notified? Is there an event that's raised? Does it execute its own callback (and if so, how can we hook into that callback)?
A similar question was asked here at SO a while ago, and Leon Nicholls answered indicating that it was possible, but not how to do it. Any insights woyld be very useful.

Related

Close Extension window automatically after sending transaction

When you use the Maiar Exchange with the Chrome Extension and send a transaction, you can see that the extension window automatically closes after sending the transaction.
When I implement the same behavior, the Extension window stays open and the sendTransaction() Promise only resolves after the call is done. If I close the window by myself by clicking somewhere else on the website, I get the following error in the console:
Uncaught (in promise) Extension window was closed without response.
With that error, my promise success resolving code is not executed anymore which basically forces the user to wait about 30 seconds until the transaction is done.
This happens when using the sendTransaction() method of the ExtensionProvider from erdjs.
Does anyone have an explanation how e.g. the Maiar Exchange solves this?
The way the Maiar Exchange handles this is slightly different from your approach.
Sending the transaction directly with the ExtensionProvider requires that the extension window stays open until it is finished to return you the result.
However if you only use the ExtensionProvider to sign the transaction using the signTransaction method and send it yourself via the ProxyProvider you won't run into this limitation. The signing is basically instant and quickly closes the extension window. It also allows you to retry sending, without user interaction, if you run into any timeouts or similar.

Xamarin iOS - How to make sure messaging app is up to date?

I have set background fetch to the app. But, It is not called all the time (it depends on how often the app is used by the user)
This is what want to do: When someone send a message to me, I need to make sure that my phone receives the message. Right now, I am using APNS (which works well is the phone is online and working). But, let's say the phone is off or internet not working, the user will never know that a new message has been received, unless he opens the app.
Is there anyway to make sure that, as soon as the user CAN be informed that a new message has been sent, a notification will be displayed on his phone? Right now, if the phone is off and a message sent, if I turn it on, nothing will happen.

Chromecast styled receiver app ID

I am unable to cast with my styled receiver from chrome browser.
I have an unpublished styled receiver chromecast app. The "preview" button works fine. My testing device is registered with status "ready for testing". The send serial number checkbox is checked from my android app (OS X app never finds chromecast, so I cannot verify with another app).
Setting the app ID to be my application ID (which seems to be an 8 digit number in the SDK developer console) throws a session error when I try to connect. Changing this back to the default app ID has success. I registered a second identical application and tried with that ID as well.
What could have gone wrong? I am unable to connect to the debugging console, but I read on SO that you need a custom receiver (not styled receiver) to connect.
I am able to connect to the custom receiver as defined in this sample receiver as well.
Is there no testing for styled receivers?
Note that there is one oddity about my setup, and that is that the chromecast is connecting to a wifi network that has been shared by my macbook, not a normal router.
You don't need a custom receiver to be able to debug, using your own Styled receiver is adequate (you basically need to have your own App Id). I would suggest you double check your serial number; take a photo and enlarge that to make sure it was read correctly.
Solution was use a router instead of sharing internet access via Wi-Fi from my macbook. Re-checked the send serial number box, restarted device and everything worked.

Azure Notification Hub Register iOS Device Always Returns Unauthorized

Early on in developing an iOS app with Xamarin, another developer and I got push notifications working for it using the Azure Messaging Component. It's a few months later now, and sometime between then and now, the push notifications stopped working. The code is still basically the same as before (which is nearly identical to the example code for the component), it was just moved to its own class for maintainability.
On Hub.UnregisterAllAsync(DeviceToken, error =>, error is:
The operation couldn’t be completed. (NSURLErrorDomain error -1012.)
On Hub.RegisterNativeAsync(DeviceToken, tags, error =>, error is:
URLRequest failed for <NSMutableURLRequest: 0x167dbd80>
{ URL: https://[our namespace].servicebus.windows.net/[our hub name]/Registrations/?$filter=deviceToken+eq+'[long token]'&api-version=2013-04 }
with status code: unauthorized
We tried a new hub, and a new namespace with a new hub, but without luck. I've rolled back the changes we've made since it was working, but with no luck there either. The same error happens on multiple devices, on multiple networks. It never shows any errors in the portal for APNS, so I'm assuming this is something with authenticating to the Hub itself. What is really weird is that a Windows Store app that we wrote to test this registers and receives notifications using the same credentials without any issue. Can anyone point me in the right direction on this? The error messages above aren't very helpful.
It turns out that the test devices all had the automatic date and time synchronization turned off. The iPad I was primarily testing with was only off by about 20 or 30 seconds, so I didn't notice it was off. Another question involving the same thing with a Windows or Windows Phone registration clued me into it, but I can't find the link to it now. Apologies for that, thanks to whoever that was!
Looking at the API, it makes sense why it's so sensitive to this. It uses the date and time to generate the SAS Token, thus the unauthorized response when the time is just a few seconds off.

Problem while Making a Call and SMS in same Process on Windows Phone 7

I am developing a application for Windows Phone 7 in which on a button click I need to first send some text messages and then make a call. But as both process are user dependent so I am not getting how should I make it such a way that unless user first finishes the sending messages my app should not initiate call. Because unless I do so it will give thread abort exception.
Thanks;
nil
With the current SDK there is no way to know if the SMS was actually sent. It could also have been changed by the user before being sent!
Lots of people have asked for this functionality (or similar but for other tasks). Let's hope it comes in a future update.
I believe you can't do it in parallel, because WP7 isn't really multitask.
Do you really need to do it in parallel?
Search for the events deactivated and activated. They are in App.cs.
After you make a call, and back to the program, the activated event will detect it, so you can add code there to send SMS.
Done in reverse way. First make a call and then when user comes back after tombstoning send an Email...but flag manipulation need to be saved in isolated storage.

Resources