Chromecast API doesn't accuratelly detect when device is connected/disconnected - android

I have a problem when i am trying to use my chromecast device.
Currently I have an app for Android , one for iOS
and these 2 apps from github.
https://github.com/googlecast/MediaRouter-Cast-Button-android
https://github.com/googlecast/CastVideos-android
All of them have a common problem. They sometimes cannot accuratelly tell if a chromecast device is connected or disconnected.Taking around a minute before they find it out themselfs.While an application like Youtube , discovers if it is connected or not, instantly.
EDIT #1 START:
While using the application "Cast Videos" for android from GitHub the following thing happens.
I hold the android device in my hand (Samsung Galaxy S2).
I know chromecast is on because I can see it on my monitor.
I start the application "Cast Videos".
The Chromecast icon does not appear, even if the chromecast device is on.
EDIT #1 END;
I have tried using the app_id from my own receiver application , and the default receiver app_id.
I have found a way to trick them into finding the device. By launching the youtube application on an Android or iOS device , connect to the chromecast device , then disconnect.
When I return to on off the apps I have mentioned at the start of the question , they can detect it now , and connect to it.
The two applications from github are not modified , and use the most up to date support libraries (appcompat, mediarouter, CCL).
The applications are now being currently build on a Mac (if that matters). I don't think it will be of any difference if they were built on Windows or something else.
EDIT #2:
I am starting to suspect that actually the wifi router in the building im programming may cause these connection problems. Because when I send the app to other people they don't have the same problem.
EDIT #3:
Good news :D.
The latest update on the castcompanionlibrary made chromecast detection much more reliable and the sample now detects preciselly every time if it is connected or not.

Related

Android Device: Connecting to iBeacon

This is a general query that I have because I have seen contrasting posts about the ways people have implemented it.
My use case is that I want my Android device to connect to iBeacon whenever it is in range, and start a particular app.
How do I go about it? I am not looking for code, in particular, a general direction of how to go about it would be good.
Here's what you can do:
You can program an app to auto-launch itself when a beacon is detected. If this app is already installed on an Android device, it can send a notification or simply appear when the beacon is seen. The free and open source Android Beacon Library has tools that let you do this. See here
Here's what you cannot do:
If you do not have a custom app installed on a phone, then you can not make the phone do anything to respond to a beacon. Once upon a time, it was possible on many phones with Google Play Services to make a beacon detection prompt a user to install your app. Google, however, discontinued this feature of their Nearby service in December 2018.

Android - What determines which devices my phone can cast to?

I'm making an app that should be able to cast to TV's (Android TV & Chromecast). I have experience with Android Development, but I am still at the learning point regarding google cast.
In my environment there are few TV's (5+),and when I open Youtube app on my phone, and select Cast button, device discovers couple of TV's (2-3, or more), but when I start my app and select Cast button, my app discovers only 1 TV (same TV every time).
I want to ask if someone can explain what determines which devices I can cast to? i.e. why youtube app discovers 3+ devices to cast to, and my app discovers only 1 device. It's the same phone, same environment (same TV's), same network.
Thanks in advance for any clarification on this.
EDIT
Smartphone: Sony Xperia L1 (G3311).
Here is some of the TV's I'm using:
TV #1 : Philips 43PUS6412/12 --- Android TV (V.8)
TV #2 : Samsung 7 Series (50) - Model Code: UE50NU7402 --- Android TV
TV #3 : Samsung 5 Series (32) - Some older model --- Android TV BOX (MI BOX, model: MDZ-16-AB)
I checked, all devices are on the same WI-FI network.
And this is even more confusing for me:
On Youtube app I see all these TV's all the time, while
On Sony' default "Album" app, as well as in the app I made, and google cast sample app I downloaded to phone also - at first I saw ONLY "MiBox", none else.
After some time, when I tried couple of times again and again, all apps mentioned above have discovered "Philips TV", but now they didn't discover "MiBox",
For couple of tries, apps managed to discover both "Philips TV" and "MiBox" at the same time,
Then, again these apps discovered only "MiBox", without "Philips",
And now again, apps see only "Philips", without "MiBox"...
I don't know what is happening, what is causing this behaviour, so please I would really appreciate any help.
By themselves Samsung TVs run Tizen. In the Tizen App Store there is a YouTube client which I presume the YouTube Android phone app is connecting to (you may have paired them at some point, i.e. same login credentials).
While a TV set like Philips is running Android TV, from my understanding that the running the Chromecast receiver app isn't consistent. I searched on the model and didn't see that particular model has the "Works with Google Assistant" branding or any branding that it supports "Google Cast"/"Google Chromecast".
For example Sony has a page on updating the "Built in Chromecast" app:
https://www.sony.com/electronics/support/articles/00114152
I would use that page as a guide and see if the Philips TV set has a Chromecast receiver app and is updated. My guess is that even if it does, it doesn't run the background correctly (and would have gotten the appropriate branding logos).
A similar situation exists for any Android TV box like MiBox, the Chromecast receiver app isn't consistent.
See this Reddit thread about the subject:
https://www.reddit.com/r/AndroidTV/comments/74klxy/casting_to_mi_box/
If you are doing development work. I would advise at least one Google Chromecast device as a baseline since Google controls the software updates and built the hardware.

Android SDKCONTROLLER app (Sensor Emulation)

looked everywhere but no one had an answer to this sadly.
Been trying to use an android app that comes with the Android development tools called SDKcontroller. This app is suppose to let me test the multi touch capabilities of my apps. This app is suppose to send input information from a real android device to the emulator. It should let me control the emulator by using the touch sensor in my android device.
I fallowed the instruction and the app is telling me that is connected to the emulator but that is as far as i get. I can touch and touch all I want but the emulator is not responding.
Has somebody been able to get this to work? If so please let me know.
here is a link to the you tube video demonstrating the app: http://www.youtube.com/watch?v=Erd2k6EKxCQ
here is the android project site: http://tools.android.com/tips/hardware-emulation

chromecast device recovery issue

I am working with chromecast device.I am working in android native app. I am in too much trouble with this. I have tried all sample projects that are available on Github. Try to make my own app.
here are steps which I follows.
GoogleCastSdk
mediarouter library
AppComp Library
Whitelisted My device Properly
Set chromecast app as"Send the serial # when checking for updates"..
I have also checked that my device is properly whitelisted with chromecastIP:9222.
But In every sample or my own app I am facing an issue. Chromecast icon is Enabled as there is chromecast Device.. But cant discover my device listed there..
Is there any thing that I am missing??
Any help is this case where I am wrong would be highly appreciated.

Multiple apps connect to bluetooth issue

I have 2 applications w/ the bluetooth code derived from the Bluetooth Chat sample. Individually they work fine. Each app connects via SPP to separate devices. The issue I'm having is on phones with Android 2.1, after the first app connects to its device, you can press Home and get to running the other app, but as soon as the connection is made to the other device with this other app, both apps get the "Sorry! The application xyz (process com.xyz) has stopped unexpectedly. FORCE CLOSE" dialogs. There are try/catch blocks throughout the bt code, for which the catches are not executed. Neither app will then connect (individually) until after bluetooth is turned off then on again. This does NOT happen when these same apps are running on a Samsung tab with Android 2.2 - both apps can run and connect to the devices simultaneously just fine and you can switch between the apps, no problems.
Is this specifically an Android 2.1 issue or something else? Whether it is or not, I need some way to prevent the app from connecting if another app is using bluetooth. I couldn't find anything in the Android APIs that would allow finding this out. Is there any way to coordinate/manage this? Does anyone have any specific insights into this whole issue?
I think it is a bug in the samsung bluetooth stack.
upgrading the my samsung to cyanogenmod fixes it.
see this link
http://www.samsunggalaxysforum.com/firmware-problems/connection-problems-sgs-bluetooth-spp-device/

Categories

Resources