Open najam-amfnrh9 opened 1 year ago
I had the same problem. Do you have a solution yet?
I have solved the problem: Add this code before starting to connect to the device:
private DiscoveryManager mDiscoveryManager;
mDiscoveryManager = DiscoveryManager.getInstance();
mDiscoveryManager.registerDefaultDeviceTypes();
mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON);
DiscoveryManager.getInstance().start();
dialog = dp.getPickerDialog("Device List", new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
mTV = (ConnectableDevice)arg0.getItemAtPosition(position);
connectItem.setTitle(mTV.getFriendlyName());
mTV.setPairingType((DeviceService.PairingType) null);
mTV.setListener(deviceListener);
mTV.connect();
dp.pickDevice(mTV);
// pairingCodeDialog.show(); } });
I think picker Dialog is doing it, on adapter view list... The code you mentioned above also triggering from onCreate() method of activity. Could you explore further how did you handle it.
@hirovn97
I think this method only plays the role of connecting to the target device, I tried it and the remote function cannot be performed if you have not enabled mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON);
But we're required to attach with single device, selected from the list. i already mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON); in the onItemClick() method. I was able to get capibilities for certain functions like volume up/ down and mute only, also from Dial capabilities it was enabling Netflix App. but nothing else was getting enable to be utilize.
dialog = dp.getPickerDialog("Device List", new AdapterView.OnItemClickListener() {
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { mTV = (ConnectableDevice)arg0.getItemAtPosition(position); connectItem.setTitle(mTV.getFriendlyName()); mTV.setPairingType((DeviceService.PairingType) null); mTV.setListener(deviceListener); mTV.connect(); dp.pickDevice(mTV);
// pairingCodeDialog.show(); } });
I think picker Dialog is doing it, on adapter view list... The code you mentioned above also triggering from onCreate() method of activity. Could you explore further how did you handle it.
@hirovn97
But we're required to attach with single device, selected from the list. i already mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON); in the onItemClick() method. I was able to get capibilities for certain functions like volume up/ down and mute only, also from Dial capabilities it was enabling Netflix App. but nothing else was getting enable to be utilize.
I edited the ui select deive and not use: dialog = dp.getPickerDialog("Device List", new AdapterView.OnItemClickListener() { which uses our own ui, connecting to target device using ConnectableDevice only. We have the same problem as you. When activating DiscoveryManager.getInstance().start(); It helps us enable remote functions: keycontrol, powercontrol... I think we need to read more android connect sdk documentation to understand more
You mean you're calling DiscoveryManager.getInstance().start(); on the click of selected item, even you're using your own UI. The documentation's are not very clear on each and every point, as Connect-SDK handling multiple workaround in the main dependency. Moreover the code provided in Sample project is also lagging the functionality, like one of the overridden method if I'm not wrong sendPairingKey(String key) has no body defined in its parent. Moreover no one from dependency holder answering the questions posted. :(
I have this issue too , was anyone able to find a solution
I have solved the problem: Add this code before starting to connect to the device:
private DiscoveryManager mDiscoveryManager;
mDiscoveryManager = DiscoveryManager.getInstance(); mDiscoveryManager.registerDefaultDeviceTypes(); mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON); DiscoveryManager.getInstance().start();
this didn't work for me I have a Sony bravia TV
I have solved the problem: Add this code before starting to connect to the device: private DiscoveryManager mDiscoveryManager; mDiscoveryManager = DiscoveryManager.getInstance(); mDiscoveryManager.registerDefaultDeviceTypes(); mDiscoveryManager.setPairingLevel(DiscoveryManager.PairingLevel.ON); DiscoveryManager.getInstance().start();
this didn't work for me I have a Sony bravia TV
Didn't work for me either on Samsung TV.
I'm using this sample to connect to a TV, Firstly its not pairing via Code, Secondly, on direct connection to Tv it not accessing all the capabilities, It is only accessing VolumeKey and MediaContol keys, all other's are disabled. How get access for number key controls and KeyCotrols interface and PowerControl.