android tv get started

Download Android tv get started

Post on 15-Jul-2015

801 views

Category:

Technology

1 download

Embed Size (px)

TRANSCRIPT

Android TV Ascii @ KKBOX

ADT-1Nexus Player

Android TV SDKandroid { compileSdkVersion 21 buildToolsVersion "21.1.1"

defaultConfig { minSdkVersion 21 targetSdkVersion 21 }}dependencies { compile 'com.android.support:leanback-v17:21.0.2'}

compileSdkVersion VS buildToolsVersion

Nexus Player Controller

Resolution

Add TV Support 1

Add TV Support 2

Common ErrorsSDK Level (min 17)Launch default Activity (Android Studio bug)Unnecessary Resources (for mobile module)uses-feature android:required="true" (false)Leanback LibraryBrowseFragmentSearchFragmentDetailFragmentPlayFragmenBrowseFragmentpublic ListRow(HeaderItem header, ObjectAdapter adapter)

setBadgeDrawable(/*res*/);DetailFragmentDetailsOverviewRow.setAction(new Action(long id, CharSequence label))

OnActionClickedListener.onActionClicked(Action action)

if (action.getId() == OPEN)else if (action.getId() == UNIN)else if (action.getId() == UPD)Create recommendations

if (intent.getAction().endsWith(Intent.ACTION_BOOT_COMPLETED)) { // startService(/* IntentService */) or getService(/* IntentService */)}Create recommendationspublic class RecommendationsService extends IntentService { @Override protected void onHandleIntent(Intent intent) { NotificationManager mNotificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);

Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder()).build();

mNotificationManager.notify(count, notification); }}ReferenceDesign guidelinehttp://developer.android.com/design/tv/index.html

TV App Qualityhttp://developer.android.com/distribute/essentials/quality/tv.html

Publishing processhttp://developer.android.com/distribute/googleplay/tv.html

Using the Leanback libraryhttps://github.com/googlesamples/androidtv-Leanbackhttps://www.youtube.com/watch?v=72K1VhjoL98