Is it possible to make a Chromecast device discoverable to devices that are not whitelisted? - google-cast

For example, if I have a friend over and he wants to show me a video using a given app that runs both on my device and his device. Could that app display a QR code on the screen or something that he could scan and instantly be granted access to my Chromecast device?

As Ali mentioned, Chromecast devices are discovered and apps launched via local network applications. One an app is started, it could easily connect with a cloud service that allows other (non-local) devices to talk w/ your Chromecast via the cloud service. A Chromecast Receiver application is just a HTML5 application (HTML, CSS, and JavaScript). You can really do what ever you want once your application gets launched.
If displaying a QR code that allows some kind of rendezvous with your cloud application is what you want to do, you can certainly do that.

I presume your friend's mobile device is on the same wifi network, right? Currently, a chromecast device has no identity outside of its local wifi network, so if the sender is not on the same network as the receiver, there is no way they can exchange messages. Back to your question, if your friend is on your network, then he could see your device except from those applications for which your device is not whitelisted for. Is that the case you want to handle through, say, a QR code? If so, that is currently not doable either since whitelisting is not just a local setup. Maybe I misunderstood your question?

Based on your questions, you are saying that both you and your friend have the same app. If so, and if your friend connects to your wifi network, then he will see your chromecast (you do not whitelist a device for a phone, you whitelist a device for an app id and as long as your friend has the same app (hence the same app id I resume), your whitelisted device will be discoverable by his phone. On the other hand, if you do not want to give him credentials to get on your network, then you need a cloud backend and a lot of work, since although your chromecast device can send a message to cloud and your cloud service can notify the other user's phone (using, say notification or some other mechanism that you employ in your app), the reverse (i.e. sending a message from your friend's phone to your chromecast (through your cloud service)) is much harder. Your friend's phone can send your phone a message (again via a back end service, a bluetooth communication, NFC, etc and then your phone using your app can send that to the chromecast receiver but I am sure you are getting the idea that it is a lot of work. Signing up on your wifi network can be made easier with a QR code or something so at this pint, that would be the easiest solution.

Related

VoIP service to make a bridge between Android phone and Ubuntu server

I want to write an application which will be a bridge between VoIP app and phone line.
E.G.:
- I am writing in Skype to user XXX "call to ******"
- User XXX call me back and by phone modem calling to ******
- So I can speak throw my VoIP and phone modem for free (except internet and phone fees)
I thought to use something like this.
The better description is here in Calling section.
But it is outdated and my server part is on Ubuntu
Could you please advice VoIP (e.g. Skype, Viber, WhatsApp, etc) which I can use for such purpose? It would be great to have a client on Android Phone and server on Ubuntu.
Thank a lot,
If I have well understood, the use case is:
A wants to call B through an application running in a mobile device
B has a phone land or mobile line, but not a VoIP one to receive the call.
Bridge between internet and phone lines is to be done at home (A's home) without specific subscription costs, that is to say, without the services of a VoIP provider (I should like here to suggest rethinking the use of a well stablished solution as costs to call phone lines from IP can be really cheap).
Well, there is a lot of solutions for this scenario. I am going to speak about one of them that I consider interesting because it opens the way to a lot of additional communication services.
First, the softphone. To make and receive calls, A will need an application in his or her device. Consider a softphone as Zoiper or Jitsi Meet.
Then, the gateway between VoIp and phone lines. Asterisk can do the work as a SIP server. It is a lightweight linux software with a lot of features. It can switch VoIP lines with land phone lines via FXS - FXO cards (if the phone lines are analogue ones), ISDN cards, VoIP interfaces, bluetooth using mobile devices, etc.
Last, but not least, the connection. Ok, you do not want to expose your gateway to the dangers of all those wicked people of internet, eager to stole your phone line minutes. Connection between mobile and server could be done using a VPN (e.g. OpenVPN), or through a web app (SIP on top of WebRTC).
Once you have the asterisk working at home, you could use it as an answering machine sending email messages with the received audio, as (if your local regulations allow it) a recorder, as an IVR or as a part of a security system, calling sequencially phone numbers in case of emergency.

App Specific Bluetooth Pairing

I was wondering if there's any way that I can control BLE device pairing specific to my app running on mobile device?
I do not want to write my own bluetooth profile so that only my app can talk to the BLE device instead i want to standard profiles available in BLE device but when it's paired to my phone, only my app should be able to communicate to it and none of the other apps should be able to communicate.
No don't do that.
If you MUST then you should encrypt your data with a key only your app knows.
Bluetooth Low Energy is supposed to be open and free for all.
What is the purpose for you to block others? Preventing them to block your service?
Then use some pre-shared key to verify that it's your app in both sides and close the connection if it's not.

how does an app detect device on network

I use apps that interact with their specific devices. An example is Roku. The device is Roku and I use their Android App. Another is my Denon Audio receiver and it too has an app to control it. I'm looking to write app/hardware service. how does an app detect device on network and vice-versa?
Disclaimer: I don't know what Roku is but what you are describing sounds like service discovery as part of zeroconf.
One relatively known example is DNS-SD. You can think of it as sending periodically multicast UDP messages containing stuff such as "I am at address X and I provide service Y" to some well-known address. Whoever is interested will pick up the information associated.

Build own Chromecast device

The Chromecast device is a "receiver device [that] runs a scaled-down Chrome browser with a receiver application". Can I download and install this receiver app on a chrome browser for example on my Windows notebook?
I have implemented a complete chromecast v2 receiver, called YouMap ChromeCast Receiver, available in Google play store and Amazon store, xda-developer thread here: http://forum.xda-developers.com/android-tv/chromecast/app-youmap-chromecast-receiver-android-t3161851
The current Chromecast protocol is a completely different one from the original DIAL based protocol. Right now, only YouTube still uses the old protocol, which chromecast maintains its backward compatibility.
The discovery is mDNS, exactly same as Apple TV bonjour protocol.
The most difficult part is device authentication, the sender and the receiver perform handshakes by exchanging keys and certificates in a way extremely difficult to crack. AppleTV does the same using FairPlay encryption.
The next difficult part is the mirroring protocol, which is also very complicated, need to deal with packet splits, packet retransmissions. Overall, chromecast mirroring protocol is well designed, better than miracast, better than AirPlay mirroring (I have also implemented both of them, so I know what I am talking about).
When I get chances, will write more here.
The chromecast device works using the DIAL protocol. It is completely possible to emulate this protocol using some simple code to listen on the multicast group for discovery and then handle the HTTP requests to launch applications. It is then the launched application that communicates with the casting device, I believe using the RAMP protocol.
Luckily for us the applications that the chromecast device uses are mostly web applications meaning our device emulator just needs to launch a web browser and point it to a specific url when it receives an application request.
For example the youtube app, after device discovery and establishing where the applications are located (part of DIAL). Will send a HTTP POST request containing a pairing key to /<apps url>/YouTube. All the emulating device needs to do now is open https://www.youtube.com/tv?<pairing key> in a browser window. From here, I believe, communication for controlling the youtube app is not sent through the casting device but through the open tabs on the casting device and the emulator.
This is my understanding of how the chromecast device works and specifically the youtube app from looking at https://github.com/dz0ny/leapcast which is a python emulator that has youtube and google music working.
Google is in progress of open sourcing some part of the chrome cast.
https://code.google.com/p/chromium/codesearch#chromium/src/chromecast/
https://code.google.com/p/chromium/issues/list?q=label:Chromecast
So theoretically you can build a similar device.

Data Exchange between applications over ActiveSync

Can anyone tell me how to send receive data between two applications over an ActiveSync connection?
In my scenario there will be one application running on a desktop and another on a windows mobile device, both these applications need to communicate among them. The connection between the desktop and the mobile device can be ActiveSync over USB or Bluetooth. I need the applications to exchange a continuous stream of data, more like a chat application. Ideally, the mobile device application will be sending out data 10-15 times a second (maybe more) and the desktop application will receive the data and display it.
For e.g., let’s consider the ‘Notes’ application for mobile device. Basically it allows user to save small textual notes. Now my application would be something similar, with the exception that it will send out all input it receives to the desktop application. The desktop app will receive the ‘inputs’ and process it.
Finally, I'm open to using any other option then ActiveSync, provided it supports Bluetooth.
You should check out ActiveSync api documentation for informations.
There is also an alternative solution, which I use.
Windows Mobile activates a temporary LAN when the device is connected on the USB.
You can use Window Sockets for the communication and avoid ActiveSync,
if it's not too much trouble for you.
Usually, the device gets IP 169.254.2.1 and the PC the 169.254.2.2.

Resources