Have a problem where because I don't have a local device, there is a potential scenario where no devices are discovered, and the list of speaker selections is totally empty, including local devices. The user can't select anything, and the Android back doesn't close down the dialog.
The app has to be forced closed. Can't seem to work out how I can catch this back button press and close it down.
I do see this in the logs:
But these are genrated by the SDK library.
Hi Pinball Wizard,
Are you initializiing with
public void init(final String applicationName, final boolean haveLocalPlayer, final Context context)
If haveLocalPlayer is set to false, then no local device will be shown in the list adapter, and back press is disabled because for AllPlay Radio, we wanted the users to select an AllPlay player before continuing.
I can only think of calling
public static AllPlayDeviceDialog getInstance(Context context), then call dismiss() or cancel().
This will return you the existing dialog, or a new dialog, but since you just want to dismiss and not show it, calling dismiss/cancel will trigger the internal onDismissListener to clear everything.
So,
AllPlayDeviceDialog dialog = AllPlayDeviceDialog.getInstance(getApplicationContext());
dialog.dismiss();
I hope this helps.
Thanks
Daniel
The problem is, if there is no local device (which in my case, there isn't), and there are no allplay speakers found either, the empty list means you are stuck there forever, with no path forward, nor no path backwards.
Hi Pinball Wizard,
I am sorry for making the wrong suggestion, obviously AllPlayDeviceDialog is not a public class :(
I just quickly tried AllPlay Radio and see how they handle this situation. It seems they are listening to the callback
onAllPlayAvailabilityChanged(boolean available). When this callback hits, and available == false, then SDK no longer detects any AllPlay players. In this case, AllPlay Radio brings up a dialog asking users to check for their AllPlay players. When AllPlay Radio app was designed, the decision was made to make sure user always selects an AllPlay player before/during using the app. The SDK without local device flow was designed this way, and turned overloaded onBackPressed on the dialog to do nothing :(
This is obviously different in your app, as you may not need to force user to select an AllPlay player until it is necessary. Until I can convince the team to always enable onBackPressed no matter what mode, I may have a possible solution, but it is not pretty :(
Have a reference to the public AllPlayButtonView object that gets created in your fragment or activity, and when onAllPlayAvailableChanged give available == false, you can either disable the AllPlayButtonView object to prevent users from pressing the button, or extends AllPlayButtonView so you can overload the onClick method to pop your own dialog to let users know they need an AllPlay player. For dismissing the dialog, there is a private variable in AllPlayButtonView, and it is AllPlayDeviceDialog "mPlayersListDialog", if available == false, you can "access" the private variable via Reflection and dismiss the dialog for the user. getNumberOfAvailableAllPlayPlayers() in AllPlayController may also be helpful to check.
http://stackoverflow.com/questions/11483647/how-to-access-private-method...
Please let me know if this solution may work.
Thanks
Daniel