Ionic 2 Cloud services - ionic-framework

I've built an ionic app that uses Ionic Cloud services to subscribe to FCM Push notifications. Currently, I receive the notifications whenever it's sent.
It requires 'CloudSettings' const to be configured in the app-module.ts, where the Push configurations like sender-id, android and ios specific configuration including GCM topics could be provided.
Now, I want to subscribe to additional topics based on the user selection. How to subscribe to different topics (dynamically) with Ionic 2 Cloud Services?
As 'CloudSettings' is a constant and imported in the app module, it could not be overridden. Is there any way to override the configuration?
I tried to reset the value for push.PushOptions before registering to, but it's not working. Any solution to this would be appreciated.

You can use something like azure notificaton hubs. They allow multiple tagging and registration for single devices.
Create a backend app to manage sending and subscriptions and register via this instead of the ionic backend.
There are lots of tutorials to support this, but ultimately once the push registration was completed and the FCM token returned,I manually registered this via my .NET backend where I can control the tags and allow them to be easily updated depending on user preferences. The backend app can then be used to broadcast notifications depending on the tags you want to receive them

Related

How to setup a serverless webhook for a macOS / iOS app?

For background, we have a standalone macOS / iOS app. These apps connect to Google Calendar to retrieve a user's calendar events. Google Calendar supports notifying clients (i.e. our app) of any changes that may occur remotely to an event via a webhook. We don't have a backend / cloud server.
Is there a service that allows one to setup a serverless webhook which also supports Push notifications (or direct network streaming) so that our app can be notified on-demand when there's a change? I wish to achieve this:
Our app connects to Google Calendar
Google Calendar notifies us of changes via the webhook (a serverless webhook)
The serverless webhook notifies our app - i.e. the user's installed copy - (via Push / network connection that we opened at launch), passing on the notification as the payload, including headers etc.

Firebase Cloud Massaging - Push Notifications Server Keys Handle

I want to add push notification to my app with Firebase Cloud Messaging but I don't know the right way to set this up.
My App Logic is: I have multiple customers (companies) who host their own server's own database and their own users. Some of the employees of the different customers will download the app to receive push notifications from their company's server which implements the firebase admin SDK to send push notifications.
How is it possible to handle all customers from one FCB or is it even possible?
So the customer can just enter the created „server key/topic or project id / UUID“ to his server configuration and can receive the push notification.
They should also not be allowed to see any data from other customers or send messages to them.
At the end of the day, I need to handle all customer
Using the Admin SDK allows one to send messages, it does not allow you to receive messages. So from that perspective it sounds like the approach suits your needs.
The customers using the Admin SDK will also get full administrative access to your entire Firebase project though. So if you use any other Firebase products aside from Cloud Messaging, that would be a security risk.

Is it possible to create Custom Push Notifications with a REST service backed server?

I have an OpenEdge database, I have created a REST Service and am able to CRUD to it from the outside World.
I have created a Nativescript app that can pull data from the REST service etc, but now i want Push notifications.
I know about the Progress Kinvey backend, and Firebase backend with their push notification features but i don't want to use them.
is there a way to create my own Push notifications on my REST server etc?
So first I would like you to understand how Push Notification works just to make sure we are on same page,
Once your app is installed, you can query for a unique token and save it in your backend for future use. Whenever you want to send a push notification, you have communicate with APNs (Apple Push Notification Server) / FCM (Firebase Cloud Messaging) in order to send a push notification to your iOS / Android device using the unique token you acquired earlier.
So now you must use Firebase as that is the only way you can communicate with Android, yet you may choose to communicate with APNs yourself. But in my opinion, it will be a overhead for you as both have their own protocols, you will have to distinguish your tokens between iOS & Android, use appropriate protocols etc.,
I would suggest you to go with just Firebase plugin (until you are super familiar with APNs already), so you don't have to worry which platform the token belongs to, update / revoke invalid tokens over time etc., FCM has pretty decent APIs & Documentation that can make your life easy here.
i strongly recommend you to see my answer here answer here.
from it:
when you want to pull anything from place_1(e.g. api) to place_2(e.g. browser_client) you most have an identifier of the
place_1_resource (which commonly is the uniform-resource-locator of
api)
when you want to push anything from place_1(e.g. notification_central_server) to place_2(cellphone_client) you most
have an identifier of the place_2_resource
if you don't have any identifier for a cellphone which you want to
send it a notification, your server dont know where to send that
notification so we need a resource_identifier_like for cellphones
which is actually a device_token_like and you have just one approach
to get this device_token_like and that is the FCM/APNS

Real-time notifications with Firebase & Ionic

NOTE : Don't say it's possible duplicate of this, Read through.
Think of a simple TASK Management application which can have n number of users. Say User A can create a task & assign it to User B. I want to show a notification to User B.
I am using Firebase as BAAS and following code-snippet prints on console only when there is a task assigned to User B. To simplfy, Users collection in Firebase has a node called tasksAssignedToThisUser array and callback function will be watching tasksAssignedToThisUser location. Whenever a new task gets added to that array, callback function gets executed. Here is the code snippet:
var rootRef = firebase.database().ref();
rootRef.child('users').child(loggedInUserID).child('tasksAssignedToThisUser')
.on('child_added', function (newMessageSnapshot) {
console.log('Someone assigned a task to this user.');
console.log(newMessageSnapshot.val);
});
Everything works fine until here.
What I have understood by reading Firebase docs & other post's on SO about Push notifications or Firebase Cloud Messaging is:
Firebase Notifications lets users easily send messages to reengage and
retain users, foster app growth, and support marketing campaigns.
Before you can write client apps that use Firebase Cloud Messaging,
you must have an app server that meets the following criteria:
...
You'll need to decide which FCM connection server protocol(s) you want
to use to enable your app server to interact with FCM connection
servers. Note that if you want to use upstream messaging from your
client applications, you must use XMPP. For a more detailed discussion
of this, see Choosing an FCM Connection Server Protocol.
This is definitely not what I want and maintaining a server for sending push notifications makes sense when bulk messages needs to be pushed to large number of devices. So I didn't name my question as Real Time Push Notifications.
I see a function being executed, which meets my use-case and I just want app to display a notification to the user in his mobile system tray on that callback function execution.
I am using Ionic 1 for developing app, completely new to Firebase and Ionic too. If there is a simple serverless approach that Firebase itself provides which can suffice my requirement, then I would be more than happy to hear about it.

Implementing Apple Push Notification without an access to a source server

I'd like to implement some push notifications from Twitter in my app. I can connect to Twitter's stream of user-related events using Sreaming API. Do I need some 'middleman' server between Twitter API and an iPhone app in order to push a notification to an app ? Maybe I can do it using Parse.com Cloud Code or something similar ?
This question may be helpful not only in the case of the Twitter API but also in case of any server that a developer don't have any access to.
To push a notification you would generally need a server of your own which has been configured to send a notification when some event occurs. If you are using Parse as a backend for your app, you can leverage their backend to allow you to implement Push Notifications or use a service like UrbanAirship
In the case of the Twitter API, you will need to implement some middleman in either case to get the data from Twitter for your user and parse it to see whether some event has occurred and then send off a notification either using your own custom logic directly to Apple's servers or using Parse or UrbanAirship (or some other service)