Android Open Source - brainrot Due Card Broadcast Receiver






From Project

Back to project page brainrot.

License

The source code is released under:

Apache License

If you think the Android project brainrot 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 jcuenod.brainrot;
/* ww  w. ja va2  s. c  om*/
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;

public class DueCardBroadcastReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context arg0, Intent arg1) {
    PendingIntent pIntent = PendingIntent.getActivity(arg0, 0, 
          new Intent(arg0, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP).putExtra(MainActivity.FROM_NOTIFICATION, true),
          0);
      NotificationManager notificationManager = (NotificationManager) arg0.getSystemService(MainActivity.NOTIFICATION_SERVICE);
      NotificationCompat.Builder noti = new NotificationCompat.Builder(arg0);
      noti.setContentTitle("Brain Rot")
          .setContentText("Your cards await you (click to do them)...")
          .setSmallIcon(R.drawable.brainrot_notification)
          .setContentIntent(pIntent)
          .build().flags |= Notification.FLAG_AUTO_CANCEL;
      notificationManager.notify(0, noti.build());
      
      if (!MainActivity.isInForeground)
      {
        try {
                Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                Ringtone r = RingtoneManager.getRingtone(arg0, notification);
                r.play();
            } catch (Exception e) {}
      }
  }

}




Java Source Code List

com.ipaulpro.afilechooser.FileChooserActivity.java
com.ipaulpro.afilechooser.FileListAdapter.java
com.ipaulpro.afilechooser.FileListFragment.java
com.ipaulpro.afilechooser.FileLoader.java
com.ipaulpro.afilechooser.utils.FileUtils.java
com.ipaulpro.afilechooser.utils.MimeTypeParser.java
com.ipaulpro.afilechooser.utils.MimeTypes.java
jcuenod.brainrot.BubbleChartDetails.java
jcuenod.brainrot.DBHelper.java
jcuenod.brainrot.DueCardBroadcastReceiver.java
jcuenod.brainrot.FlashCard.java
jcuenod.brainrot.ImportAsyncTask.java
jcuenod.brainrot.LanguageUtils.java
jcuenod.brainrot.MainActivity.java
jcuenod.brainrot.PieChartDetails.java
jcuenod.brainrot.ServiceStarter.java
jcuenod.brainrot.Statistics.java