Logging improved

This commit is contained in:
Aleksander Nowakowski 2017-11-17 15:50:46 +01:00
parent 2a3eac37c5
commit c8abe84a82
1 changed files with 5 additions and 1 deletions

View File

@ -839,8 +839,8 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
public void onCreate() {
super.onCreate();
Log.i(TAG, "DFU version: " + BuildConfig.VERSION_NAME);
DEBUG = isDebug();
logi("DFU service created. Version: " + BuildConfig.VERSION_NAME);
initialize();
final LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this);
@ -932,6 +932,10 @@ public abstract class DfuBaseService extends IntentService implements DfuProgres
// This would eventually crash later...
throw new NullPointerException("getNotificationTarget() must not return null if notifications are enabled");
}
if (!foregroundService && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
logw("Foreground service disabled. Android Oreo or newer may kill a background service few moments after user closes the application.\n" +
"Consider enabling foreground service using DfuServiceInitiator#setForeground(boolean)");
}
UuidHelper.assignCustomUuids(intent);
mDeviceAddress = deviceAddress;