Is it possible to record external HDMI device in Android TV app? - android-tv

For example, if there is a gaming console (i.e PlayStation) connected to HDMI input in a TV with Android TV. Then, is it possible to record the video going through this HDMI input with a 3rd party app?
In my question I'm referring to Android's TV input framework
Thanks for the helpers.

The TV Input Framework docs mentions that it supports TV recording APIs.
DVR
For devices on Android 7.0 and above, the TV App must support the
Android framework TV recording
APIs,
to support, list, and play recorded programs.
This allows device manufacturers to plug their DVR subsystems into TIF
and dramatically reduce the integration effort it takes to enable or
integrate DVR functionality on a TV device. It also enables third
parties to provide aftermarket DVR systems that can be plugged into an
Android TV device.
In addition to recording live content, the TV App also handles
resource conflict. For example, if the device has two tuners, it can
record two programs at the same time. If the user asks to record
three, the TV App must handle the conflict and should either surface a
notification or request that the user schedules a priority for these
requests.
However I don't have code samples for you as I haven't experimented with this yet.

Another approach would be to use the MediaProjection API and record this with a MediaRecorder. Jake Wharton's app Telecine follows this approach and you can find the source code on GitHub.
The benefit is that these APIs were introduced with Lollipop, so you can use them on all Android TV devices. However I just started experimenting with Android TV, so I can not tell from personal experiences.

Related

BLE: Reconnect Android central to iOS peripheral

After days of research and trial and error my colleagues and I have to hope that the StackOverflow community has a working solution.
We got an Android Smartwatch. We developed an app which acts as the BLE central. The App shows a QR-Code encoding an UUID which is unique for every Smartwatch. While showing that QR code it's actively scanning for a device advertising a service with that UUID.
We also developed an iOS app which can scan that QR code and start advertising with the service UUID it received. The Android Smartwatch then connects very quickly to the iOS device.
One purpose of the Smartwatch is to show push notifications from the iOS device. So when the connection is successfully established, the Smartwatch-App subscribes to the ANCS Data Source and Notification Source characteristics. This initiates "Just Works" pairing, so you just have to click on "Pair" on the iOS device. Afterwards you have to allow that iOS notifications are shared to the Smartwatch and then the Smartwatch successfully receives notifications.
ANCS is also the reason why the iOS device MUST BE in the peripheral role.
Until here everything works fine.
When the user leaves the bluetooth range or dis- and enables bluetooth on the iOS device, an automatic reconnect should be triggered. It DOES reconnect when the iOS app is in foreground. Unfortunately it DOES NOT work when the iOS-App is in background. This is probably related to the fact, that the iOS device is not advertising with the required UUID when the app is in background as described in the CoreBluetooth documentation:
All service UUIDs contained in the value of the CBAdvertisementDataServiceUUIDsKey advertisement key are placed in a special “overflow” area; they can be discovered only by an iOS device that is explicitly scanning for them.
We tried many different ways to reconnect from the Android Smartwatch to iOS. From my understanding it should be working when making the first connectGatt with autoConnect=false and when the connection is lost, calling connectGatt on the lost device with autoConnect=true, but it never reconnects. At least not within 15 minutes. Scanning again also wouldn't work, as the UUID is not advertised in background anymore.
We also tried to additionally let the Android device act as peripheral, so the iOS can connect to it. After connecting we wrote data to an "INITIATE_ANCS"-characteristic and let the Android device call connectGatt on the device which was passed to onCharacteristicWrite. This led to interesting behavior:
- The connection was working, we could read a Smartwatch-Characteristic from iOS.
- When subscribing to the ANCS characteristics, it initiated pairing. But instead of "Just Works" pairing it showed a 6-digit code on the iOS device which we had to type onto the Smartwatch.
- The pairing was inititated on every new connect and it always created a new device in the systems device managers on both Android and iOS.
- The pairing WAS NOT inititated when the iOS app was in background.
We really did a thorough research and couldn't find a solution. Did we understand something wrong on how BLE for iOS and Android works? We really hope to find an expert here that has the knowledge what has to be done to make the reconnect work.
Edit:
The Android device is running on Android 5.1.1 and currently it's no option to update.
The iOS testing device is running iOS 13.3 and it should be compatible with iOS 13+

Sample code for Xamarin Cross Platform bluetooth connection

I have traied meny examples to connect Zebra IMZ320 Blutooth using Iphone on Xamarin Cross-Platform
I followed CoreBluetooth Namespace
enter link description here
and also using Plugin.BLE
but I couldnt connect my device eny one has success experience in connect Bluetooth printer using Xamarin cross platform ios
CoreBluetooth.framework is for Bluetooth Low-Energy:
Communicate with Bluetooth 4.0 low-energy devices.
The Core Bluetooth framework provides the classes needed for your apps
to communicate with devices that are equipped with Bluetooth low
energy wireless technology.
According to the specifications of the Zebra IMZ320, the communication mode are:
Secure Bluetooth 2.0, 802.11a/b/g/n (optional) or USB (client)
connectivity; Wi-Fi®-certified connectivity
That is not Bluetooth Low-Energy (which has been introduced in Bluetooth 4.0). You won't be able to find the printer with a Bluetooth Low-Energy scan, because the behavior, logic and implementation (protocols, norms, GATT, Peripheral/Service/Characteristic) are totally different.
Also, the description page of the Zebra IMZ320 gives a link (FAQ - Creating & Registering An IOS App) to how develop apps for it.
You need to use ExternalAccessory.framework for it.
If your app communicates with a Zebra product via Bluetooth using the
External Accessory Framework, and you plan to distribute the app via
the App Store or Volume Purchase Program Store, then you must register
the app with Zebra.
This page is general (and not specific to that printer). But according to the specs, it's not Bluetooth Low-Energy compliant (while others products might be, that's why there is a paragraph talking about CoreBluetooth in it).
That's normal behavior (using ExternalAccessory vs CoreBluetooth framework), because each one of them has a specific meaning and use.
Conclusion:
Use ExternalAccessory.framework, it is also available on Xamarin.

Is it possible to monitor multiple bands from a single app?

Is it possible to have one app on the android or ios phone monitor 2 or more bands, Place tiles and respond to button/ accelerometer events? I did not see that in the docs.
Thanks
Yes, this is possible. It is a more advanced configuration so you must pair the Band's in the phone's BlueTooth Settings. Then when you query the SDK APIs for devices you iterate over the devices and create one connection per device. This should allow you to then communicate with each device from within one app.

Does Qt support Wi-Fi Direct / P2P connections on mobile platforms?

I would like to write a cross-platform mobile app based on Qt which is able to discover other devices reachable via Wi-Fi running the same app. If such devices are found they should be able to communicate with each other in an ad-hoc mannor without requiring any user (inter-)actions.
So my question is:
Does Qt support Wi-Fi Direct communication out of the box in general (i.e. is there any API for these kind of p2p connections), and if so, is this feature also available on mobile platforms supported by Qt? If there is no out of the box solution, can it be implemented with the existing Qt Wi-Fi networking API?

Develop app so two mobile phones can directly communicate using their network sensor

Mobile phones are like radios which listen/broadcast on their bands. A mobile phone can connect to a base station and then to another mobile phone. Since the mobile phone has a range of 5 km, I would like to create an app that allows two devices to connect to each other without a base station.
Can anyone provide a reference to a book, online tutorial, website.. anything? Thanks in advance!
In current mobile phones, the radio used to communicate with the phone network is not under the direct control of the main CPU, where your application runs. It is controlled by a separate baseband processor, and the software on this is not typically user-updateable (often, it is not even updateable by the manufacturer of the phone!).

Resources