title: How to send APNS push notifications from Dev, Test, Staging, and Prod environments?
body: <p>I'm developing an app with <a href="https://flutter.dev" rel="nofollow noreferrer">Flutter</a> and the <a href="https://pub.dev/packages/firebase_messaging" rel="nofollow noreferrer">firebase_messaging</a> plugin.  The backend sends push notifications via Firebase Cloud Messaging (FCM).  How can I build different flavors of the app which can receive push notifications only from their corresponding flavors of backend?</p>
  
  <ul>
  <li>Dev (one for each engineer)</li>
  <li>Test</li>
  <li>Staging</li>
  <li>Prod</li>
  </ul>
  
  <p><strong>Android</strong>: After much searching, I came to the conclusion that FCM access control granularity is per-project.  Therefore, this should work:</p>
  
  <ol>
  <li>Create a Firebase project for each flavor.</li>
  <li>Add a single "Android App" with a unique package name <code>com.company.app.flavor</code> to each Firebase project.</li>
  <li><a href="https://medium.com/flutter-community/flutter-ready-to-go-e59873f9d7de#2e2d" rel="nofollow noreferrer">Configure build.gradle</a> with the flavors and appropriate <code>applicationIdSuffix</code> values so the app binaries end up with the same package names as the Firebase project "Android App" entries.</li>
  </ol>
  
  <p><strong>iOS</strong>: How to accomplish the same thing for iOS with APNS?</p>
  
  <ul>
  <li>I found an <a href="https://stackoverflow.com/a/10792212">answer from 7 years ago</a> that doesn't make sense now.</li>
  <li>Can I follow the same strategy with iOS as with Android, building the app with a unique Bundle-ID for each flavor?  Would that require an app entry in App Store Connect for each of the Bundle-IDs?</li>
  <li>There is <a href="https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36" rel="nofollow noreferrer">an article on iOS flavors</a> but it is missing some information and makes no mention of setting a bundle-id or bundle-id-suffix.</li>
  </ul>