Tabnine Logo
Notification.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
javax.management.Notification
constructor

Best Java code snippets using javax.management.Notification.<init> (Showing top 20 results out of 1,260)

Refine searchRefine arrow

  • Notification.setLatestEventInfo
  • NotificationManager.notify
origin: stackoverflow.com

 NotificationManager notificationManager =
  (NotificationManager) getSystemService(Service.NOTIFICATION_SERVICE);
Notification notification = new Notification(/* your notification */);
PendingIntent pendingIntent = /* your intent */;
notification.setLatestEventInfo(this, /* your content */, pendingIntent);
notificationManager.notify(/* id */, notification);
origin: stackoverflow.com

Notification notification = new Notification(icon, "Custom Notification", when);
mNotificationManager.notify(1, notification);
origin: stackoverflow.com

Notification ntf = new Notification();
ntf.setLatestEventInfo(this, COLOR_SEARCH_RECURSE_TIP, "Utest", null);
LinearLayout group = new LinearLayout(this);
ViewGroup event = (ViewGroup) ntf.contentView.apply(this, group);
origin: stackoverflow.com

 /**
 * Issues a notification to inform the user that server has sent a message.
 */
private void generateNotification(String text) {

  int icon = R.drawable.notifiaction_icon;
  long when = System.currentTimeMillis();
  NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification = new Notification(icon, text, when);
  String title = context.getString(R.string.app_name);
  Intent notificationIntent = new Intent(context, MainActivity.class);

  // set intent so it does not start a new activity
  //notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
  PendingIntent intent = PendingIntent.getActivity(context, MY_ID, notificationIntent, 0);
  notification.setLatestEventInfo(context, title, text, intent);

  notification.flags |= Notification.FLAG_AUTO_CANCEL; //PendingIntent.FLAG_ONE_SHOT

  notificationManager.notify(MY_ID, notification);
}
origin: stackoverflow.com

 private void RedFlashLight()
{
  NotificationManager nm = ( NotificationManager ) getSystemService( NOTIFICATION_SERVICE );
  Notification notif = new Notification();
  notif.ledARGB = 0xFFff0000;
  notif.flags = Notification.FLAG_SHOW_LIGHTS;
  notif.ledOnMS = 100; 
  notif.ledOffMS = 100; 
  nm.notify(LED_NOTIFICATION_ID, notif);
}
origin: stackoverflow.com

int icon = R.drawable.notification_icon;        // icon from resources  
 CharSequence tickerText = "Hello";              // ticker-text  
 long when = System.currentTimeMillis();         // notification time  
 Context context = getApplicationContext();      // application Context  
 CharSequence contentTitle = "My notification";  // expanded message title  
 CharSequence contentText = "Hello World!";      // expanded message text  
 Intent notificationIntent = new Intent(this, MyClass.class);  
 PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);  
 // the next two lines initialize the Notification, using the configurations above  
 Notification notification = new Notification(icon, tickerText, when);  
 notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
origin: stackoverflow.com

long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText,
    contentIntent);
notification.defaults |= Notification.DEFAULT_SOUND;
mNotificationManager.notify(1234, notification);
origin: stackoverflow.com

 NotificationManager mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(...);
...
mManager.notify(0, notification);
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "TAG");
wl.acquire(15000);
origin: stackoverflow.com

 int icon = R.drawable.ic_launcher;
CharSequence tickerText = "Reminder Created";
long when = System.currentTimeMillis();
Context context = getApplicationContext();
CharSequence contentTitle = mTitle.getText().toString();
CharSequence contentText = mContent.getText().toString();
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);


final Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);


String ns = Context.NOTIFICATION_SERVICE;
final NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
origin: stackoverflow.com

Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, SnapClientActivity.class);
notification.setLatestEventInfo(context, title, message, intent);
notification.vibrate = new long[] { 500, 500 };
notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  Notification.FLAG_SHOW_LIGHTS;
notificationManager.notify(0, notification);
origin: stackoverflow.com

private void RedFlashLight()
 {
 NotificationManager nm = ( NotificationManager ) getSystemService( NOTIFICATION_SERVICE );
 Notification notif = new Notification();
 notif.ledARGB = 0xFFff0000;
 notif.flags = Notification.FLAG_SHOW_LIGHTS;
 notif.ledOnMS = 100; 
 notif.ledOffMS = 100; 
 nm.notify(LED_NOTIFICATION_ID, notif);
 }
origin: stackoverflow.com

 // this code brings the application from background to foreground  
// when the Notification icon is clicked on.

// create new notification
int icon = R.drawable.ic_notify;
Notification notification = new Notification(icon, "Ticker Text", System.currentTimeMillis());

//  Create new Intent pointing to activity you want it to come back to
Intent notificationIntent = new Intent(this, MainApp.class);

// Add new intent to a pending intent
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// add that pendingIntent to the new notification
notification.setLatestEventInfo(getApplicationContext(), "Title", "Text", contentIntent);

// send the intent to the NotificationManager
((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE)).notify(UPLOADER_ID, notification);
origin: stackoverflow.com

 int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
NotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent=new Intent(context,MainActivity.class);
PendingIntent  pending=PendingIntent.getActivity(context, 0, intent, 0);
Notification notification;
  if (Build.VERSION.SDK_INT < 11) {
    notification = new Notification(icon, "Title", when);
    notification.setLatestEventInfo(
        context,
        "Title",
        "Text",
        pending);
  } else {
    notification = new Notification.Builder(context)
        .setContentTitle("Title")
        .setContentText(
            "Text").setSmallIcon(R.drawable.ic_launcher)
        .setContentIntent(pending).setWhen(when).setAutoCancel(true)
        .build();
  }
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
nm.notify(0, notification);
origin: stackoverflow.com

 private void RedFlashLight()
{
  NotificationManager nm = ( NotificationManager ) getSystemService( NOTIFICATION_SERVICE );
  Notification notif = new Notification();
  notif.defaults = 0;
  notif.ledARGB = 0xFFff0000;
  notif.flags = Notification.FLAG_SHOW_LIGHTS;
  notif.ledOnMS = 100; 
  notif.ledOffMS = 100; 
  nm.notify(LED_NOTIFICATION_ID, notif);
}
origin: stackoverflow.com

int icon = R.drawable.alerte;
   CharSequence tickerText = getString(R.string.lieuproche);
   long when = System.currentTimeMillis();
   Notification notification = new Notification(icon, tickerText, when);
   Intent intent = new Intent(getApplicationContext(),
       ActivityToLaunch.class);
   notification.setLatestEventInfo(
       MainActivity.this,
       "title",
       "action", PendingIntent.getActivity(
           this.getBaseContext(), 0, intent,
           PendingIntent.FLAG_CANCEL_CURRENT));
   notification.flags |= Notification.FLAG_AUTO_CANCEL;
   notification.defaults |= Notification.DEFAULT_SOUND;
   notification.defaults |= Notification.DEFAULT_LIGHTS;
   notificationManager.notify(0, notification);
origin: stackoverflow.com

 NotificationManager notificationManager =
  (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(/* your notification */);
PendingIntent pendingIntent = /* your intent */;
notification.setLatestEventInfo(this, /* your content */, pendingIntent);
notificationManager.notify(/* id */, notification);
origin: stackoverflow.com

 NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification();         
notification.sound = Uri.parse("android.resource://com.your.package/raw/sound_file");
nm.notify(0, notification);
origin: stackoverflow.com

 notificationManager = (NotificationManager) 
  getSystemService(Context.NOTIFICATION_SERVICE);



int icon = R.drawable.youricon;
  CharSequence tickerText = "Sticky notification";
  long when = System.currentTimeMillis();

  Notification notification = new Notification(icon, tickerText, when);

  Context context = getApplicationContext();
  CharSequence contentTitle = "Sticky notification";
  CharSequence contentText = "...click here and it wont go away...";
  Intent notificationIntent = new Intent(this, mainmenu.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
      | Intent.FLAG_ACTIVITY_SINGLE_TOP);
  PendingIntent contentIntent = PendingIntent.getActivity(this, 
    0, notificationIntent, 0);

  notification.setLatestEventInfo(context, contentTitle, 
    contentText, contentIntent);
  notification.flags |= Notification.FLAG_ONGOING_EVENT;

  notificationManager.notify(NOTIFICATION_EX, notification);
origin: stackoverflow.com

 NotificationManager nm = (NotificationManager) getSystemService(context.NOTIFICATION_SERVICE);
Notification notification = new Notification();
notification.flag = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR;

Intent nIntent = new Intent();
nIntent = getPreviousIntent();

PendingIntent pi = PendingIntent.getActivity(this, 0, nIntent, 0);
notification.setLatestEventInfo(getContext(), "some Title", "some text", pi);
nm.notify(0,notification);
origin: stackoverflow.com

 @Override
public void onReceive(Context context, Intent intent) {
  NotificationManager nm = (NotificationManager);
  context.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notification = new Notification();
  notification.tickerText = "10 Minutes past";
  nm.notify(0, notification);
}
javax.managementNotification<init>

Popular methods of Notification

  • getType
  • getUserData
  • setUserData
  • getMessage
  • getSource
  • getTimeStamp
  • getSequenceNumber
  • setSource
  • toString
  • setSequenceNumber
  • getAttachments
  • getClass
  • getAttachments,
  • getClass,
  • getFlag,
  • getIntent,
  • getTitle,
  • setCreatedd_time,
  • setId,
  • setLatestEventInfo,
  • setLink

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • ImageIO (javax.imageio)
  • BoxLayout (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now