title: Caused by: java.lang.IllegalStateException:
body: <p>I'm facing this i don't know how to reproduce it. </p>
  
  <blockquote>
    <p>Caused by: java.lang.IllegalStateException: </p>
  </blockquote>
  
  <p>My application working fine on my device when i publish on google play store after 2 hours these issues are producing in <strong>crashes report</strong> of android vitals.
  I am unable to reproduce it.</p>
  
  <pre><code>
  java.lang.RuntimeException: 
    at android.app.ActivityThread.handleReceiver (ActivityThread.java:3619)
    at android.app.ActivityThread.access$1300 (ActivityThread.java:237)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1803)
    at android.os.Handler.dispatchMessage (Handler.java:106)
    at android.os.Looper.loop (Looper.java:214)
    at android.app.ActivityThread.main (ActivityThread.java:7091)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
  Caused by: java.lang.IllegalStateException: 
    at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1666)
    at android.app.ContextImpl.startService (ContextImpl.java:1611)
    at android.content.ContextWrapper.startService (ContextWrapper.java:677)
    at android.content.ContextWrapper.startService (ContextWrapper.java:677)
    at b.k.a.a.b (Unknown Source:22)
    at sjtechnologies.muslimapp.service.PrayerAlarm.onReceive (Unknown Source:21)
    at android.app.ActivityThread.handleReceiver (ActivityThread.java:3610)
  </code></pre>
  
  <p>My Prayer Alram code</p>
  
  <pre><code>
  public class PrayerAlarm extends WakefulBroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          Bundle b = intent.getExtras();
          startWakefulService(context, new Intent(context, PrayerNotification.class).putExtra("prayName", b.getString("prayName")));
  
          Log.i("ACTIVITY_SRAT" , "PrayerAlarm is working well");
      }
  }
  
  
  </code></pre>
  
  <p>Prayer Notification class here. i don't know which thing i'm missing. maybe wakefullservice creating issue</p>
  
  <pre><code>
  public class PrayerNotification extends Service {
      private String prayingName , prayerType;
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          prayingName = intent.getStringExtra("prayName");
          //not mid night
          Log.i("ACTIVITY_SRAT" , "PrayerNotification is working well");
          if (ConfigPreferences.getPrayingNotification(this) &amp;&amp; !prayingName.equals("6"))
              showNotification();
          if (ConfigPreferences.getSilentMood(this)) changeMobileToSilentMood();
          sendBroadcast(new Intent().setAction("prayer.information.change"));
          stopSelf();
          PrayerAlarm.completeWakefulIntent(intent);
          return super.onStartCommand(intent, flags, startId);
      }
  
      /**
       * Function to check to make mobile silent in prayer
       */
      private void changeMobileToSilentMood() {
          AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
          int ringerMode = mAudioManager.getRingerMode();
          if (ringerMode != AudioManager.RINGER_MODE_SILENT) {
              Alarms.switchToSilent(10, this);
          }
      }
  
      /**
       * Function to show prayer notification
       */
      public void showNotification() {
  
          switch (prayingName) {
              case "0":
                  prayingName = this.getString(R.string.fajr_prayer);
                  prayerType = PrayerImageActivity.MOSQUE_NIGHT;
                  AppLog.add(prayingName);
                  break;
              case "1":
                  prayingName = this.getString(R.string.sunrize_prayer);
                  prayerType = PrayerImageActivity.MOSQUE_DAY;
                  AppLog.add(prayingName);
                  break;
              case "2":
                  HGDate hgDate = new HGDate();
                  prayingName = hgDate.weekDay() != 5 ? this.getString(R.string.zuhr_prayer) : this.getString(R.string.jomma_prayer);
  
                  prayerType = PrayerImageActivity.MOSQUE_DAY;
                  AppLog.add(prayingName);
                  break;
              case "3":
                  prayingName = this.getString(R.string.asr_prayer);
                  prayerType = PrayerImageActivity.MOSQUE_DAY;
                  AppLog.add(prayingName);
                  break;
              case "4":
                  prayingName = this.getString(R.string.magreb_prayer);
                  prayerType = PrayerImageActivity.MOSQUE_NIGHT;
                  AppLog.add(prayingName);
                  break;
              case "5":
                  prayingName = this.getString(R.string.asha_prayer);
                  prayerType = PrayerImageActivity.MOSQUE_NIGHT;
                  AppLog.add(prayingName);
                  break;
              case "6":
                  prayingName = this.getString(R.string.mid_night);
                  AppLog.add(prayingName);
                  break;
  
          }
  
  
          NotificationCompat.Builder builder;
          boolean aboveLollipopFlag = android.os.Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP;
          PendingIntent intent = PendingIntent.getActivity(this, 0,
                  new Intent(this, MainActivity.class), 0);
          if (ConfigPreferences.getLedNotification(this)) {
              builder = new NotificationCompat.Builder(this).
                      setSmallIcon(aboveLollipopFlag ? R.drawable.notification_white : R.drawable.icon)
                      .setPriority(Notification.PRIORITY_MAX)
                      .setContentText(prayingName)
                      .setContentTitle(getString(R.string.remember))
                      .setDefaults(Notification.DEFAULT_SOUND)
                      .setLights(0xFF00ff00, 1000, 1000)
                      .setAutoCancel(true)
                      .setColor(Color.parseColor("#2a5f54"))
                      .setContentIntent(intent);
          } else {
              builder = new NotificationCompat.Builder(this).
                      setSmallIcon(aboveLollipopFlag ? R.drawable.notification_white : R.drawable.icon)
                      .setPriority(Notification.PRIORITY_MAX)
                      .setContentText(prayingName)
                      .setContentTitle(getString(R.string.remember))
                      .setDefaults(Notification.DEFAULT_SOUND)
                      .setAutoCancel(true)
                      .setColor(Color.parseColor("#2a5f54"))
                      .setContentIntent(intent);
          }
  
          NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
          notificationManager.notify(0, builder.build());
  
          /*For start activities when prayer come*/
  
  //        Intent intent1 = new Intent(this , PrayerImageActivity.class);
  //        Log.i("ACTIVITY_SRAT" , "Start Activity is working well");
  //        intent1.putExtra(PrayerImageActivity.MOSQUE_TYPE , prayerType);
  //        intent1.putExtra(PrayerImageActivity.PRAY_TYPE , prayingName);
  //        startActivity(intent1);
  
  
      }
  
      boolean isShow = true;
      @Override
      public IBinder onBind(Intent intent) {
  
          return null;
      }
  }
  </code></pre>