package com.example.patrice.repeat_request_01;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;

public class Notification_creation extends BroadcastReceiver
{

    public static String _NOTIFICATION_ID = "notification-id";
    public static String _NOTIFICATION = "notification";

    public void onReceive(Context context, Intent intent)
    {

            //   NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
            //  Notification notification = intent.getParcelableExtra(_NOTIFICATION);
            //   int id = intent.getIntExtra(_NOTIFICATION_ID, 0);
            //  notificationManager.notify(id, notification);

        int num = (int) System.currentTimeMillis();

        NotificationManager notificationManagerCompat = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                .setContentTitle("title")
                .setSmallIcon(R.drawable.ic_replay_30_black_36dp)
                .setContentText("message")
                .setColor(ContextCompat.getColor(context, android.R.color.black))
                //.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
                .setSound(alarmSound);
        //  notificationManagerCompat.notify(notifId, builder.build());

        notificationManagerCompat.notify(num, builder.build());

    }
}