Restricting FCM credentials to only development apps - firebase-cloud-messaging

I work on several Android and iOS apps with a team of developers. These apps use Push Notifications - through Firebase (FCM) for Android and through APNs for iOS.
For APNs, we use a key (.p8 file) for production servers, and a sandbox-only certificate (.pem file) for testing. Our development team is allowed to use the sandbox for testing push notifications, but cannot accidentally send push notifications to production.
For FCM, we use a Service Account (.json file) for production servers, and we want a way to allow our developers to test push notifications in development without being able to push messages to production.
We have configured our Android apps so that debug builds append .dev to the application ID, like this:
android {
buildTypes {
debug {
applicationIdSuffix '.dev'
}
}
}
In the Firebase console, our project contains both app identifiers com.example.myapp (not the real name) and com.example.myapp.dev as separate apps.
However, I cannot find a way to create a separate Service Account that is limited to sending to the .dev apps.
Is there a way that I can set up a development-only account so my developers can send push notifications only to the development versions of the apps?

For this scenario the only thing I can think would be creating a new Firebase project in order to isolate both environments.
I'm not aware of a way to restrict a service account from sending FCM messages to only a particular app in the project.

Related

How to Send Push Notification to Xamarin Android app?

I need to implement push notification to our Android App using Xamarin. Here is the process. We have web version which used by the Manager. The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app uses same database then we created an api(REST API in MVC C#) to connect and get data from the db to be used in the mobile app.
Can someone recommend to me which Push notification plugin(a plugin or nuget) should I use to do this? Currently, I have set up Push Notifications through App center & Firebase but not sure how this work.
Thank you.
I need to implement push notification to our Android App using Xamarin.
I would suggest you use Firebase for mobile push notifications for Android as it is a product by Google, and was made for mobile applications. For push notifications, you will be using Firebase Cloud Messaging also known as FCM. See to it that you are well versed on how it works before you start coding anything read the documents it answers most of your questions there itself.
The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of a job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app use the same database then we created an API(REST API in MVC C#) to connect and get data from the DB to be used in the mobile app.
For this, you will have to check on how to work with Firebase using Rest-API. Once you configure the Rest-API and then apply your business logic to it things will be quite easier than you might have imagined.
Can someone recommend to me which Push notification plugin(a plugin or NuGet) should I use to do this?
My recommendation is quite simple, Do not use any sort of a firebase push notifications plugin!. I have had a very bad past with plugins and ever since then I never recommend fellow developers to use plugins until it is a well-maintained one. I would rather ask you to simply configure Firebase on the basis of the guides that are available online. Like the following Xamarin.Android guide for FCM. It is detailed contains everything that you are looking for and what else I would suggest is you check firebase related answers on SO and you will find that almost everything that is not available in docs is covered around here and in detail. Like the following:
How to handle Firebase Notification i.e. Notification Messages and Data Messages
Push Notification in android with firebase get token
How to send device to device messages using Firebase Cloud Messaging?
Receive push notifications on one android app from two Firebase projects

How to push notification remotely with React-Native-Push-Notification?

I am new at mobile app developing, and i have been looking into push notification and , i understand that you have local notification, static on the device and remote notification, send from a notification server (which is not the application server), i am trying to use
this library, quite a popular one for doing push notification:
https://github.com/zo0r/react-native-push-notification
I can understand how to set it up in the react native project and use local notification since i found a specific tutorial for it, but the tutorial only show how to use the local notification.
I have been searching for more documents on how to use this library for remote notification step by step, from setting up the notification server to use it in the react native app, but they are all so vague explanations or use different tools.
You can use services such as oneSignal & FCM. Here are some libraries for push notification
https://github.com/geektimecoil/react-native-onesignal (one signal)
Tutorial : https://medium.com/differential/react-native-push-notifications-with-onesignal-9db6a7d75e1e
You can use the below library for FCM if you need any other firebase services such as authentication, dynamic links etc.. go for this
https://github.com/invertase/react-native-firebase (fcm)
If you just need only push notification services, you can use
https://github.com/evollu/react-native-fcm
Some helpful blogs for the integration
https://medium.com/react-native-training/react-native-push-notifications-with-amazon-pinpoint-ios-b2efa89ced32
https://medium.com/differential/how-to-setup-push-notifications-in-react-native-ios-android-30ea0131355e
Firstly go to rnfirebase and follow the process..
You will have do stuffs like yarn add (app/messaging), pod install, some changes in podfile, configure appDelegate.m firapp, notification etc.. and then mostly the problem comes with developer.apple.com
YES, you compulsory require developer account
Create identifier with push notification checked
-> Using key chain generate => Certificate Assistat > Request A Certificate from Certificate Authority to create certificate in below steps.
-> Press Configure on push notification and create certificate which will create apple push services for both development and production for release and debug and download and click it on add on keychain
-> Generate .p12 file of both certificate release and production using Keychain all you have to do it click in the certificate you just add on keychain you can verify with expiry date if is confusing... then right click export to create .p12 file put password that you wont forget
-> Put your .p12 file on Firebase Cloud Messaging under project settings > cloud messaging (Here you will need the password you set)
-> go to user developer account and create profiles both IOS development and App Store and please select the required certificate while creating AppStore Production profile
-> Now run app using development profile on Xcode and Archive using production/distribution profile
-> Test notification using Cloud Messaging Notification tools provided by firebase if it work it works if it don't check then above step throughly

How to get local-notification without Apns for ios in react-native?

I searched some notification library for react-native.
https://github.com/zo0r/react-native-push-notification
This works well for Android but it requires Apns for ios
I would like to find some libraries that doen not require Apns and simple.
There is no avoiding using APNS for remote push notifications.
In order to receive data in certain scenarios, such as having your app running in the background, phone being offline and later receiving a notification once it is back online, your device must have a unique app-specific device token generated by Apple. You can then use a service such as FCM or AWS SNS to deliver the notification to clients.
Also, for Android, you will need to use GCM to generate the device token.
You can, for testing purposes, you can use react-native-push-notifications' PushNotification.localNotificationSchedule to create a dummy local notification.
Here is a good tutorial for setting up remote push notifications with APNS and FCM: https://www.appcoda.com/firebase-push-notifications/.

pushnotification for Advertisement in iOS?

I have developed an iOS app which uses a third party framework for showing Ads inside the app.
I would like to know whether to enable push notifications for the AppId While submiting App?
its depends on how the Ads SDK works.
most likely it works without the APNS (apple push notification server), but its also possible that it does, and from that screenshot, there is a good chance.
I would recommend enabling push notification, just in case.
go to the apple's developer member center, go to your App, press edit, enable "push notifications" and create certificate for production, and also new provisioning profiles.
Don't forget to download the APNS certificate, create a PEM file to implement it on the server side (most likely they'll require that in case they do use APNS)
for more information on how it's done:
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Enabling push notification is not required for Ad integration while submitting app to the App Store.

Device Token null when deploying app as ad-hoc (Urban Airship)

I implemented the Urban Airship library into my application and I can successfully send push notifications to a specific device in development mode. After startup I get the device token and save it into a mysql database. However, when I use the app in ad-hoc mode, the device token is always (null).
APP_STORE_OR_AD_HOC_BUILD is set to YES
and the APP Key and APP-Secret for both production and development are correct.
Any ideas how to get the device token in ad-hoc/appstore mode?
Edit:
Identical question has been posted in the Urban Airship Forum.
For me also same thing happened. What we did to solve problem is just recreated new adHoc provisioning profile. Then we got alert asking to install push notification. Its one of the major issue in iOS push notification. We must configure push nofitiation SSL certificate before creating provisioning profile.