aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-02-17 08:29:41 -0800
committerScott Jackson <daneren2005@gmail.com>2015-02-17 08:29:41 -0800
commit46f1bef7a8b729699e60e85217e91c4c20dfb7a3 (patch)
treef75df1b659c039a67dd4758f9bff1e603373549b /src/github
parentf423a040672044c667555870605490c28a0e1229 (diff)
downloaddsub-46f1bef7a8b729699e60e85217e91c4c20dfb7a3.tar.gz
dsub-46f1bef7a8b729699e60e85217e91c4c20dfb7a3.tar.bz2
dsub-46f1bef7a8b729699e60e85217e91c4c20dfb7a3.zip
Improve DLNA discovery proccess
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/provider/DLNARouteProvider.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
index 57785c0c..8d9c5f45 100644
--- a/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
+++ b/src/github/daneren2005/dsub/provider/DLNARouteProvider.java
@@ -70,6 +70,7 @@ public class DLNARouteProvider extends MediaRouteProvider {
private List<String> adding = new ArrayList<String>();
private AndroidUpnpService dlnaService;
private ServiceConnection dlnaServiceConnection;
+ private boolean searchOnConnect = false;
public DLNARouteProvider(Context context) {
super(context);
@@ -85,12 +86,12 @@ public class DLNARouteProvider extends MediaRouteProvider {
dlnaService.getRegistry().addListener(new RegistryListener() {
@Override
public void remoteDeviceDiscoveryStarted(Registry registry, RemoteDevice remoteDevice) {
- Log.i(TAG, "Stared DLNA discovery");
+
}
@Override
public void remoteDeviceDiscoveryFailed(Registry registry, RemoteDevice remoteDevice, Exception e) {
- Log.w(TAG, "Failed to discover DLNA devices");
+ // Error is displayed in log anyways under W/trieveRemoteDescriptors
}
@Override
@@ -132,7 +133,9 @@ public class DLNARouteProvider extends MediaRouteProvider {
for (Device<?, ?, ?> device : dlnaService.getControlPoint().getRegistry().getDevices()) {
deviceAdded(device);
}
- dlnaService.getControlPoint().search();
+ if(searchOnConnect) {
+ dlnaService.getControlPoint().search();
+ }
}
@Override
@@ -182,7 +185,11 @@ public class DLNARouteProvider extends MediaRouteProvider {
@Override
public void onDiscoveryRequestChanged(MediaRouteDiscoveryRequest request) {
if (request != null && request.isActiveScan()) {
- dlnaService.getControlPoint().search();
+ if(dlnaService != null) {
+ dlnaService.getControlPoint().search();
+ } else {
+ searchOnConnect = true;
+ }
}
}