Merge branch 'bug_fixes' into develop
This commit is contained in:
commit
7ac320094e
|
@ -89,10 +89,7 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||||
if( !notify ){
|
|
||||||
stopSelf();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
channel = new NotificationChannel(CHANNEL_ID,
|
channel = new NotificationChannel(CHANNEL_ID,
|
||||||
"Live notifications",
|
"Live notifications",
|
||||||
|
@ -100,6 +97,7 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
|
|
||||||
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||||
List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction();
|
List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction();
|
||||||
totalAccount = 0;
|
totalAccount = 0;
|
||||||
|
@ -128,6 +126,10 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
|
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
|
||||||
|
|
||||||
startForeground(1, notification);
|
startForeground(1, notification);
|
||||||
|
if( !notify ){
|
||||||
|
stopSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (totalAccount > 0) {
|
if (totalAccount > 0) {
|
||||||
startStream();
|
startStream();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -105,10 +105,6 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true);
|
||||||
if( !notify ){
|
|
||||||
stopSelf();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
networkStateReceiver = new NetworkStateReceiver();
|
networkStateReceiver = new NetworkStateReceiver();
|
||||||
networkStateReceiver.addListener(this);
|
networkStateReceiver.addListener(this);
|
||||||
registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION));
|
registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION));
|
||||||
|
@ -147,6 +143,10 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
||||||
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
|
.setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build();
|
||||||
|
|
||||||
startForeground(1, notification);
|
startForeground(1, notification);
|
||||||
|
if( !notify ){
|
||||||
|
stopSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (totalAccount == 0) {
|
if (totalAccount == 0) {
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue