This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendToTopics = (msg, title, topic, response) => { | |
const data = { | |
"data": { | |
"body": msg, | |
"title": title | |
} | |
} | |
data['to'] = '/topics/' + topic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendNotifications = (data) => { | |
const dataString = JSON.stringify(data) | |
const headers = { | |
'Authorization': 'key=<your firebase legacy server key>', | |
'Content-Type': 'application/json', | |
'Content-Length': dataString.length | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/notifications', (req, res) => { | |
res.sendFile(__dirname + '/notifcenter.html') | |
}) | |
app.post('/store', (req, res) => { | |
MongoClient.connect(url, (err, db) => { | |
if (err) throw err | |
else { | |
db.collection('tokens').insertOne(req.body, (err, body) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const app = require('express')(), | |
request = require('request'), | |
mongo = require('mongodb'), | |
bodyParser = require('body-parser') | |
app.use(bodyParser.json()) | |
app.use(bodyParser.urlencoded({ | |
extended: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.controller('homeController', ['$scope', function ($scope) { | |
$scope.$root.ld = { | |
"@context": "http://schema.org/", | |
"@type": "WebSite", | |
"name": 'My Wonderful Site', | |
"image": "https://mywonderfulsite.com/logo.png", | |
"description": 'We have the best content in the world', | |
"url": 'https://mywonderfulsite.com/' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* visit www.apple.com and look at | |
the source code to find it. | |
*/ | |
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@id": "https://www.apple.com/#organization", | |
"@type": "Organization", | |
"name": "Apple", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mynotificationsapp.android; | |
import android.app.Notification; | |
import android.app.NotificationManager; | |
import android.app.PendingIntent; | |
import android.content.Intent; | |
import android.support.v4.app.NotificationCompat; | |
import com.google.firebase.messaging.FirebaseMessagingService; | |
import com.google.firebase.messaging.RemoteMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CardView cardView = (CardView) findViewById(R.id.cardView); | |
cardView.setUseCompatPadding(true); | |
cardView.setContentPadding(30, 30, 30, 0); | |
cardView.setPreventCornerOverlap(true); | |
cardView.setCardBackgroundColor(Color.WHITE); | |
cardView.setCardElevation(2.1f); | |
cardView.setRadius(0); | |
cardView.setMaxCardElevation(3f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.CardView | |
android:layout_width="match_parent" | |
android:layout_height="250dp" | |
app:cardBackgroundColor="@android:color/white" | |
app:cardCornerRadius="0dp" | |
app:cardMaxElevation="1dp" | |
app:cardElevation="0.7dp" | |
app:contentPadding="10dp" | |
app:contentPaddingBottom="0dp" | |
app:cardPreventCornerOverlap="true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.mynotificationsapp.android"> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" |