Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to access all capabilities and Pairing #52

Open
najam-amfnrh9 opened this issue Oct 18, 2023 · 11 comments
Open

Fails to access all capabilities and Pairing #52

najam-amfnrh9 opened this issue Oct 18, 2023 · 11 comments

Comments

@najam-amfnrh9
Copy link

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.

@hirovn97
Copy link

hirovn97 commented Dec 4, 2023

I had the same problem. Do you have a solution yet?

@hirovn97
Copy link

hirovn97 commented Dec 5, 2023

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();

@najam-amfnrh9
Copy link
Author

najam-amfnrh9 commented Dec 5, 2023

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

@hirovn97
Copy link

hirovn97 commented Dec 5, 2023

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);

@najam-amfnrh9
Copy link
Author

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.

@hirovn97
Copy link

hirovn97 commented Dec 5, 2023

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.

@hirovn97
Copy link

hirovn97 commented Dec 5, 2023

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

@najam-amfnrh9
Copy link
Author

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. :(

@zamirszn
Copy link

I have this issue too , was anyone able to find a solution

@zamirszn
Copy link

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

@Avasara
Copy link

Avasara commented Feb 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants