1
1
package de .cmtjk .linkupconnect ;
2
2
3
+ import android .Manifest ;
3
4
import android .content .BroadcastReceiver ;
4
5
import android .content .Context ;
5
6
import android .content .Intent ;
6
7
import android .content .IntentFilter ;
7
8
import android .content .SharedPreferences ;
9
+ import android .os .Build ;
8
10
import android .os .Bundle ;
9
11
import android .widget .Button ;
10
12
import android .widget .CheckBox ;
13
15
14
16
import androidx .appcompat .app .AlertDialog ;
15
17
import androidx .appcompat .app .AppCompatActivity ;
18
+ import androidx .core .app .ActivityCompat ;
16
19
import androidx .localbroadcastmanager .content .LocalBroadcastManager ;
17
20
18
21
import com .google .android .material .switchmaterial .SwitchMaterial ;
@@ -29,6 +32,14 @@ protected void onCreate(Bundle savedInstanceState) {
29
32
30
33
findViewById (R .id .notification_enabled ).setEnabled (false );
31
34
35
+ if (Build .VERSION .SDK_INT > 32 ) {
36
+ if (!shouldShowRequestPermissionRationale ("112" )) {
37
+ ActivityCompat .requestPermissions (this ,
38
+ new String []{Manifest .permission .POST_NOTIFICATIONS },
39
+ 112 );
40
+ }
41
+ }
42
+
32
43
SharedPreferences preferences = getSharedPreferences ("LinkUpConnect" , MODE_PRIVATE );
33
44
34
45
fillInputFieldsWith (preferences );
@@ -50,7 +61,8 @@ private void configureXDripCheckBox() {
50
61
AlertDialog .Builder builder = new AlertDialog .Builder (this );
51
62
builder .setTitle ("ℹ️ Information" )
52
63
.setMessage ("Choose 'Libre2 (patched App)' as source in xDrip." )
53
- .setPositiveButton ("Ok" , (dialog , id ) -> {});
64
+ .setPositiveButton ("Ok" , (dialog , id ) -> {
65
+ });
54
66
AlertDialog dialog = builder .create ();
55
67
dialog .show ();
56
68
}
@@ -168,6 +180,7 @@ public void onReceive(Context context, Intent intent) {
168
180
}
169
181
170
182
}
183
+
171
184
private boolean debugEnabled () {
172
185
return ((CheckBox ) findViewById (R .id .debug )).isChecked ();
173
186
}
@@ -187,7 +200,8 @@ private void showAlert(String message) {
187
200
AlertDialog .Builder builder = new AlertDialog .Builder (this );
188
201
builder .setTitle ("ℹ️ Information" )
189
202
.setMessage (message )
190
- .setPositiveButton ("Ok" , (dialog , id ) -> {});
203
+ .setPositiveButton ("Ok" , (dialog , id ) -> {
204
+ });
191
205
AlertDialog dialog = builder .create ();
192
206
dialog .show ();
193
207
}
0 commit comments