Qiscus Chat SDK (core) v1.4.4
Changelog :
- Prevent crash android.permission.SCHEDULE_EXACT_ALARM set false from user
Note:
- Please show the popup customer to enable SCHEDULE_EXACT_ALARM permission, because Qiscus Core SDK (Application) can't create a popup, only from activity can create the popup
- If SCHEDULE_EXACT_ALARM permission is set to false, new messages will be delayed (only from sync and PN for realtime new messages)
for example to show popup :
AlarmManager alarmMgr = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (!alarmMgr.canScheduleExactAlarms()) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle("Permission necessary");
alertBuilder.setMessage("Schedule Exact Alarm permission is necessary for realtime");
alertBuilder.setPositiveButton(android.R.string.yes, (dialog, which) -> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
Intent intent = new Intent(
ACTION_REQUEST_SCHEDULE_EXACT_ALARM,
Uri.parse("package:" + this.getPackageName())
);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.getApplicationContext().startActivity(intent);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
}
}