mirror of
https://github.com/vernu/textbee.git
synced 2026-02-20 07:34:00 -05:00
chore(android): disable sticky notification
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user