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
Related
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.
EXPO SDK Version: 42.0.01
Developing for: iOS
Our goal: successfully send a test notification from Test Send tool in Azure Notification Hub to a registered physical iPhone which is running a local instance of an EXPO app.
Progress: we're able to successfully register a physical iPhone with Azure Notification Hub without using a 3rd party library. We can see that registration in the Hub.
Issues: when using the Azure's Test Send tool we're getting an error "The Push Notification System handle for the registration is invalid" and the test notification does not get delivered.
Debugging:
we're using EXPO's Notifications.getDevicePushTokenAsync() API to obtain the push token.
Azure support team analysed the logs and concluded that the problem is the PNS handle i.e. Apple's ID of the phone registered for notifications.
the phone's PNS handle remains the same at all times.
by using "expo credentials:manager" I've added a new Push Notification Key using KeyID, TeamID and .p8 certificate - the PNS handle didn't change after doing that and notifications were failing too.
I haven't found any tools to validate the APNS handle. I'm currently awaiting a .p12 certificate from our corporate team to test notifications by using https://pushtry.com/.
How do we validate the APNS handle and if found that it's invalid - how do we cycle it / request another?
The PNS Handle from APNs does not change that often as it is tied to the device and app installation. See this answer for more details Does the APNS device token ever change, once created?
I've tried to following the instructions
Configuring push services for Android devices
However, the steps mention 'Click Push Notifications on the left-side navigation' but they don't exist...
Once you've created a Google API project with GCM enabled, you need to update your application's settings page in Dashboard with the API key and sender ID you generated.
To configure Arrow for push notifications using Dashboard:
Open Dashboard and select your application from the Apps drop-down menu.
Click Push Notifications on the left-side navigation <-- MISSING.
Select the Android Push tab.
Enter the server key in the GCM API Key field and the GCM sender ID in the GCM Sender ID field.
Here's a screenshot to show what's listed...
If I look under Arrow (where I suspect it might be expecting to be listed) that's empty (I'm not using Arrow - I thought it was an alternative UI using declarative XML)...
I've checked the subscription that I'm on (Indie) and it shows that I should have the ability to send up to 1 million push notifications for free..
Does anyone know how I can associate the Appcelerator Titanium project to the GCM server key??
Also, when I looked in Googles developer console, my application (which is live on their app store) wasn't listed, so I've created a new application called 'Gcm'. The Appcelerator Titanium seemed to confirm that I needed to 'create' the application, I was just too worried to call it the same name as the live application. How does the 'Google Developer Console' Application relate to the 'Google Play' application?! - if at all?
UPDATE
I've just discovered in TiApp.xml that I can enable some 'Cloud' settings and this has unlocked the 'Push' menu - so I think all is good now, could someone confirm that this is the right thing to do and answer my related question about Google play applications v google developer console applications?
Update 2
I started to get this error
[ERROR] : GooglePlayServicesUtil: The Google Play services resources
were not found. Check your project configuration to ensure that the
resources are included.
[INFO] : CloudPush.retrieveDeviceToken error: INVALID_SENDER
I'm simply calling this to try and register for Android push notifications ...
CloudPush.retrieveDeviceToken({
success : function(e) {
console.info("CloudPush.retrieveDeviceToken success");
},
error : function(e) {
console.info("CloudPush.retrieveDeviceToken error:"+e.error);
}
});
I have tried with and without the ti.cloud module (I think it got added when I clicked the 'Enable Services' button which meant that I could see the 'Push Notifications' tab, but it seems to still be listed whether the ti.cloud module is elected or not)..
Before..
Q - How to stop the Google Play error and retrieve the device token (oddly I was getting the token before enable services.
Q - Is ti.cloud used to receive the push notification, or is ti.cloudpush sufficient for this?
Thanks for the detailed question :) Let me go into some of the things you mention and clarify what I can.
If I look under Arrow (where I suspect it might be expecting to be listed) that's empty
As you later found out you have to enable platform services for your app which will create an ArrowDB app with the same name as your app. This app will have the Push Notifications in the sidebar to configure. I've updated the guide's wordings to make clear we mean the ArrowDB app, not the Titanium app.
(I'm not using Arrow - I thought it was an alternative UI using declarative XML)...
Don't confuse Arrow with Alloy - which is the MVC framework for Titanium which indeed uses XML.
How does the 'Google Developer Console' Application relate to the 'Google Play' application?! - if at all?
It doesn't. You can even have multiple apps share the same GCM sender.
[ERROR] : GooglePlayServicesUtil: The Google Play services resources were not found.
What did you use to test? A Genymotion emulator without Google Apps installed perhaps? You'll need that.
Is ti.cloud used to receive the push notification, or is ti.cloudpush sufficient for this?
ti.cloud is the module to communicate with ArrowDB, subscribe to channels etcetera. On Android you need ti.cloudpush (or as #Shawn mentioned another module) to retrieve the device token where on iOS you can use a Ti. API for that. Follow this guide for all steps.
You can ignore the Google Play Service error, but it seems your GCM Sender ID and/or API Key is wrong. Read through the tutorial and make sure you put down the right ones.
If you are using Appcelerator Cloud Service to send push notifications, you need ti.cloud to register the devices.
To get the device token and to receive push notifications, you use ti.cloudpush. There are other modules that you can use instead of ti.cloudpush.
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.
We succesfully set up and tested the sandbox Push notification certificate, now we are going to test the production certificate. We generated it in the same way as the development, and changed the apple adrress to the proper push notification service. But we don't get the push somehow although we even builded the app for distribution. I've heard also that the device tokens should be different to test production, what does it mean? Do I have to test on other devices?? Thanks
The device token will be different for the distribution certificate so the app have to send new token to the server (the one you receive in didRegisterForRemoteNotificationsWithDeviceToken).
Also make sure your distribution mobileprovisioning profile does have "aps-environment" string in it set to "production". If not - recreate the mobileprovisioning profile for the app.