Skip to content

Commit 26b4046

Browse files
authored
Merge pull request #21 from SmartDeviceLink-Examples/bugfix/issue_18
Fix bug with ErrorUpdate Intent causing a crash
2 parents db03b74 + aaf5b80 commit 26b4046

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

MobileWeather/app/src/main/java/com/sdl/mobileweather/smartdevicelink/SdlService.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,15 @@ public void onReceive(Context context, Intent intent) {
449449

450450
@Override
451451
public void onReceive(Context context, Intent intent) {
452-
if (mDataManager != null) {
453-
if (mDataManager.isInErrorState()) {
454-
writeDisplay(false);
452+
if(sdlManager != null && (sdlManager.getState() == BaseSubManager.READY || sdlManager.getState() == BaseSubManager.LIMITED)) {
453+
if (mDataManager != null) {
454+
if (mDataManager.isInErrorState()) {
455+
writeDisplay(false);
455456

456-
} else {
457-
resetFirstErrorFlags();
458-
writeDisplay(false);
457+
} else {
458+
resetFirstErrorFlags();
459+
writeDisplay(false);
460+
}
459461
}
460462
}
461463
}
@@ -472,7 +474,7 @@ public void onCreate() {
472474
lbManager.registerReceiver(mAlertsReceiver, new IntentFilter("com.sdl.mobileweather.Alerts"));
473475
lbManager.registerReceiver(mForecastReceiver, new IntentFilter("com.sdl.mobileweather.Forecast"));
474476
lbManager.registerReceiver(mHourlyForecastReceiver, new IntentFilter("com.sdl.mobileweather.HourlyForecast"));
475-
lbManager.registerReceiver(mErrorReceiver, new IntentFilter("com.ford.mobileweather.ErrorUpdate"));
477+
lbManager.registerReceiver(mErrorReceiver, new IntentFilter("com.sdl.mobileweather.ErrorUpdate"));
476478

477479
SoftButtonState mShowConditionsState = new SoftButtonState("mShowConditionsState", getResources().getString(R.string.sb1), null);
478480
mShowConditions = new SoftButtonObject("mShowConditions", Collections.singletonList(mShowConditionsState), mShowConditionsState.getName(), new SoftButtonObject.OnEventListener() {
@@ -818,6 +820,11 @@ public void onError(String info, Exception e) {
818820
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language) {
819821
return null;
820822
}
823+
824+
@Override
825+
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
826+
return null;
827+
}
821828
};
822829

823830
// Create App Icon, this is set in the SdlManager builder

0 commit comments

Comments
 (0)