I have been searching a lot for implementing screen cast(miracast) in android and got more confused. I have a HDMI wifi dongle. Now as i plug the dongle and open my app need to search for available devices and as user selects devices the mirroring should start and my screen need to reflect to the device which has plug the device. For now From settings we need to go to display and turn wireless display on and connect to them. As of now i tryed to do this by WifiP2pManager class and got a list of device and connected to my device. But it is not showing as connected on settings wireless display which need to be connected for screen casting. Now my question is can i start that casting from my app and how ?
there is no public API that allows you to manipulate directly the connection, but you can integrate an action that should do what you want, through the MediaRouteActionProvider
Using this, you can display a button inside your action bar. When the user will click on it, it will show the list of paired devices and do a quick scan. From there, the user will be able to directly initiate the connection to an available device.
It's working on most devices, simply not returning the action on those that don't have any paired devices or don't support Miracast (+some Samsung's that don't use the MediaRoute system for Miracast connection).
I need to have have a button that simply starts miracast(mirroring)
That's not possible through the Android SDK, sorry. Whether there is a way for an app running with superuser privileges on a rooted device to do it, I cannot say.
Related
I have a scenario where I want an app to open when it detects that it's connected to a USB device. I have used an approach similar to this (it is using a USB_DEVICE_ATTACHED intent-filter and I have the ID's defined in an xml) and it is working for the most part. The problem I'm having is that when the Android Tablet powers on, the tablet will already be connected to the USB device, so the app doesn't get the USB_DEVICE_ATTACHED event. This then requires me to start the app manually after power up, which leads to me getting this unwanted dialog screen each time:
Allow App to access USB?
[ ] Always open App when USB is connected
Cancel OK
It makes no difference if I check the "Always open" box. It still shows up each time. I have tried using a broadcast receiver to open the app when the app powers on, and I still get the dialog window.
So I'm wondering:
Is there is a way to see get a USB_DEVICE_ATTACHED event when I first power on?
Or is there a way to not display the unwanted dialog screen each time I open the app manually?
I would really appreciate any suggestions. Thanks!
At my company we develop a application that take control of wifi tethering, creating a hotspot with a custom ssid and passkey, allowing a IP Camera to connect and transfer data.
It works well until Android 7.1, but now in 8 apparently we can't tethering with custom ssid.
One solution that I thought was to only disable the update to 8, but how to do it?
My app locks the tablet (no buttons, no access to settings or home launcher, etc), but the update comes in a popup, allowing my client to click the update button.
Some ideas:
Lie the battery percentage
Block the address of the update server
Close the popup programatically
-Any other? I tried all the ideas, but without root I cant't find any solution.
ps: Sadly the tablets can't have root
I'm running Android Things on a Raspberry Pi 3 with a touch screen attached.
I would like to be able to access and update wifi settings in my app. I.e. be able to show a list of scanned wifi networks and let the user pick one and type in a password.
This would be useful when bringing the device to another building with a different wifi network, for example.
Is this possible? Or is the only way to change the wifi connection to do one of the actions described here: https://developer.android.com/things/hardware/raspberrypi.html#connecting_wi-fi
Thanks!
There are APIs which can be used to setup Wi-Fi networks programmatically. This means you can do all the scanning and connecting inside of your app.
I have seen several questions about this topic but none are answered, complete, or actually have answers "to the question asked".
I have a phone which has bluetooth tethering turned on and a tablet which is paired with the phone. Problem is that to get the connections started I must open the bluetooth menu on the tablet and click on the phone's name to actually connect. I would like to have my custom app which runs on the tablet emulate this button click programmatically.
Many online suggestions require creating a socket; however, I do not want to transfer my own data. I only want to "connect" to the device using whatever the default android interface is. (Unknown to me)
I suspect there must be some kind of intent that can be sent to trigger this connection but can't find it.
Currently android has not exposed the classes inorder to connect to Bluetooth PAN profile. Only HEADSET, HANDSFREE and A2DP classes are exposed to interact with them. However, you can dig into the bluetooth framework and identify the classes for PAN profile and use reflection to acheive this. This approach may fail and not guranteed to work as expected.
Refer more in the official documentation
Refer more on accessing Bluetooth classes using Reflection
Enable Bluetooth tethering programmatically
Is it possible to make an Android phone present itself as not being from the Phone device class when connecting over Bluetooth? For example, imagine I wanted to pretend my phone was a Bluetooth keyboard to another device.
I've been looking around the Bluetooth API and I don't see anyway to change it.
COD(Class of device) cannot be changed from the application. For bluez stack in phone, COD is defined in adapter.c . Though if u want that ur phone can act as a keyboard to some other device, may be adding SDP record can help. If peer device searches for the services supported on your phone, it can recognize as HID device with the SDP record