Android Open Source - PicSync Notifier






From Project

Back to project page PicSync.

License

The source code is released under:

Apache License

If you think the Android project PicSync listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.darrenmowat.gdcu.service;
/* w w  w. ja v a2  s.c  o  m*/
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.support.v4.app.NotificationCompat;

import com.darrenmowat.gdcu.R;
import com.darrenmowat.gdcu.activity.AuthActivity;
import com.darrenmowat.gdcu.activity.SettingsActivity;

public class Notifier {

  public static void notifyAuthError(Context context, String email, Intent intent) {
    final Intent authIntent = new Intent(context, AuthActivity.class);

    authIntent.putExtra(AuthActivity.KEY_EMAIL, email);
    authIntent.putExtra(AuthActivity.KEY_INTENT, intent);

    String title = context.getString(R.string.notif_account_error_title);
    String text = String.format(context.getString(R.string.notif_account_error_text), email);

    notify(context, 4003, title, text, authIntent);
  }

  private static void notify(Context context, int id, String title, String text, Intent intent) {
    final PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent,
        PendingIntent.FLAG_CANCEL_CURRENT);
    final Notification notification = new NotificationCompat.Builder(context)
        .setSmallIcon(R.drawable.ic_notif_icon)
        .setLargeIcon(
            BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher))
        .setAutoCancel(true).setContentTitle(title).setContentText(text)
        .setContentIntent(pendingIntent).build();
    final NotificationManager manager = (NotificationManager) context
        .getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(id, notification);
  }

}




Java Source Code List

com.darrenmowat.gdcu.GDCU.java
com.darrenmowat.gdcu.Keys.java
com.darrenmowat.gdcu.activity.AuthActivity.java
com.darrenmowat.gdcu.activity.RenameFolderActivity.java
com.darrenmowat.gdcu.activity.SettingsActivity.java
com.darrenmowat.gdcu.activity.WebviewActivity.java
com.darrenmowat.gdcu.data.Database.java
com.darrenmowat.gdcu.data.Preferences.java
com.darrenmowat.gdcu.drive.DriveApi.java
com.darrenmowat.gdcu.otto.DataBus.java
com.darrenmowat.gdcu.otto.UploadStatusEventProducer.java
com.darrenmowat.gdcu.otto.UploadStatusEvent.java
com.darrenmowat.gdcu.security.PackageSecurityException.java
com.darrenmowat.gdcu.security.PackageSecurity.java
com.darrenmowat.gdcu.service.GalleryAlarmListener.java
com.darrenmowat.gdcu.service.GalleryObserver.java
com.darrenmowat.gdcu.service.MediaService.java
com.darrenmowat.gdcu.service.MediaThread.java
com.darrenmowat.gdcu.service.Notifier.java
com.darrenmowat.gdcu.service.ServiceUtils.java
com.darrenmowat.gdcu.service.UploadService.java
com.darrenmowat.gdcu.service.UploadThread.java
com.darrenmowat.gdcu.service.helpers.CloudSyncer.java
com.darrenmowat.gdcu.service.helpers.Media.java
com.darrenmowat.gdcu.service.helpers.ServiceIntents.java
com.darrenmowat.gdcu.service.helpers.ThreadCallbacks.java
com.darrenmowat.gdcu.tasks.GetTokenTask.java
com.darrenmowat.gdcu.tasks.RenameFolderTask.java
com.darrenmowat.gdcu.ui.ProgressDialogFragment.java
com.darrenmowat.gdcu.utils.HexConversions.java
com.darrenmowat.gdcu.utils.MD5Utils.java
com.darrenmowat.gdcu.utils.Preconditions.java