michael@0: package org.gege.caldavsyncadapter.syncadapter.notifications; michael@0: michael@0: import org.gege.caldavsyncadapter.R; michael@0: michael@0: import android.app.NotificationManager; michael@0: //import android.app.PendingIntent; michael@0: import android.content.Context; michael@0: //import android.content.Intent; michael@0: import android.support.v4.app.NotificationCompat; michael@0: //import android.support.v4.app.TaskStackBuilder; michael@0: michael@0: public class NotificationsHelper { michael@0: michael@0: /*static SyncLog currentSyncLog = new SyncLog(); michael@0: doesn't exist */ michael@0: michael@0: public static void signalSyncErrors(Context context, String title, String text) { michael@0: NotificationCompat.Builder mBuilder = michael@0: new NotificationCompat.Builder(context) michael@0: .setSmallIcon(R.drawable.icon) michael@0: .setContentTitle(title) michael@0: .setContentText(text); michael@0: michael@0: // Creates an explicit intent for an Activity in your app michael@0: /* Intent resultIntent = new Intent(context, SyncStatusReportActivity.class); michael@0: michael@0: // The stack builder object will contain an artificial back stack for the michael@0: // started Activity. michael@0: // This ensures that navigating backward from the Activity leads out of michael@0: // your application to the Home screen. michael@0: TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); michael@0: // Adds the back stack for the Intent (but not the Intent itself) michael@0: stackBuilder.addParentStack(SyncStatusReportActivity.class); michael@0: // Adds the Intent that starts the Activity to the top of the stack michael@0: stackBuilder.addNextIntent(resultIntent); michael@0: PendingIntent resultPendingIntent = michael@0: stackBuilder.getPendingIntent( michael@0: 0, michael@0: PendingIntent.FLAG_UPDATE_CURRENT michael@0: ); michael@0: mBuilder.setContentIntent(resultPendingIntent); michael@0: */ michael@0: michael@0: NotificationManager mNotificationManager = michael@0: (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); michael@0: michael@0: // mId allows you to update the notification later on. michael@0: int mId = 0; michael@0: mNotificationManager.notify(mId, mBuilder.build()); michael@0: } michael@0: michael@0: /*public static SyncLog getCurrentSyncLog() { michael@0: return currentSyncLog; michael@0: }*/ michael@0: michael@0: }