Package Com. eboy. testnotification;
ImportAndroid. App. activity;
ImportAndroid. App. notification;
ImportAndroid. App. icationicationmanager;
ImportAndroid. App. pendingintent;
ImportAndroid. content. context;
ImportAndroid. content. intent;
ImportAndroid.net. Uri;
ImportAndroid. OS. Bundle;
ImportAndroid. View. Menu;
ImportAndroid. View. view;
Public ClassMainactivityExtendsActivity {
Private Static FinalString edtshorttitle = "edtshorttitle ";
Private Static FinalString edttitle = "edttitle ";
Private Static FinalString edtcontent = "http://www.985dy.com ";
@ Override
Public Void Oncreate (bundle savedinstancestate ){
Super . Oncreate (savedinstancestate );
Setcontentview (R. layout. activity_main );
}
Public Void Sendnotification1 (view v ){
Int Icon = Android. R. drawable. stat_policy_error;
Notification = New Notification (icon, edtsung title, system. currenttimemillis ());
Intent intent = New Intent (intent. action_view, Uri. parse (edtcontent ));
Pendingintent = pendingintent. getactivity ( This , 0, intent, 0 );
Notification. setlatesteventinfo ( This , Edttitle, edtcontent, pendingintent );
Notification. defaults = notification. default_sound;
Notification. Flags = notification. flag_no_clear | notification. flag_auto_cancel; // Cannot be cleared, automatically canceled
Icationicationmanager notificationmanager = (notificationmanager) getsystemservice (context. icationication_service );
Icationicationmanager. Y (100, notification );
}
@ Override
Public BooleanOncreateoptionsmenu (menu ){
Getmenuinflater (). Inflate (R. Menu. activity_main, menu );
Return True;
}
}