2014-04-03 98 views
0

突然有一半設備已停止找到我正在測試的Chromecast。我認爲這是我改變了的一些代碼,所以我決定做一個可以找到媒體路線的裸機。此實現只適用於我的東芝Thrive 4.0.4,但不適用於任何其他設備。我認爲這是我的網絡,所以我重置了路由器,當那個沒有工作時,我買了一個新的路由器,但也失敗了。我的同事們測試了這個apk,它可以在不同網絡上的設備上使用不同的chromecast。我的出廠重置了我的Chromecast並驗證了我的所有設備都使用了最新版本的Google Play服務。應用程序未找到Chromecast

public class CastTestActivity extends FragmentActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_cast_test); 

    MediaRouter mediaRouter = MediaRouter.getInstance(this); 
    MediaRouteSelector mediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(CastMediaControlIntent.categoryForCast("XXXXXXXX")).build(); 

    mediaRouter.addCallback(mediaRouteSelector, new MediaRouter.Callback() { 

     @Override 
     public void onRouteAdded(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteAdded(router, route); 
      Log.d("ROUTE_ADDED", String.valueOf(route)); 
     } 

     @Override 
     public void onRouteRemoved(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteRemoved(router, route); 
      Log.d("ROUTE_REMOVED", String.valueOf(route)); 
     } 
     @Override 
     public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteSelected(router, route); 
      Log.d("ROUTE_SELECTED", String.valueOf(route)); 

     } 

     @Override 
     public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteUnselected(router, route); 
      Log.d("ROUTE_UNSELECTED", String.valueOf(route)); 
     } 


     @Override 
     public void onRouteChanged(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteChanged(router, route); 
      Log.d("ROUTE_CHANGED", String.valueOf(route)); 
     } 

     @Override 
     public void onRouteVolumeChanged(MediaRouter router, MediaRouter.RouteInfo route) { 
      super.onRouteVolumeChanged(router, route); 
      Log.d("ROUTE_VOLUME", String.valueOf(route)); 
     } 

     @Override 
     public void onProviderAdded(MediaRouter router, MediaRouter.ProviderInfo provider) { 
      super.onProviderAdded(router, provider); 
      Log.d("ROUTE_PROVIDER_ADDED", String.valueOf(provider)); 
     } 

     @Override 
     public void onProviderRemoved(MediaRouter router, MediaRouter.ProviderInfo provider) { 
      super.onProviderRemoved(router, provider); 
      Log.d("ROUTE_PROVIDER_REMOVED", String.valueOf(provider)); 
     } 

     @Override 
     public void onProviderChanged(MediaRouter router, MediaRouter.ProviderInfo provider) { 
      super.onProviderChanged(router, provider); 
      Log.d("ROUTE_PROVIDER_CHANGED", String.valueOf(provider)); 
     } 
    }, MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN); 

    MediaRouteButton button = (MediaRouteButton) findViewById(R.id.media_route_button); 
    button.setRouteSelector(mediaRouteSelector); 

} 

}

dependencies { 
compile fileTree(dir: 'libs', include: '*.jar') 
compile 'com.android.support:appcompat-v7:19.0.+' 
compile 'com.android.support:mediarouter-v7:19.0.+' 
compile 'com.google.android.gms:play-services:4.2.+' 
... 

}

android { 

defaultConfig { 
    minSdkVersion 9 
    targetSdkVersion 19 
} 

compileSdkVersion 19 
buildToolsVersion "19.0.+" 

}從4.3的Nexus 7

<uses-sdk 
    android:minSdkVersion="9" 
    android:targetSdkVersion="19" /> 

日誌該發現沒有路由 https://gist.github.com/darussian/9957516

從4.0.4東芝

日誌茁壯成長找到路線 https://gist.github.com/darussian/9957547

這兩個日誌是一樣的APK。任何幫助是極大的讚賞。

回答

0

我提出的解決方案是Factory重置所有未找到Chromecast的設備。我假設某些內容在Google Play服務中緩存,無法解決緩存問題。由於重新安裝GMS不是一個選項,重新格式化是唯一的選擇。

相關問題