title: pending intent not triggering
body: <p>The app I am developing will allow the user to set timings for the device to activate silent and normal mode in a specific time interval. Up til now I can get user input of start and end time but can't get the device to be silent mode in that time. To activate silent and normal mode I am using pending intent and broadcast-receiver. Here is what I have coded so far.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  EditText etMeal,etDesert,start,end;
  Button btnAdd,btnView,btnsttime,btnend;
  DatabaseHelper myDB;
  int mHour,mMinute;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      btnAdd = (Button) findViewById(R.id.btnAdd);
      btnView = (Button) findViewById(R.id.btnView);
      btnsttime=(Button)findViewById(R.id.sttime);
      btnend=(Button)findViewById(R.id.endtime);
  
      etMeal = (EditText) findViewById(R.id.etMeal);
      //etDesert = (EditText) findViewById(R.id.etDesert);
      start=(EditText)findViewById(R.id.stime);
      end=(EditText)findViewById(R.id.etime);
      myDB = new DatabaseHelper(this);
  
      btnAdd.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String meal = etMeal.getText().toString();
              //String desert = etDesert.getText().toString();
  
              if(meal.length() != 0){
                  AddData(meal);
                  etMeal.setText("");
                  //etDesert.setText("");
              }else{
                  Toast.makeText(MainActivity.this, "You must fill in the text fields!",Toast.LENGTH_LONG).show();
              }
          }
      });
  
      btnView.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent  = new Intent(MainActivity.this, View_Foods.class);
              startActivity(intent);
          }
      });
  
  }
  
  public void AddData(String meal) {
  
      boolean insertData = myDB.addData(meal);
  
      if (insertData == true) {
          Toast.makeText(MainActivity.this, "Data Successfully Inserted!", Toast.LENGTH_LONG).show();
      } else {
          Toast.makeText(MainActivity.this, "Something went wrong :(.", Toast.LENGTH_LONG).show();
      }
  }
  
  public void start(View view)
  {
      // Get Current Time
     /* Calendar c = Calendar.getInstance();
      mHour = c.get(Calendar.HOUR_OF_DAY);
      mMinute = c.get(Calendar.MINUTE);*/
  
     Calendar calendar=Calendar.getInstance();
  
      // Launch Time Picker Dialog
      TimePickerDialog timePickerDialog = new TimePickerDialog(this,
              new TimePickerDialog.OnTimeSetListener() {
  
                  @Override
                  public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
  
                  Calendar newTime=Calendar.getInstance();
  
                      newTime.set(Calendar.HOUR_OF_DAY, hourOfDay);
                      newTime.set(Calendar.MINUTE, minute);
                      String Gottime=String.valueOf(hourOfDay)+":"+String.valueOf(minute);
                      start.setText(Gottime);
  
                      //mHour=newobj.get(hourOfDay);
                      //mMinute=newobj.get(minute);
  
                      AlarmManager am = (AlarmManager) MainActivity.this.getSystemService(ALARM_SERVICE);
  
                      //create a pending intent to be called at midnight
                      Toast.makeText(MainActivity.this, "Pending Intent started", Toast.LENGTH_LONG).show();
                      PendingIntent midnightPI = PendingIntent.getService(MainActivity.this, 0, new Intent("applications.recyclerview1.SilenceBroadCastReceiver"), PendingIntent.FLAG_UPDATE_CURRENT);
  
                      //schedule time for pending intent, and set the interval to day so that this event will repeat at the selected time every day
  
                      am.setRepeating(AlarmManager.RTC_WAKEUP, newTime.getTimeInMillis(), AlarmManager.INTERVAL_DAY, midnightPI);
  
                  }
              },calendar.get((Calendar.HOUR_OF_DAY)),calendar.get((Calendar.MINUTE)), true);
      timePickerDialog.show();
  }
  
  public void end(View view)
  {
      // Get Current Time
      Calendar c = Calendar.getInstance();
      mHour = c.get(Calendar.HOUR_OF_DAY);
      mMinute = c.get(Calendar.MINUTE);
  
      final Calendar newobj2=Calendar.getInstance();
  
      // Launch Time Picker Dialog
      TimePickerDialog timePickerDialog = new TimePickerDialog(this,
              new TimePickerDialog.OnTimeSetListener() {
  
                  @Override
                  public void onTimeSet(TimePicker view, int hourOfDay,
                                        int minute) {
  
                      end.setText(hourOfDay + ":" + minute);
                      newobj2.get(hourOfDay);
                      newobj2.get(minute);
  
                      //create a pending intent to be called at 6 AM
                      AlarmManager am = (AlarmManager) MainActivity.this.getSystemService(ALARM_SERVICE);
  
                      PendingIntent sixPI = PendingIntent.getService(MainActivity.this, 0, new Intent("applications.recyclerview1.UnsilenceBroadcastReceiver"), PendingIntent.FLAG_UPDATE_CURRENT);
  
                      //schedule time for pending intent, and set the interval to day so that this event will repeat at the selected time every day
  
                      am.setRepeating(AlarmManager.RTC_WAKEUP, newobj2.getTimeInMillis(), AlarmManager.INTERVAL_DAY, sixPI);
  
                  }
              }, mHour, mMinute, false);
      timePickerDialog.show();
  }
  </code></pre>
  
  <p>SilentBroadCastReceiver.java</p>
  
  <pre><code>public class SilenceBroadCastReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      AudioManager audio=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
      audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
  }}
  </code></pre>
  
  <p>UnsilentBroadcastReceiver.java</p>
  
  <pre><code>public class UnsilenceBroadcastReceiver extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      AudioManager audio=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
      audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
  }}
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="applications.recyclerview1"&gt;
  
          &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".View_Foods"&gt;&lt;/activity&gt;
          &lt;receiver android:name=".SilenceBroadCastReceiver"&gt;
  
              &lt;intent-filter&gt;
  
                  &lt;action android:name="applications.recyclerview1.SilenceBroadCastReceiver" &gt;
  
                  &lt;/action&gt;
  
              &lt;/intent-filter&gt;
  
          &lt;/receiver&gt;
  
            &lt;receiver android:name=".UnsilenceBroadcastReceiver"&gt;
  
              &lt;intent-filter&gt;
  
  
  
         &lt;action 
         android:name="applications.recyclerview1.UnsilenceBroadcastReceiver" &gt;
  
                  &lt;/action&gt;
  
              &lt;/intent-filter&gt;
  
          &lt;/receiver&gt;
          &lt;/application&gt;
  
          &lt;/manifest&gt;
  </code></pre>