How to get push notifications on react-native App? - ruby-on-rails

I have made a mobile app using react-native (only android for now and it is not an expo app) and I would like to add push notifications to this app. The app is some kind of a social media and when the user is on scrolling the "news feed" the mobile app makes each 3 seconds a request on the server to see if there is a new notification.
On the server is a Ruby on Rails web-app that has a small dashboard so the admin can block misbehaving users and there are some API controllers that return JSON-s for the mobile app.
So the mobile app will make a request to the notifications controller and if there are any new notifications user will see them on the react-native mobile app.
When the mobile app is closed and there is a new notification on the server the user won't see it until the mobile app is active and can make requests to the notifications controller.
Is there some way to notify the user when the app is closed? I found this service:
https://github.com/geektimecoil/react-native-onesignal
At this time I'm not using Firebase but if I have understood it correctly I will somehow need to send the new notification that is created in my Ruby on Rails web-application to the Firebase service and then will Onesignal service get it from Firebase and display it as a push notification on the users smartphone even if the mobile application is closed?
Have I understood it correctly? Is there some easier way to achive my goal or some good tutorial that will help me to implement it like described?

I have used onesignal for my application which works amazing with android and ios if you want I can share the git repo for the same. It will work like a charm as you are not using expo, it is difficult with expo

Related

Will Angular SwPush & web-push work when the browser is closed

I followed this tutorial to create push notifications through an Angular app & nodejs service:
https://malcoded.com/posts/angular-push-notifications
My question is, will these notifications come up when the browser is closed? Or, will they come up on mobile when the mobile browser is closed?
Because, I am looking for a way to create mobile push notifications (the same type of push notifications that app's use) but from the Angular app. The goal of course it to be able to send the user push notifications while the user isn't on the Angular web app. Stuff like "Hey! A new booking has been made. Go check out your online profile quickly!"

How does iphone Notifications on Websites works? Is need to install Application?

I have problem with understand how "Push Notifications on Websites" works on Iphone, Ipad, etc.
Default Browser Notifications don't work on mobile, but this: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/Introduction/Introduction.html
should be work fine!
There is good documentation how to install it, but how it works on user?
As i see, it`s 2 variants:
1) Modal Window to allow using notifications in browser like it`s working with default JS Notifications.
or:
2) Link to install application in AppStore. So, user install to device application.
So, if user download application, does this application add to desktop on device as other applications? What happing when user click on icon? Does click on application on desktop activate safari and open web-site? Or is it hidden application without icons on desktop?
I try to find some sites to check examples how it will work with my iphone, but i didnt find any sites. All popular sites say: "download application and active notifications THERE and use application for website".
So, i don't need special application for my site, adaptive design is awesome for me, but i want to use notifications on iphone!
Please, help me :) Thank you!
As you noticed the document states that this feature is available on OSX not on iPad, iPhone.
We see this notifications when we open a website on Safari. For instance,
As soon as we click the allow button, our Macbook communicates with Apple Push Notification Service to establish a persistent IP connection (along with a token exchange). When the website servers send notifications to the Apple Push Notification Service it forwards that notification to our Macbook/iMac.

How to receive an email alert if particular event occur in iOS app

We have multiple iOS apps live in Apple App Store. We want to receive email notification as soon as any critical event occur in our app. We are using Crashlytics SDK and it notifies us whenever the app crashes but there are other scenarios where we want to receive email notifications.
The only way to achieve this is making API call & from backend you can get email for particular event. Its because Apple doesn't allow to send email without opening the default Mail Picker.
Other options is, Integrate any third party analytics & using which you can do coding for registering the event. Then you will get that event registered at backend for your review.
Awesome third party analytics, Google Analytics, Flurry, MixPanel
Hope it helps.
Till now the best SDKs I've used are NewRelic & Segment both are awesome & different !! You should surely check them once. Easy to integrate and will show you everything you need from your app. This is just from my personal experience.

Will an iOS app that only opens a UIWebView and uses push notification get rejected from apple?

I am developing an application that does exactly 2 things.
1) Opens a UIWebView
2) Uses push notification
I am opening a UIWebView where i load an external URL , and there the user can subscribe to various kinds of events. After he subscribes he can get push notifications about them.
I am asking because some people told me that their apps got rejected when they were just loading an external URL , because apple said it could better be a web page and not an iOS app.
But in my case where i use push notifications? Does it count differently?
The reason why WebView only apps are beeng rejected is because they dont use any of the features that the framework is offering. I got in an application that had only one view for log in, and after log in, the response was URL from server that I was showing in WebView.
You will never know unless you try, but I think it will get in.
I have successfully submitted 3 apps which are all WebViews but with Push Notification functionality. As long as you have Push Notifications in your app you will meet the guidelines of having framework dependant features in your app rather than just being a simple WebView in a mobile app.
"Your app did not include iOS features. App Store apps should use native iOS buttons and include iOS features other than just web views, push notifications, or sharing."
source: Apple rejecting Ionic apps, date: Jan, 2019
“Your app provides a limited user experience as it is not sufficiently different from a mobile browsing experience. Specifically, we notice that most of the app content links out to Safari. As such, the experience it provides is similar to the general experience of using Safari. Including iOS features such as push notifications, Core Location, and sharing do not provide a robust enough experience to be appropriate for the App Store. … the App Store does not accept or distribute web apps.”
source: App Store Rejection 4.2 - Design: Minimum Functionality, date: Dec 2020, But seems it was resolved.
Conclusion: YMMV = Your Mileage May Vary.

Registering and posting Facebook achievements from an iOS app

I have an existing iOS app on the App Store that includes Game Center achievements. Since it also has a working Facebook Connect implementation, I'd like to leverage the social channels available through the new Achievements Graph APIs with my apps.
I have created the corresponding achievement pages ready to be registered with Facebook as achievements for my app. From what I have read, since the app auth token has to be used to submit achievements and scores, I'm doing all of this on my server using some PHP scripts so I don't have to ship my secret key with my app binaries. I'm planning to have my iOS app call a script on my server when submitting achievements or scores.
I am using the same FB app that I use for the native iOS app. Obviously I want it to start generating stories and timeline events when the user unlocks achievements or reaches a new high score.
However I am running into a big stumbling block when trying to register the achievements for the FB app. I get the following error with the script that does the registration :
OAuthException: (#15) This method is not supported for native apps
I seem to be doing everything right, sending a POST to the /<appid>/achievements API with the URL for the achievements, etc.
In an effort to work around limitations on these API by Facebook, I have also enabled the existing mobile app to also be a "Website" and "App on Facebook" in the developer settings. To no avail.
So my question is... am I missing something to enable achievements that could be submitted from an iOS app through an intermediary server? I don't mind setting up canvas pages and so on if necessary, but I'd rather not have the users re-authenticate as a wholly separate app just so they can post achievements and scores to their Facebook stream.
What I'm trying to achieve is at most ask the user for additional permissions on the existing app on their devices, if necessary. It should be possible to invoke a script on my server that will push the achievements to Facebook when needed - but how ?
Is the only way to do this to use a separate FB app that is not set as a native mobile app at all, or can it be a combination native/Web app?
It means you've probably configured your application on Facebook's side as 'Native/Desktop' instead of 'web'.
In this configuration your app secret is untrusted because it's assumed you've shipped it with the client code - there's no reason your IOS app won't work in 'web' mode, so use that instead
(I'm assuming you haven't actually shipped your app secret in client code - if you have, it's a huge security problem unless your app is set to 'Native/Desktop')

Resources