Android app for control Smart TV (All brands) - android

I have developed an android application that allows to control the Smart TV. It is based on Connect SDK and Conenct SDK Sampler, which allows the phone to pair with the TV and control it with the usual functions such as volume down or navigation on the smart TV interface using the up/down/left/right/ok buttons.
The problem is that according to my statistics, about half of the users have some non-working buttons, I sent a failure event in case the user presses the button, and the Connect SDK responds that the function is not supported, success and failure events are related as 50 at 50. I add screenshots with failure statistics: Button names and number of failures and TV models and the number of failures
I want to reduce the number of non-working buttons for users to a minimum, I will be grateful for any help. I tried to look at several analog applications published on Google Play and saw that some applications, in addition to the Connect SDK, use separate classes for Samsung and other brands, but I did not understand where these classes came from (which library or api?). I am unlikely to be able to develop extensions for each brand, like Tizen or WebOS. I only have Android TV which by the way also has more non-working buttons than working ones.

Related

How can I test my app for a specific device?

I am building an application with React Native but the app not working well on a few android devices. So I need to see what's going wrong but I don't know how to set up an emulator for a specific device. Are these problems depends on phone's brand and model or it just depends on their android versions?
Its not really possible. There's two major problems:
Software. Real devices don't ship pure AOSP like runs on the emulator. They add patches and features and there's no way to know what they actually run.
Custom UIs. Many phones provide custom UIs like TouchWhiz and the like which can override Android behavior
Hardware. If your app depends on things that are very hardware specific, like GPS or Camera, they could have issues due to hardware bugs.
If you just want to emulate a specific OS version like KitKat, or specific low memory conditions its possible via emulator configuration. If you really need to test on a device, either buy one or use a service that allows you remote control over specific devices. Amazon has a nice device farm that you can rent over AWS.
One of the biggest challenges when developing for Android is the wide variety of devices and "optimizations" manufacturers make to their Android versions.
The Android emulator is based on AOSP (vanilla Android) and was only recently published with Google services included. This is the most clean version of Android. You can use the emulator to test UI scaling for different screen sizes but it will always behave like an AOSP Android. Google packs a bunch of hardware configurations into Android Studio which you can simply select when creating an virtual device. You can always create a custom hardware profile with custom screen size and resolution. Some manufacturers also change the DPI value of the OS causing the UI to be bigger or smaller, keep this in mind when creating a custom hardware configuration.
Further, you can use the emulator to test the default behaviour on different Android versions. Again, manufacturers change their Android usually causing slightly different behaviour.
I assume that your question is focussed on different behaviour of e.g. Samsung phones having crashes only occuring in Samsung phones (Samsung can be exchanged with any other brand here). Unfortunately, there is no simple way to test this but getting your hands on the faulty device. One option is to use a cloud based test lab (e.g. Firebase Test Lab, App Center or AWS device farm) to test your code on the faulty device or rent the device at a local shop. Most bigger cities have companies renting phones and tablets on a daily or weekly basis.
In the end you will need if statements checking for a specific device, manufacturer or Android version or any combination of them and doing something slightly different to fix the undesired behaviour.
I know that this is not the answer you are looking for, but it's the best I can offer. To tell a little tale of my worst experience: I had once a bug were calling a crypto function caused a kernel panic on HTC (?) phones. This means the user opened my app and the phone rebooted. I was required to implement the entire encryption logic again just for HTC with Android 6.0.

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.

How do Android TV box software developers ensure best compatibility from third party apps for their (gyroscopic) remote controls?

To explain my question, a bit of info about my test setup might help. I have a Moto Z, with a Moto Mod projector (my spoilt son's christmas present). I've now added a gyroscopic probox2 remote/gamepad, so he can theoretically use his phone while projecting, for films/games, without tapping the phone (which is behind him).
I've connected it and it works to an extent. It works in the core Android UI (home screen, app launcher, settings etc). However it doesn't work at all in most APPs. It works in Amazon Prime, for example, but not in Netflix.
I was expecting it to work pretty much seamlessly, as it would on Android TV boxes, even though I'm connecting it to a phone.
I've noticed it seems to identify itself to Android as a keyboard, rather than a gamepad, which makes sense since the gyroscopic "air mouse" functionality wouldn't necessarily make sense on a gamepad. The gboard popup disappears when the remote is connected, even though the remote itself doesn't have an actual keyboard. The remote allows you to switch between a sort of gamepad mode and a mouse mode, although in both cases identified as a keyboard.
Because it doesn't work out of the box in Android, and I think somebody would have noticed on an Android TV if it didn't work with Netflix, then I'm assuming Android TV developers do something to force compatibility from APPs that aren't allowing input from a "keyboard".
Possibly a service that detects "keyboard" presses and simultaneously triggers a "gamepad" press?
That's how I would probably approach it, and I assume that's how the non-root "button remapper" type APPs approach it, because they can't interfere with the actual button mapping file... but it might not be the best/easiest way?
Any ideas?
Having looked into this further I think I understand.
APPs for Android TV are maintained separately from their mobile counterparts (https://www.apkmirror.com/apk/netflix-inc/netflix-android-tv/netflix-android-tv-3-3-2-build-1530-release/netflix-android-tv-3-3-2-build-1530-android-apk-download/) and it's not possible to side-load them without getting hacky.
So that's basically the answer - the approach in the Android TV industry to ensure compatibility with keyboards, mice, and media remotes etc, is to create separate versions of apps for Android TV which support them. On mobile, presumably developers are mainly interested in ensure physical keyboards work in text input areas, rather than in all areas in unusual cases like mine.
Which doesn't help me at all.
The not so good ways of doing it... There's possibly an approach of creating a virtual gamepad, mapped to the key presses of the physical keyboard (i.e. remote). An example of an app which appears to do just this, requires root in order to do so https://play.google.com/store/apps/details?id=com.locnet.gamekeyboard2&hl=en_GB

Mobile Device Managed Single App Devices

I like to have single android app in our managed devices, we want only that app to be used on the device with necessary restriction, such that,
Single use - Device will have only one app, user can't use other apps, like browsing, youtube or anything,
the initial setting like notification sound, GPS always on, notification and ring sound maximum level can't be modified.
user can not power off the device.
this setting can only be changed by our servers.
i think i have 2 option,
1) Using samsung knox sdk on samsung devices,
Here's MDM proving feature of Samsung Knox Standard!
2) General Android way, Set up Single-Purpose Devices, COSU solution
Android Developer's site.
Wanted to know your's view on this, may be if you guys have done any of the two or any other ways, i could use some of the guidelines or a path.
Thanks for reading, and please comment if i was unable to articulate the subject or it needs editing.
You can use Google's new Android Management API, it seems to suit your needs.
It is a new cloud API that allows to manage Android devices from a server, without having to build an on-device agent (a device policy controller).
I have broad experience of using Samsung Kiosk Mode from Knox Standard SDK which is free and Pro-Kiosk mode from Knox Customization SDK (which has more functions but is not free).
So I can tell you for sure that all 4 points that you have mentioned can be achieved by using Knox Standard SDK.
Singe Purpose: https://seap.samsung.com/api-references/android-standard/reference/android/app/enterprise/kioskmode/KioskMode.html
LocationPolicy (you can turn on GPS and restrict changing): https://seap.samsung.com/api-references/android-standard/reference/android/app/enterprise/LocationPolicy.html
Yes. It is possible but I forgot the exact implementation.
Yes, as well.
Only downside of using this SDK is:
You are tied to Samsung (which I personally okay with, since Samsung has such market penetration and you could get service almost anywhere in the world and in enterprise world it is critical)
About Android native functionality: never tried it
Update March 7, 2019: Now I am playing around Device Owner, we use it for Kiosk mode, works well and works on android Device with Nougat and earlier.

Detecting connected watch version

According to the Android Wear 2.0 guide, Android Wear 2 apps will be installed separately, one from the Play Store on the phone and one from the Play Store on the watch, unlike Android Wear 1.x apps which are packaged together
So guidelines suggest that app should notify user if companion application is required, but not installed on the connected device.
However, not all watches will get 2.0 upgrade and some will stay at 1.x. Those watches install apps companion automatically and if one is missing, it just means app takes a while to install through Bluetooth connection. Displaying "install companion app" notification would be meaningless on these watches as there is nothing user can do to speed up the process (there is on Play Store on older watches).
Now, the issue is that I can't find a way to display warning if connected 2.x watch does not have the app and at the same time not displaying the warning if connected watch is running 1.x.
Is there a good way to distinguish between the two different connected Android Wear versions?
There's not a good way to do this right now. It's been discussed a couple of times on the Wear developers G+ community, and the best we came up with is:
Go ahead and send the RemoteIntent to open the Play store.
Attach a RemoteIntent.ResultReceiver when you do so.
If the watch is running Wear 1.x, this will return with a resultCode of RESULT_FAILED, and you can show your user a message accordingly.
This is obviously not ideal; it involves a useless step (trying to open the Play store) for 1.x users, and there's also no way to distinguish any other possible failure modes. But as of today, it's the best we have.
Discussions:
https://plus.google.com/+SterlingUdell/posts/XJZ8mAsaZ8B
https://plus.google.com/u/0/+SterlingUdell/posts/WWBVxjcD7vT

Categories

Resources