This file contains hidden or 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
var admin = require('firebase-admin'); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
databaseURL: 'https://database-name.firebaseio.com' | |
}); |
This file contains hidden or 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
{ | |
"databaseURL": "https://database-name.firebaseio.com", | |
"projectId": "my-project-id", | |
"storageBucket": "bucket-name.appspot.com" | |
} |
This file contains hidden or 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
var admin = require('firebase-admin'); | |
admin.initializeApp(); |
This file contains hidden or 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
import asyncio | |
import time | |
from firebase_admin import db | |
async def get_hero(key): | |
ref = db.reference('heroes').child(key) | |
# Calling a blocking method from a coroutine | |
return ref.get() |
This file contains hidden or 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
import asyncio | |
import concurrent.futures | |
import time | |
from firebase_admin import db | |
executor = concurrent.futures.ThreadPoolExecutor(max_workers=20) | |
async def get_hero(key, event_loop): | |
ref = db.reference('heroes').child(key) |
This file contains hidden or 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
handlers=java.util.logging.ConsoleHandler | |
.level=INFO | |
com.google.level=FINE | |
java.util.logging.ConsoleHandler.level=ALL | |
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n |
This file contains hidden or 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
.level=INFO | |
com.google.firebase.level=FINE | |
java.util.logging.SimpleFormatter.format='%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %2$s %5$s%6$s%n' |
This file contains hidden or 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"?> | |
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> | |
<application>${app.id}</application> | |
<version>${app.version}</version> | |
<threadsafe>true</threadsafe> | |
<runtime>java8</runtime> | |
<system-properties> | |
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/> | |
</system-properties> | |
</appengine-web-app> |
This file contains hidden or 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 admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const message = { | |
notification: { | |
title: 'EPA fuel economy stats for new Mazda6', | |
body: 'New turbo charged 2.5L engine does 23/31/36 mpg.', | |
}, | |
condition: `'auto-news' in topics && 'green-earth' in topics`, |
This file contains hidden or 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
private static final String ANDROID_NEWS_ICON_RESOURCE = "news_alert_icon"; | |
private static final int APNS_NEWS_BADGE_RESOURCE = 42; | |
private static final String WEBPUSH_NEWS_ICON_URL = "https://auto.news.url/alert.png"; | |
public String sendAutoNewsAlert(String title, String body) throws Exception { | |
Message message = Message.builder() | |
.setNotification(new Notification(title, body)) | |
.setAndroidConfig(AndroidConfig.builder() | |
.setNotification(AndroidNotification.builder() | |
.setIcon(ANDROID_NEWS_ICON_RESOURCE) |