mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1208587 - SUTAgent: Replace deprecated Notification APIs with Notification.Builder. r=mcomella
--HG-- extra : commitid : Bdpz74Cg3YE extra : rebase_source : 20d826131ad64252df53b16392d08d0be60f7c19
This commit is contained in:
parent
00ecc8cd66
commit
45525f962d
@ -915,20 +915,24 @@ public class DoCommand {
|
||||
int icon = R.drawable.ateamlogo;
|
||||
long when = System.currentTimeMillis();
|
||||
|
||||
Notification notification = new Notification(icon, tickerText, when);
|
||||
|
||||
notification.flags |= (Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL);
|
||||
notification.defaults |= Notification.DEFAULT_SOUND;
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
notification.defaults |= Notification.DEFAULT_LIGHTS;
|
||||
|
||||
Context context = contextWrapper.getApplicationContext();
|
||||
|
||||
// Intent to launch an activity when the extended text is clicked
|
||||
Intent intent2 = new Intent(contextWrapper, SUTAgentAndroid.class);
|
||||
PendingIntent launchIntent = PendingIntent.getActivity(context, 0, intent2, 0);
|
||||
|
||||
notification.setLatestEventInfo(context, tickerText, expandedText, launchIntent);
|
||||
Notification notification = new Notification.Builder(context)
|
||||
.setContentTitle(tickerText)
|
||||
.setContentText(expandedText)
|
||||
.setSmallIcon(icon)
|
||||
.setWhen(when)
|
||||
.setContentIntent(launchIntent)
|
||||
.build();
|
||||
|
||||
notification.flags |= (Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL);
|
||||
notification.defaults |= Notification.DEFAULT_SOUND;
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
notification.defaults |= Notification.DEFAULT_LIGHTS;
|
||||
|
||||
notificationManager.notify(1959, notification);
|
||||
}
|
||||
|
@ -222,20 +222,25 @@ public class RunCmdThread extends Thread
|
||||
int icon = R.drawable.ateamlogo;
|
||||
long when = System.currentTimeMillis();
|
||||
|
||||
Notification notification = new Notification(icon, tickerText, when);
|
||||
|
||||
notification.flags |= (Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL);
|
||||
notification.defaults |= Notification.DEFAULT_SOUND;
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
notification.defaults |= Notification.DEFAULT_LIGHTS;
|
||||
|
||||
Context context = svc.getApplicationContext();
|
||||
|
||||
// Intent to launch an activity when the extended text is clicked
|
||||
Intent intent2 = new Intent(svc, SUTAgentAndroid.class);
|
||||
PendingIntent launchIntent = PendingIntent.getActivity(context, 0, intent2, 0);
|
||||
|
||||
notification.setLatestEventInfo(context, tickerText, expandedText, launchIntent);
|
||||
|
||||
Notification notification = new Notification.Builder(context)
|
||||
.setSmallIcon(icon)
|
||||
.setContentTitle(tickerText)
|
||||
.setContentText(expandedText)
|
||||
.setContentIntent(launchIntent)
|
||||
.setWhen(when)
|
||||
.build();
|
||||
|
||||
notification.flags |= (Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL);
|
||||
notification.defaults |= Notification.DEFAULT_SOUND;
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
notification.defaults |= Notification.DEFAULT_LIGHTS;
|
||||
|
||||
notificationManager.notify(1959, notification);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user