title: Where/How to set AlarmManager alarms to avoid duplicates
body: <p>I'm fairly new to Android, so please forgive my naiveté.</p>
  
  <p>The app I am working on needs to wake up every hour and do some background data collection. I'm using <code>AlarmManager</code> to set a repeating alarm that starts the service.</p>
  
  <p>I'm currently setting up the alarm in the <code>MainActivity</code> in the <code>onCreate</code> method. My concern is that if the app is closed and reopened and the <code>onCreate</code> method is called again, it would duplicate the alarms. Am I incorrect in assuming this?</p>
  
  <p>One way I'm thinking about circumventing this to use a boolean in <code>SharedPreferences</code>. Is there a more standard way of approaching this issue?</p>
  
  <p>Thank you!</p>