src/org/gege/caldavsyncadapter/syncadapter/notifications/NotificationsHelper.java

Tue, 10 Feb 2015 18:12:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 10 Feb 2015 18:12:00 +0100
changeset 0
fb9019fb1bf7
permissions
-rw-r--r--

Import initial revisions of existing project AndroidCaldavSyncAdapater,
forked from upstream repository at 27e8a0f8495c92e0780d450bdf0c7cec77a03a55.

     1 package org.gege.caldavsyncadapter.syncadapter.notifications;
     3 import org.gege.caldavsyncadapter.R;
     5 import android.app.NotificationManager;
     6 //import android.app.PendingIntent;
     7 import android.content.Context;
     8 //import android.content.Intent;
     9 import android.support.v4.app.NotificationCompat;
    10 //import android.support.v4.app.TaskStackBuilder;
    12 public class NotificationsHelper {
    14 	/*static SyncLog currentSyncLog = new SyncLog();
    15 	 doesn't exist */
    17 	public static void signalSyncErrors(Context context, String title, String text) {
    18 		NotificationCompat.Builder mBuilder =
    19 		        new NotificationCompat.Builder(context)
    20 		        .setSmallIcon(R.drawable.icon)
    21 		        .setContentTitle(title)
    22 		        .setContentText(text);
    24 		// Creates an explicit intent for an Activity in your app
    25 /*		Intent resultIntent = new Intent(context, SyncStatusReportActivity.class);
    27 		// The stack builder object will contain an artificial back stack for the
    28 		// started Activity.
    29 		// This ensures that navigating backward from the Activity leads out of
    30 		// your application to the Home screen.
    31 		TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    32 		// Adds the back stack for the Intent (but not the Intent itself)
    33 		stackBuilder.addParentStack(SyncStatusReportActivity.class);
    34 		// Adds the Intent that starts the Activity to the top of the stack
    35 		stackBuilder.addNextIntent(resultIntent);
    36 		PendingIntent resultPendingIntent =
    37 		        stackBuilder.getPendingIntent(
    38 		            0,
    39 		            PendingIntent.FLAG_UPDATE_CURRENT
    40 		        );
    41 		mBuilder.setContentIntent(resultPendingIntent);
    42 */		
    44 		NotificationManager mNotificationManager =
    45 			    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    47 			// mId allows you to update the notification later on.
    48 		int mId = 0;
    49 		mNotificationManager.notify(mId, mBuilder.build());
    50 	}
    52 	/*public static SyncLog getCurrentSyncLog() {
    53 		return currentSyncLog;
    54 	}*/
    56 }

mercurial