@@ -151,27 +151,30 @@ public int onStartCommand(Intent intent, int flags, int startId) {
151
151
Logger .d ("action: %s" , intent .getAction ());
152
152
Logger .d ("scan type: %s" , intent .getStringExtra (VoiceControlForPlexApplication .Intent .SCAN_TYPE ));
153
153
if (intent .getAction () != null && intent .getAction ().equals (VoiceControlForPlexApplication .Intent .GDMRECEIVE )) {
154
- if (intent .getStringExtra (VoiceControlForPlexApplication .Intent .SCAN_TYPE ).equals (VoiceControlForPlexApplication .Intent .SCAN_TYPE_SERVER )) {
155
- // We just scanned for servers and are returning from that, so set the servers we found
156
- // and then figure out which mClient to play to
157
- Logger .d ("Got back from scanning for servers." );
158
- videoPlayed = false ;
159
- plexmediaServers = VoiceControlForPlexApplication .servers ;
160
- didServerScan = true ;
161
- setClient ();
162
- } else if (intent .getStringExtra (VoiceControlForPlexApplication .Intent .SCAN_TYPE ).equals (VoiceControlForPlexApplication .Intent .SCAN_TYPE_CLIENT )) {
163
- // Got back from mClient scan, so set didClientScan to true so we don't do this again, and save the clients we got, then continue
164
- didClientScan = true ;
165
- ArrayList <PlexClient > cs = intent .getParcelableArrayListExtra (VoiceControlForPlexApplication .Intent .EXTRA_CLIENTS );
166
- if (cs != null ) {
167
- VoiceControlForPlexApplication .clients = new HashMap <String , PlexClient >();
168
- for (PlexClient c : cs ) {
169
- VoiceControlForPlexApplication .clients .put (c .name , c );
170
- }
171
- clients = (HashMap ) VoiceControlForPlexApplication .clients ;
172
- clients .putAll (VoiceControlForPlexApplication .castClients );
173
- }
174
- startup ();
154
+ Class receivedClass = (Class )intent .getSerializableExtra (VoiceControlForPlexApplication .Intent .EXTRA_CLASS );
155
+ if (receivedClass == PlexSearchService .class ) {
156
+ if (intent .getStringExtra (VoiceControlForPlexApplication .Intent .SCAN_TYPE ).equals (VoiceControlForPlexApplication .Intent .SCAN_TYPE_SERVER )) {
157
+ // We just scanned for servers and are returning from that, so set the servers we found
158
+ // and then figure out which mClient to play to
159
+ Logger .d ("Got back from scanning for servers." );
160
+ videoPlayed = false ;
161
+ plexmediaServers = VoiceControlForPlexApplication .servers ;
162
+ didServerScan = true ;
163
+ setClient ();
164
+ } else if (intent .getStringExtra (VoiceControlForPlexApplication .Intent .SCAN_TYPE ).equals (VoiceControlForPlexApplication .Intent .SCAN_TYPE_CLIENT )) {
165
+ // Got back from mClient scan, so set didClientScan to true so we don't do this again, and save the clients we got, then continue
166
+ didClientScan = true ;
167
+ ArrayList <PlexClient > cs = intent .getParcelableArrayListExtra (VoiceControlForPlexApplication .Intent .EXTRA_CLIENTS );
168
+ if (cs != null ) {
169
+ VoiceControlForPlexApplication .clients = new HashMap <String , PlexClient >();
170
+ for (PlexClient c : cs ) {
171
+ VoiceControlForPlexApplication .clients .put (c .name , c );
172
+ }
173
+ clients = (HashMap ) VoiceControlForPlexApplication .clients ;
174
+ clients .putAll (VoiceControlForPlexApplication .castClients );
175
+ }
176
+ startup ();
177
+ }
175
178
}
176
179
} else {
177
180
queryText = null ;
0 commit comments