-
Notifications
You must be signed in to change notification settings - Fork 1
Android Notifications
A push notification that shows up on the pulldown "tray" on the phone. Text notifications are not push notifications. The user has to have opted into receiving those push notifications when they either download the app or later when they adjust their push notifications.
The Framework is called Pinpoint.
You are able to send notifications on the AWS dashboard and appear on phone. Pinpoint > All projects > project... Go to Campaigns. No code is involved to send a notification.
- A deep link is a specific activity in the app
- media urls set allows you to set the image set in the notification. Must choose a nice png - square with a background that is transparent.
- Can put url into Android icon or Android small icon, for example
Worry about:
- If I want to notify a user about something, and they are logged into a ton of devices, do you notify all of those devices?
- What counts as reading a notification
- What data do you get after the notification?
The way you are able to send push notifications: Code runs on an app You want to trigger a push notification when something happens in the cloud, not necessarily when something happens on the app.
- The user's phone
- AWS
- Your stuff - your server / dynamo stuff / lambdas
- Phone to Google: "Hello, give me your Device Token"
- Google gives a device token
- App registers with AWS - "register me! My token is ____"
- AWS and Poinpoint stores that device token associated with the logged in user (integrates with Cognito)
- Someday in the future... a marketing person logs into the AWS pinpoint console, or you use a lambda function or something, and from where-ever, you talk to AWS, and you say, "send notification (text and who the notification goes to).
- AWS makes a request to Google - "hey, send notifications to these device tokens"
- Google uses that device token to reach back to the phone and say, "hey, show this push notification"
- The phone's app will run code that has been listening for a push notification.
It's not too large...
For a demo from Code401-Java-d6, see Front Row on Thurs, November 7, 2019 from 4pmish, give or take.
- A Simple Notification Service
In the terminal:
amplify add notifications
- You must use FCM - firebase cloud messaging - to send push notifications to an Android phone.
Firebase makes it so you only need the following thing, instead of a fancy passwordy thing: https//console.firebase.google.com. This opens up a console of firebase projects I've done.
In firebase, go to the gear > project settings, go to cloud messaging, which has a server key. Copy the key, and copy into the CLI
Go back to firebase. Hit the android icon in create an app, or something. Follow instructions
Go to Push Notifications
Don't worry about them on AWS. They aren't working yet.
Also, go to console.firebase.google.com/project/--- project name ---:
- Can write a test message here.
Can totally use Firebase instead of AWS, because it's soooo easy to use. They are great for little apps - their free tier is always free. However, when you upgrade, they are somewhat more expensive than AWS.
- Cloud FireStore
- CLoud functions
- Analytics
- Everything amplify can do