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 suspend fun savePref(currency: String, min: Double, max: Double) { | |
| val instanceId = FirebaseInstanceId.getInstance().instanceId.await() | |
| val data = mapOf( | |
| "${currency}_min" to min, | |
| "${currency}_max" to max, | |
| "token" to instanceId.token | |
| ) | |
| db.collection("prefs").document(instanceId.id) | |
| .set(data, SetOptions.merge()).await() | |
| } |
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 val db = FirebaseFirestore.getInstance() | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setupPriceListeners() | |
| } | |
| private fun setupPriceListeners() { | |
| db.collection("prices") | |
| .addSnapshotListener(EventListener<QuerySnapshot> { value, e -> |
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 firebase_admin | |
| from firebase_admin import messaging | |
| from firebase_admin import firestore | |
| firebase_admin.initialize_app() | |
| client = firestore.client() | |
| snapshot = client.collection('users').document('alice').get() | |
| data = snapshot.to_dict() | |
| msg = messaging.Message( |
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'); | |
| const HttpsProxyAgent = require('https-proxy-agent'); | |
| const agent = new HttpsProxyAgent('http://localhost:3128'); | |
| const app = admin.initializeApp({ | |
| credential: admin.credential.applicationDefault(agent), | |
| httpAgent: agent | |
| }); | |
| (async () => { | |
| const db = admin.firestore(); |
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
| package main | |
| import ( | |
| "context" | |
| "log" | |
| firebase "firebase.google.com/go" | |
| "firebase.google.com/go/messaging" | |
| ) |
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 com.google.api.client.http.HttpTransport; | |
| import com.google.api.client.http.javanet.NetHttpTransport; | |
| import com.google.auth.http.HttpTransportFactory; | |
| import com.google.auth.oauth2.GoogleCredentials; | |
| import com.google.firebase.FirebaseApp; | |
| import com.google.firebase.FirebaseOptions; | |
| import com.google.firebase.messaging.FirebaseMessaging; | |
| import com.google.firebase.messaging.Message; | |
| import com.google.firebase.messaging.Notification; |
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 com.google.auth.oauth2.GoogleCredentials; | |
| import com.google.cloud.firestore.DocumentSnapshot; | |
| import com.google.cloud.firestore.Firestore; | |
| import com.google.firebase.FirebaseApp; | |
| import com.google.firebase.FirebaseOptions; | |
| import com.google.firebase.messaging.FirebaseMessaging; | |
| import com.google.firebase.messaging.Message; | |
| import com.google.firebase.messaging.Notification; | |
| public class Main { |
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 appId = '1:134547978015:android:967eb1618809ce3a'; | |
| const androidApp = admin.projectManagement().androidApp(appId); | |
| const metadata = await androidApp.getMetadata(); | |
| console.log(metadata.appId, metadata.packageName, metadata.displayName); |
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 androidApps = await admin.projectManagement().listAndroidApps(); | |
| androidApps.forEach(async (androidApp) => { | |
| const metadata = await androidApp.getMetadata(); | |
| console.log(metadata.appId, metadata.packageName, metadata.displayName); | |
| }); |
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 packageName = 'com.google.firedemos'; | |
| const displayName = 'FireFlicks'; | |
| const app = await admin.projectManagement().createAndroidApp(packageName, displayName); | |
| console.log('Created new Android App:', app.appId); |