catch missing sms permission

This commit is contained in:
Milos Kozak 2017-05-03 18:30:18 +02:00
parent 37edc19509
commit 573256d7d4
4 changed files with 8 additions and 1 deletions

View file

@ -23,7 +23,8 @@ public class Notification {
public static final int OLD_NSCLIENT = 8; public static final int OLD_NSCLIENT = 8;
public static final int INVALID_PHONE_NUMBER = 9; public static final int INVALID_PHONE_NUMBER = 9;
public static final int APPROACHING_DAILY_LIMIT = 10; public static final int APPROACHING_DAILY_LIMIT = 10;
public static final int NSCLIENT_NO_WRITE_PERMISSION = 10; public static final int NSCLIENT_NO_WRITE_PERMISSION = 11;
public static final int MISSING_SMS_PERMISSION = 12;
public int id; public int id;
public Date date; public Date date;

View file

@ -560,6 +560,9 @@ public class SmsCommunicatorPlugin implements PluginBase {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.sResources.getString(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL); Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.sResources.getString(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification)); MainApp.bus().post(new EventNewNotification(notification));
} catch (java.lang.SecurityException e) {
Notification notification = new Notification(Notification.MISSING_SMS_PERMISSION, MainApp.sResources.getString(R.string.smscommunicator_missingsmspermission), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
} }
} }

View file

@ -544,4 +544,6 @@
<string name="enablesuperbolus">Povolit superbolus</string> <string name="enablesuperbolus">Povolit superbolus</string>
<string name="enablesuperbolus_summary">Povolení superbolusu v kalkulátoru. Nepovolujte, dokud se nenaučíte, co to opravdu dělá. MŮŽE ZPŮSOBIT PŘEDÁVKOVÁNÍ INZULÍNEM PŘI NESPRÁVNÉM POUŽITÍ!</string> <string name="enablesuperbolus_summary">Povolení superbolusu v kalkulátoru. Nepovolujte, dokud se nenaučíte, co to opravdu dělá. MŮŽE ZPŮSOBIT PŘEDÁVKOVÁNÍ INZULÍNEM PŘI NESPRÁVNÉM POUŽITÍ!</string>
<string name="nav_about">O aplikaci</string> <string name="nav_about">O aplikaci</string>
<string name="nav_about">O aplikaci</string>
<string name="smscommunicator_missingsmspermission">Chybějící povolení SMS</string>
</resources> </resources>

View file

@ -598,4 +598,5 @@
<string name="virtualpump_lastconnection_label">Last connection</string> <string name="virtualpump_lastconnection_label">Last connection</string>
<string name="danar_bluetooth_status">Bluetooh status</string> <string name="danar_bluetooth_status">Bluetooh status</string>
<string name="nav_about">About</string> <string name="nav_about">About</string>
<string name="smscommunicator_missingsmspermission">Missing SMS permission</string>
</resources> </resources>