Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
most probably this question was answered many times but i am a newbie and dont know how to use source data.

my intention is to create basic application for my teammates to follow our shift schedule and when any changes happen, my application notify my friends to check the schedule.

so far i couldn't succeeded to create basic notification for android 2.3 (because it has to cover all friends' smart phones)

for now i used this code with button function here is my sample code and it creates NOTHING!

public void butClick(View view) {

   Intent resultIntent = new Intent(this, MainActivity.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder mBuilder =  new NotificationCompat.Builder(this)
            .setContentTitle("My Title")
            .setWhen(System.currentTimeMillis())
            .setContentIntent(pendingIntent)
            .setContentText("My text");

    mBuilder.setContentIntent(pendingIntent);

    NotificationManager mNotificationManager =  (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(1, mBuilder.build());
}
Posted
Comments
Richard MacCutchan 26-Jan-16 3:53am    
What is it supposed to do?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900