Android: More robust check for whether to sync channels

This changes channel syncing to happen when the operating system is
Android TV rather than when TvMainActivity is launched. (You can run
TvMainActivity on a phone by specifying a launch activity manually
in Android Studio, which I do sometimes for testing purposes. Without
this change, you get an exception when channel syncing runs.)
This commit is contained in:
JosJuice 2020-02-01 22:07:29 +01:00
parent f8f9dbdec3
commit 64953bb63a
2 changed files with 4 additions and 2 deletions

View File

@ -59,8 +59,6 @@ public final class TvMainActivity extends FragmentActivity implements MainView
{
StartupHandler.HandleInit(this);
}
// Setup and/or sync channels
TvUtil.scheduleSyncingChannel(getApplicationContext());
}
@Override

View File

@ -27,6 +27,10 @@ public final class StartupHandler
// Ask the user if he wants to enable analytics if we haven't yet.
Analytics.checkAnalyticsInit(parent);
// Set up and/or sync Android TV channels
if (TvUtil.isLeanback(parent))
TvUtil.scheduleSyncingChannel(parent);
String[] start_files = null;
Bundle extras = parent.getIntent().getExtras();
if (extras != null)