Using Amazon SNS with React Native - ios

Can anyone provide a simple example of using the Amazon SNS service to send and receive Push Notifications under React Native?
I've got the Amazon SNS service setup, and I can publish a message from the website and have it appear on an iPhone – if I manually enter the device token and initiate the publish on the Amazon website. Now I want to automate the process of registering the Push Token in Amazon SNS, and allow the app to Publish a push to the SNS service.
I know that Amazon has a very new project to integrate their SDK into React Native, but I cannot get it working. Support on that repo is spare too, so I'm hoping someone here can help.
Right now what I get is: Undefined is not an object (evaluating 'cognateClient.initWithOptions')
The GitHub issues mention something similar on Android, but obviously that doesn't help with my iOS app.
What I'm looking for is a step-by-step breakdown of how to integrate Amazon's code in to an existing RN app. They don't provide a standard Node package, so I'm struggling to figure out how to get the React Native code and the SDK to play nice with Xcode.
Any suggestions? Thanks!

There's no 'integration' of AWS into the RN app needed. You just need the device token from RN.
Use a package like RNPN (https://github.com/zo0r/react-native-push-notification) in order to get the device token your phone generates. When you have that, make a call to your api, and your api is then responsible to call out to SNS to register that device token as an SNS 'endpoint'.
Translate this pseudo-code into whatever your API is written in: https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html
In short...
RNPN onRegister ->
POST /registerDevice on your api ->
call AWS
createPlatformEndpoint from your api ->
start sending messages from your api
Most likely you'll want to store some relationship from user -> deviceToken+platformEndpoint in your db/data store.
Then you can send notifications from your api. Wrote up how to do that here: https://medium.com/#duhseekoh/send-a-push-notification-using-aws-sns-javascript-sdk-2f117e9c4180

Im using react-native-fcm with Amazon sns, it will register my device token and then we are sending that token to our php solution that then add the device to a subscription on a topic in SNS, passed back to the app is the subscription token and endsub tokens. Then we Push Messages to the topic thru SNS. Works on both iOS and Android.

Related

Push notification using FCM for web app in Ruby on rails

I have previously worked on push notifications with FCM for android app. From Firebase console i got server key to which my backend program hits when the notification were expected to be delivered. Also I could easily get the device token from the console(on client side) to which the server would send the push messages.
Now in similar way i would like to implement web push notification using FCM. Unfortunately, could not find FCM set up and implementation documentation using ruby. Besides bit confused as to how i can get the device token for web client to whom i would like to send push message/notification. What things do i need to look at and that i am missing?
I have come across web push gem and terms like VAPID keys and service worker but still confused how they work with FCM. If anyone could help me out with what i should be looking at and what i am missing. Thanks for reading this far.
Getting the FCM token for a device is only supported in client-side code. For web applications, see the documentation on getting the registration token. You can then pass the token from the client to Ruby backend, where you can store and use it to send a notification to that specific client.
To send a message to the token from your Ruby code, you can call the FCM REST API, after providing proof that your request is authorized with one of the methods outlined in the docs on authorizing send requests.
If you're having trouble making this work for your use-case, it's more likely that someone can help if you edit your question to show what you tried based on the above information and other existing resources.

Azure Notification Hub to Apple and Android

We build an iOS app using Apple Push Notification feature. We integrated everything the Apple docs told including provisioning profiles etc... A test in development mode worked fine with Apple tools. Same should be in near future with Google, but I´m talking here just about iOS implementation...
Our backend on Azure collects the registration ids from all iOS apps proper. I mean: We are storing the token retrieved from registration directly at Apple services.
Now we want to use Azure to send Push Notifications to all our apps. But I´m confused from reading the Microsoft documentation:
Must my mobile apps register to Apple or to Microsoft with corresponding SDK?
We don't use the MS SDK on app side. We just register at Apple. Can we send Push Notifications to our iOS apps (just simple broadcast to all registered apps) with Azure?
Our backend on Azure collects the registration ids from all iOS apps proper. I mean: We are storing the token retrieved from registration directly at Apple services.
Where are you storing them? You have to store/register the device tokens at your Azure Notification Hub.
Must my mobile apps register to Apple or to Microsoft with corresponding SDK?
Your app has to get a device token from APNS and then register this token at your Azure Notification Hub, so basically you have to do both.
Have a look at the documentation here. On a high level the whole process looks like this:
We don't use the MS SDK on app side.
You don't have to use the SDK, you can use the REST API.

Stripe Connect payment in iOS

We want to integrate Stripe Connect with iOS application to transfer amount from one person to person.
Let's say, I want to transfer $100 to my sister's account using Stripe Connect Standalone/Managed Account. And we also want to take business commission from sender which includes stripe commission also.
We have gone through Sharing Customers also but won't be able to find any solution for Stripe Connect with iOS SDK.
We have also checked iOS SDK.
Can anyone please guide us how to integrate Stripe Connect with iOS mobile app in above scenario?
How can we transfer payment to end customer?
Do we need to integrate through iOS SDK or web page?
Stripe's iOS and Android SDKs serve the same purpose in a mobile application as Checkout or Stripe.js do in a web application: they take payment information and produce a token in return.
Once the token has been created, it must then be sent to a backend server where it can be used in API requests sent with the secret key. You can't create charges or transfers directly from your mobile app -- that must be handled by an external server.
(Also, please note that there might be compliance issues with what you're trying to do. I recommend you reach out to Stripe's support to explain your usecase and make sure it's something that Stripe can support.)
You can easily integrate Stripe Connect with your iOS app check the following link
https://github.com/gurunglaxman0/StripeConnect-iOS
Once you connect your stripe user id with server you can create charges and application fee using Stripe Api's from backend

How To Create endPoint in SNS in iOS8?

I am able to receive notifications from SNS Console. However, I want to create the endPoints from the app instead of manually in the console. I have looked at iOS7 code, but the classes needed to create the endPoints no longer exist in AWS SDK v2.0.8.
Could anyone who's got it to work post a simple example of creating the endPoint?
Thanks in advance.
We have SNS Mobile Push and Mobile Analytics Sample in our GitHub repo. It demonstrates how to create a platform endpoint.

What is the most efficient way to create end-points for an Amazon SNS service?

I am using Amazon SNS Service for an iOS application that needs push notifications.
I have figured most of the things, except for the part where I have to register my device tokens.
This is where Amazon talks about it. It can be done manually or with the help of createPlatformEndpoint API which they obviously recommend for bulk uploads. My question is how we can directly register tokens from devices that will install the app later on. The documentation talks about a proxy server which I would want to avoid as of now. Isn't there a direct way of doing this, like where I can directly call a method and push the device token received in the application to my SNS Platform?
This, is a possible duplicate except that it is in reference to Android.
The AWS Mobile SDKs support accessing SNS directly from the mobile device. If you're interested in seeing code demonstrating this on iOS, we included some as a sample we prepared for re:Invent 2013 called Mobile Photo Share.
The important thing to note when accessing SNS directly from the mobile device is that you'll want to restrict the credentials delivered to the device to only those services and resources you'll need to access. You can accomplish this via web identity federation or a token vending machine with appropriately restricted policy.
If you want to learn more about the Mobile Photo Share app, we had two talks at re:Invent about the app and its architecture. The video and slides for those talks are available here:
Building Cloud-Backed Mobile Apps
Integrating Social Login Into Mobile Apps

Resources