2013-04-21 47 views
0

我有一個小部件可以切換到tvout 我想通過「am start」命令手動啓動該小部件。 這在manifest.xml中:通過「am start」開始tvout

<?xml version="1.0" encoding="utf-8"?> 
<manifest android:versionCode="8" android:versionName="2.2.1" package="com.archos.tvoutwidget" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> 
<uses-feature android:name="android.hardware.tvout" /> 
<application android:label="@string/app_name" android:icon="@drawable/app_icon"> 
    <activity android:label="@string/app_name" android:name=".TvOutWidget" android:screenOrientation="landscape" android:configChanges="orientation" /> 
    <receiver android:label="@string/app_name" android:icon="@drawable/app_icon" android:name="TvOutWidgetProvider"> 
     <intent-filter> 
      <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> 
      <action android:name="archos.intent.action.ARCHOS_UPDATE_TVOUT_WIDGET" /> 
     </intent-filter> 
     <meta-data android:name="android.appwidget.provider" android:resource="@xml/tvout_widget_info" /> 
    </receiver> 
</application> 
</manifest> 

這可能嗎?

回答

0

是的,這是可能的。只需使用:

am start -n com.archos.tvoutwidget/.TvOutWidget 

您可以使用啓動任何應用程序:

am start -n package_name/activity_name 
+0

謝謝您的回答。在我輸入命令後,我可以在頂部看到一個帶有「LCD/TV顯示」的屏幕,僅此而已。但平板電腦無法切換到電視。我想要的是通過命令行手動啓動電視。這可能嗎 ? – user2304088 2013-04-22 13:57:37

+0

使用「adb logcat」獲取運行的logcat。然後手動打開電視輸出小部件,並做任何你想做的事情。同時,請關注logcat輸出並查看小部件啓動的包/活動。然後在你的命令行中使用它並打開小部件。 您可以做的另一件事是打開應用程序的主菜單,並嘗試使用關鍵事件來瀏覽它,以模擬unm/dowm箭頭導航並轉到所需的選項並選擇它。 – 2013-04-23 06:23:53

+0

再次感謝。這是我可以從logcat看到的小部件的唯一活動:I/ActivityManager(1286):開始活動:Intent {flg = 0x10000000 cmp = com.archos.tvoutwidget/.TvOutWidgetProvider}。如果我發送這個命令:「am start -n com.archos.tvoutwidget/.TvOutWidgetProvider」,我收到一個錯誤:「activity does not exist」。請幫幫我 – user2304088 2013-04-23 15:18:36