Skip to content

Commit

Permalink
service should now reconnect after outdated server cert has been rene…
Browse files Browse the repository at this point in the history
…wed (within ~30h)
  • Loading branch information
mehrvarz committed Nov 11, 2022
1 parent 4d82049 commit edf7a0a
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/main/java/timur/webcall/callee/WebCallService.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import android.app.NotificationChannel;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.provider.MediaStore;
import android.provider.Settings;
import android.media.RingtoneManager;
Expand Down Expand Up @@ -480,7 +481,7 @@ public void run() {
// this intent is coming from the started activity
Log.d(TAG, "serviceCmdReceiver dismissNotification "+message);

// we can close the notification by sending a new not-high-priority notification
// we can later close this notification by sending a new not-high priority notification
updateNotification("","Incoming WebCall",false);
return;
}
Expand Down Expand Up @@ -2525,6 +2526,7 @@ public void onMessage(String message) {
.setSmallIcon(R.mipmap.notification_icon)
.setContentTitle("Incoming WebCall")
.setCategory(NotificationCompat.CATEGORY_CALL)
//.setLights(0xff00ff00, 300, 100) // TODO does not seem to work on N7

// on O+ setPriority is ignored in favor of NOTIF_CHANNEL_ID_HIGH
.setPriority(NotificationCompat.PRIORITY_HIGH)
Expand Down Expand Up @@ -4404,6 +4406,15 @@ private void updateNotification(String title, String msg, boolean important) {
NotificationManager notificationManager =
(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = buildFgServiceNotification(title, msg, important);
/*
if(msg.equals("Incoming WebCall")) {
Log.d(TAG,"updateNotification 'Incoming WebCall' setLights");
notification.ledARGB = Color.argb(255, 0, 255, 0);
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledOnMS = 200;
notification.ledOffMS = 300;
}
*/
notificationManager.notify(NOTIF_ID, notification);
}
}
Expand All @@ -4424,13 +4435,30 @@ private Notification buildFgServiceNotification(String title, String msg, boolea
if(msg.equals("")) {
msg = "Offline";
}
/*
return new NotificationCompat.Builder(this, notifChannel)
.setContentTitle(title) // 1st line showing in top-bar
.setContentText(msg) // 2nd line showing in top-bar
.setSmallIcon(R.mipmap.notification_icon)
.setDefaults(0)
.setContentIntent(pendingIntent)
.build();
*/
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this, notifChannel)
.setContentTitle(title) // 1st line showing in top-bar
.setContentText(msg) // 2nd line showing in top-bar
.setSmallIcon(R.mipmap.notification_icon)
//.setDefaults(0)
.setContentIntent(pendingIntent);
/*
if(msg.equals("Incoming WebCall")) {
Log.d(TAG,"buildFgServiceNotification 'Incoming WebCall' setLights");
notificationBuilder.setLights(0xff00ff00, 300, 100);
notificationBuilder.setPriority(Notification.PRIORITY_MAX);
}
*/
return notificationBuilder.build();
}
return null;
}
Expand Down

0 comments on commit edf7a0a

Please sign in to comment.