chore(android): disable sticky notification

This commit is contained in:
isra el
2024-04-20 14:27:18 +03:00
parent 2481180a57
commit dd4e9f8038
3 changed files with 17 additions and 17 deletions

View File

@@ -90,7 +90,7 @@ public class MainActivity extends AppCompatActivity {
grantSMSPermissionBtn.setOnClickListener(this::handleRequestPermissions);
}
TextBeeUtils.startStickyNotificationService(mContext);
// TextBeeUtils.startStickyNotificationService(mContext);
copyDeviceIdImgBtn.setOnClickListener(view -> {
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
@@ -125,11 +125,11 @@ public class MainActivity extends AppCompatActivity {
SharedPreferenceHelper.setSharedPreferenceBoolean(mContext, AppConstants.SHARED_PREFS_GATEWAY_ENABLED_KEY, isCheked);
boolean enabled = Boolean.TRUE.equals(Objects.requireNonNull(response.body()).data.get("enabled"));
compoundButton.setChecked(enabled);
if (enabled) {
TextBeeUtils.startStickyNotificationService(mContext);
} else {
TextBeeUtils.stopStickyNotificationService(mContext);
}
// if (enabled) {
// TextBeeUtils.startStickyNotificationService(mContext);
// } else {
// TextBeeUtils.stopStickyNotificationService(mContext);
// }
compoundButton.setEnabled(true);
}
@Override

View File

@@ -13,9 +13,9 @@ public class BootCompletedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
if(TextBeeUtils.isPermissionGranted(context, Manifest.permission.RECEIVE_SMS)){
TextBeeUtils.startStickyNotificationService(context);
}
// if(TextBeeUtils.isPermissionGranted(context, Manifest.permission.RECEIVE_SMS)){
// TextBeeUtils.startStickyNotificationService(context);
// }
}
}
}

View File

@@ -33,13 +33,13 @@ public class StickyNotificationService extends Service {
Log.i(TAG, "Service Started");
IntentFilter filter = new IntentFilter();
filter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION);
filter.addAction(android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED);
registerReceiver(receiver, filter);
Notification notification = createNotification();
startForeground(1, notification);
// IntentFilter filter = new IntentFilter();
// filter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION);
// filter.addAction(android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED);
// registerReceiver(receiver, filter);
//
// Notification notification = createNotification();
// startForeground(1, notification);
}
@@ -54,7 +54,7 @@ public class StickyNotificationService extends Service {
super.onDestroy();
// unregisterReceiver(receiver);
Log.i(TAG, "StickyNotificationService destroyed");
Toast.makeText(this, "Service destroyed", Toast.LENGTH_SHORT).show();
// Toast.makeText(this, "Service destroyed", Toast.LENGTH_SHORT).show();
}
private Notification createNotification() {