2017-07-28 70 views
1

我試圖擴大我的應用程序,使其在電視上可用。我做了,因爲他們本指南Getting Started with TV Apps如何將移動應用程序擴展到電視應用程序(android)?

在說這是我的清單

<uses-feature 
    android:name="android.software.leanback" 
    android:required="false" /> 
<uses-feature 
    android:name="android.hardware.touchscreen" 
    android:required="false" /> 


<application 
    android:name=".NetworkAccess.MyApplication" 
    android:allowBackup="true" 
    android:banner="@drawable/banner" 
    android:icon="@mipmap/ic_launcher" 
    android:label="Amazon Codes" 
    android:roundIcon="@mipmap/ic_launcher_round" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

    <activity 
     android:name=".StartActivity" 
     android:theme="@style/Theme.AppCompat.NoActionBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <activity android:name=".TvActivity" 
     android:label="@string/app_name" 
     android:configChanges="keyboard|keyboardHidden|navigation" 
     android:theme="@style/Theme.Leanback" 
     android:logo="@drawable/banner" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

我也res我在其中創建佈局TvActivity添加的文件夾layout-w960dp。但是當我在商店更新我的應用程序時,它仍然不適用於電視。

我的錯誤是什麼?

+0

你檢查[TV應用質量(https://developer.android.com/develop/quality-guidelines /tv-app-quality.html)由Google指導?我不知道是否有必要,但「只有滿足以下質量標準的應用才能在Google Play上成爲Android TV應用。」 –

回答

1

您必須在Android TV的項目中創建一個新模塊。 同樣是穿。

enter image description here

0

你必須創建一個新的模塊,我的朋友。 你的項目結構應該是這樣的:

Project Structure

正如你看到我有一個核心模塊了。在覈心中,您可以放置​​兩個模塊之間共享的所有代碼(通常爲utils,常量,網絡等)。

之後,你應該settings.gradle有這樣規定的新模塊:

include ':app', ':core', "tv" 
+0

包名稱怎麼樣?它在商店中的外觀如何?會有2個不同的應用程序? –

+0

[在電視上分發](https://developer.android.com/distribute/best-practices/launch/distribute-tv.html) 切換到Developer Console中的高級模式以查看電視選項。 您可以使用相同的軟件包名稱。 基本上你會有兩個apks提交給商店,每一個可用的設備支持。 Android TV設備可以看到電視節目,而另一臺則可以看到移動設備。 –

+0

它可以這樣做,使商店將看到一個apk,但這個apk可以用於電視和手機? –

相關問題