Try this
Just call inside your onCreate()
Public void Player_Notification()
{
final String myBlog = "http://android-er.blogspot.com/";
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
myNotification = new Notification(R.drawable.ic_launcher,"Audio Track is playing in background!",System.currentTimeMillis());
Context context = getApplicationContext();
// here is title
String notificationTitle = Title;
// here is sub title
String notificationText = data;
// write your activity name which you want to open when user click on notification
Intent myIntent = new Intent(this, Activty.class);
PendingIntent pendingIntent = PendingIntent.getActivity(Activty.this, 0, myIntent,
Intent.FLAG_ACTIVITY_NEW_TASK);
// intent will call your activity as you want
myNotification.defaults |= Notification.DEFAULT_SOUND;
myNotification.flags |= Notification.FLAG_AUTO_CANCEL;
myNotification.setLatestEventInfo(context, notificationTitle,
notificationText, pendingIntent);
notificationManager.notify(MY_NOTIFICATION_ID, myNotification);
}
No comments:
Post a Comment