├── .gitignore ├── IoTTemperatureTracking ├── logTemperatureReading.js ├── no_hardware.js ├── package.json ├── temp.agent.nut ├── temp.device.nut └── twilio_webhook.js ├── LICENSE ├── README.md ├── StitchSamplePushNotificationApp ├── .gitignore ├── .idea │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── mongodb │ │ │ └── example │ │ │ └── pushnotification │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── mongodb │ │ │ │ └── example │ │ │ │ └── pushnotification │ │ │ │ ├── MainActivity.java │ │ │ │ └── MyFirebaseMessagingService.java │ │ └── res │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── content_result.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── mongodb │ │ └── example │ │ └── pushnotification │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── basic-blog ├── README.md └── blog.html ├── blog-comments-simple ├── Makefile ├── README.md ├── base.html ├── good.html └── pieces │ ├── middle1.md │ └── opening.md ├── dashboard ├── README.md ├── appdir │ └── dashboard-stitch │ │ ├── auth_providers │ │ └── local-userpass.json │ │ ├── functions │ │ ├── getPopularToppings │ │ │ ├── config.json │ │ │ └── source.js │ │ └── salesTimeline │ │ │ ├── config.json │ │ │ └── source.js │ │ ├── services │ │ ├── PizzaOrderAPI │ │ │ ├── config.json │ │ │ └── incoming_webhooks │ │ │ │ └── addOrder │ │ │ │ ├── config.json │ │ │ │ └── source.js │ │ └── mongodb-atlas │ │ │ ├── config.json │ │ │ └── rules │ │ │ └── SalesReporting.Receipts.json │ │ └── stitch.json ├── chart.js ├── dashboard.js ├── data_generator.js ├── index.html ├── package.json └── style.css ├── iot-security-system ├── Makefile ├── README.md ├── stitch │ ├── .gitignore │ ├── auth_providers │ │ ├── api-key.json │ │ └── oauth2-google.json │ ├── secrets.json │ ├── services │ │ ├── http │ │ │ ├── config.json │ │ │ └── incoming_webhooks │ │ │ │ └── button_pressed │ │ │ │ ├── config.json │ │ │ │ └── source.js │ │ └── mongodb-atlas │ │ │ ├── config.json │ │ │ └── rules │ │ │ ├── security-system.images.json │ │ │ └── security-system.settings.json │ └── stitch.json └── web │ ├── .gitignore │ ├── .prettierrc │ ├── README.md │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json │ ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── registerServiceWorker.js │ └── yarn.lock ├── stitch-quickstarts ├── auth_providers │ ├── anon-user.json │ └── local-userpass.json ├── functions │ ├── check2faCode │ │ ├── config.json │ │ └── source.js │ ├── generate2faCode │ │ ├── config.json │ │ └── source.js │ └── lookupPhoneNumber │ │ ├── config.json │ │ └── source.js ├── services │ ├── http │ │ ├── config.json │ │ └── rules │ │ │ └── allowGet.json │ ├── mongodb-atlas │ │ ├── config.json │ │ └── rules │ │ │ ├── HR.direct_reports.json │ │ │ ├── HR.employees.json │ │ │ ├── quickstart.2fa.json │ │ │ └── quickstart.messages.json │ ├── s3 │ │ ├── config.json │ │ └── rules │ │ │ └── allowQuickstartPut.json │ └── twilio │ │ ├── config.json │ │ ├── incoming_webhooks │ │ └── textMessageHandler │ │ │ ├── config.json │ │ │ └── source.js │ │ └── rules │ │ └── allowSendFromOurPhone.json └── stitch.json └── todo ├── .gitignore ├── README.md ├── android-mobile ├── .gitignore ├── .idea │ ├── caches │ │ └── build_file_checksums.ser │ ├── codeStyles │ │ └── Project.xml │ ├── gradle.xml │ ├── modules.xml │ └── runConfigurations.xml ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proguard-rules.pro ├── settings.gradle └── todo │ ├── .gitignore │ ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── gradle.xml │ ├── libraries │ │ ├── animated_vector_drawable_25_0_0.xml │ │ ├── appcompat_v7_25_0_0.xml │ │ ├── bolts_android_1_4_0.xml │ │ ├── bolts_applinks_1_4_0.xml │ │ ├── bolts_tasks_1_4_0.xml │ │ ├── bson_3_5_0_SNAPSHOT.xml │ │ ├── cardview_v7_25_0_0.xml │ │ ├── commons_lang3_3_5.xml │ │ ├── customtabs_25_0_0.xml │ │ ├── design_25_0_0.xml │ │ ├── facebook_android_sdk_4_21_1.xml │ │ ├── jackson_annotations_2_0_1.xml │ │ ├── jackson_core_2_0_1.xml │ │ ├── jackson_databind_2_0_1.xml │ │ ├── library_1_0_19.xml │ │ ├── play_services_auth_10_2_1.xml │ │ ├── play_services_auth_base_10_2_1.xml │ │ ├── play_services_base_10_2_1.xml │ │ ├── play_services_basement_10_2_1.xml │ │ ├── play_services_gcm_10_2_1.xml │ │ ├── play_services_iid_10_2_1.xml │ │ ├── play_services_tasks_10_2_1.xml │ │ ├── recyclerview_v7_25_0_0.xml │ │ ├── stitch_0_1_0_SNAPSHOT.xml │ │ ├── support_annotations_25_0_0.xml │ │ ├── support_compat_25_0_0.xml │ │ ├── support_core_ui_25_0_0.xml │ │ ├── support_core_utils_25_0_0.xml │ │ ├── support_fragment_25_0_0.xml │ │ ├── support_media_compat_25_0_0.xml │ │ ├── support_v4_25_0_0.xml │ │ ├── support_vector_drawable_25_0_0.xml │ │ └── transition_25_0_0.xml │ ├── markdown-navigator.xml │ ├── markdown-navigator │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ └── workspace.xml │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── stitch.properties │ ├── java │ └── com │ │ └── mongodb │ │ └── stitch │ │ └── sdk │ │ └── examples │ │ └── todo │ │ ├── MainActivity.java │ │ ├── TodoItem.java │ │ └── TodoListAdapter.java │ └── res │ ├── drawable │ ├── ic_add_circle_black_24dp.xml │ └── ic_add_white_48px.xml │ ├── layout │ ├── activity_main.xml │ ├── activity_main_todo_list.xml │ ├── add_item.xml │ └── todo_item.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── android ├── .gitignore ├── .idea │ ├── codeStyles │ │ └── Project.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── README.md ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proguard-rules.pro ├── settings.gradle └── todo │ ├── .gitignore │ ├── .idea │ ├── codeStyles │ │ └── Project.xml │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── gradle.xml │ ├── libraries │ │ ├── animated_vector_drawable_25_0_0.xml │ │ ├── appcompat_v7_25_0_0.xml │ │ ├── bolts_android_1_4_0.xml │ │ ├── bolts_applinks_1_4_0.xml │ │ ├── bolts_tasks_1_4_0.xml │ │ ├── bson_3_5_0_SNAPSHOT.xml │ │ ├── cardview_v7_25_0_0.xml │ │ ├── commons_lang3_3_5.xml │ │ ├── customtabs_25_0_0.xml │ │ ├── design_25_0_0.xml │ │ ├── facebook_android_sdk_4_21_1.xml │ │ ├── jackson_annotations_2_0_1.xml │ │ ├── jackson_core_2_0_1.xml │ │ ├── jackson_databind_2_0_1.xml │ │ ├── library_1_0_19.xml │ │ ├── play_services_auth_10_2_1.xml │ │ ├── play_services_auth_base_10_2_1.xml │ │ ├── play_services_base_10_2_1.xml │ │ ├── play_services_basement_10_2_1.xml │ │ ├── play_services_gcm_10_2_1.xml │ │ ├── play_services_iid_10_2_1.xml │ │ ├── play_services_tasks_10_2_1.xml │ │ ├── recyclerview_v7_25_0_0.xml │ │ ├── stitch_0_1_0_SNAPSHOT.xml │ │ ├── support_annotations_25_0_0.xml │ │ ├── support_compat_25_0_0.xml │ │ ├── support_core_ui_25_0_0.xml │ │ ├── support_core_utils_25_0_0.xml │ │ ├── support_fragment_25_0_0.xml │ │ ├── support_media_compat_25_0_0.xml │ │ ├── support_v4_25_0_0.xml │ │ ├── support_vector_drawable_25_0_0.xml │ │ └── transition_25_0_0.xml │ ├── markdown-navigator.xml │ ├── markdown-navigator │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── workspace.xml │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── stitch.properties │ ├── java │ └── com │ │ └── mongodb │ │ └── stitch │ │ └── sdk │ │ └── examples │ │ └── todo │ │ ├── MainActivity.java │ │ ├── TodoItem.java │ │ └── TodoListAdapter.java │ └── res │ ├── drawable │ ├── ic_add_circle_black_24dp.xml │ └── ic_add_white_48px.xml │ ├── layout │ ├── activity_main.xml │ ├── activity_main_todo_list.xml │ ├── add_item.xml │ └── todo_item.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── app_config.json ├── dist ├── index.html └── static │ └── bundle.js.map ├── import └── Todo_Web_App_With_Twilio │ ├── auth_providers │ ├── api-key.json │ ├── oauth2-facebook.json │ └── oauth2-google.json │ ├── functions │ └── sendConfirmation │ │ ├── config.json │ │ └── source.js │ ├── secrets.json │ ├── services │ ├── mongodb-atlas │ │ ├── config.json │ │ └── rules │ │ │ ├── todo.items.json │ │ │ └── todo.users.json │ └── tw1 │ │ ├── config.json │ │ ├── incoming_webhooks │ │ └── twilioWebhook │ │ │ ├── config.json │ │ │ └── source.js │ │ └── rules │ │ └── EnableSend.json │ ├── stitch.json │ └── values │ └── ourNumber.json ├── ios ├── .gitignore ├── Podfile ├── ToDoSync.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── caleb.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── caleb.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── ToDoSync.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── caleb.xcuserdatad │ │ ├── IDEFindNavigatorScopes.plist │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── ToDoSync │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── GoogleService-Info.plist │ ├── Info.plist │ ├── TodoItem.swift │ ├── TodoList.swift │ ├── TodoTableViewCell.swift │ └── TodoTableViewController.swift ├── package.json ├── src └── index.js ├── static └── todo.scss └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | node_modules 3 | .DS_Store 4 | tmp 5 | local.properties 6 | PlateSpace/iOS/SoLoMoSample.xcworkspace/xcuserdata/* 7 | PlateSpace/iOS/Pods/Pods.xcodeproj/xcuserdata/* 8 | PlateSpace/iOS/PlateSpace.xcodeproj/xcuserdata/* 9 | PlateSpace/iOS/PlateSpace.xcworkspace/xcuserdata/* 10 | PlateSpace/iOS/build/* 11 | PlateSpace/iOS/Pods/Pods.xcodeproj/project.xcworkspace/xcuserdata/* 12 | *~ 13 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/logTemperatureReading.js: -------------------------------------------------------------------------------- 1 | async function getDarkSkyData() { 2 | // Get the current temperature from Dark Sky 3 | const DarkSky = context.services.get("DarkSky"); 4 | const darkSkyKey = context.values.get("DarkSkyKey"); 5 | const deviceLocation = context.values.get("DeviceLocation"); 6 | const url = `https://api.darksky.net/forecast/${darkSkyKey}/${deviceLocation}`; 7 | 8 | const darkSkyResponse = await DarkSky.get({ url }); 9 | return EJSON.parse(darkSkyResponse.body.text()) 10 | } 11 | 12 | exports = async function (impData) { 13 | const darkSkyData = await getDarkSkyData(); 14 | 15 | // Prepare the temperature reading data 16 | const now = new Date(); 17 | const temperatureData = { 18 | indoorTemp: impData.temp * 9 / 5 + 32, // Convert to Fahrenheit 19 | indoorHumidity: impData.humid, 20 | outdoorTemp: darkSkyData.currently.temperature, 21 | outdoorHumidity: darkSkyData.currently.humidity, 22 | timestamp: now.getTime(), 23 | date: now 24 | }; 25 | 26 | // Insert the temperature data into MongoDB 27 | const mongodb = context.services.get("mongodb-atlas"); 28 | const TempData = mongodb.db("Imp").collection("TempData"); 29 | 30 | return TempData.insertOne(temperatureData); 31 | }; 32 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/no_hardware.js: -------------------------------------------------------------------------------- 1 | // Set-up the Stitch client 2 | const stitch = require('mongodb-stitch-server-sdk'); 3 | 4 | // Send sample data while within this loop 5 | function generateData(stitchClient) { 6 | // Create a random temperature and humidity data point with 7 | // temp ranging from -20 to 20 °C 8 | const data = { 9 | "temp" : Math.floor(Math.random() * 20) - 20, 10 | "humid" : Math.floor(Math.random() * 100) 11 | }; 12 | 13 | // Print to the console 14 | console.log(data); 15 | 16 | // Simulate write to MongoDB every 2 minutes 17 | stitchClient.callFunction("logTemperatureReading", [data]).then( 18 | setTimeout(() => generateData(stitchClient), 120000) 19 | ); 20 | } 21 | 22 | // Use the API Key to load data 23 | const stitchClient = stitch.Stitch.initializeDefaultAppClient(""); 24 | 25 | stitchClient.auth.loginWithCredential(new stitch.ServerApiKeyCredential("")) 26 | .then(() => { 27 | generateData(stitchClient); 28 | }); 29 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stitch-imp-tutorial", 3 | "version": "1.0.0", 4 | "description": "Tutorial for MongoDB Stitch and Electric Imp", 5 | "main": "no_hardware.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Drew DiPalma", 10 | "license": "MIT", 11 | "dependencies": { 12 | "mongodb-stitch-server-sdk": "^4.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/temp.agent.nut: -------------------------------------------------------------------------------- 1 | #require "MongoDBStitch.agent.lib.nut:1.0.0" 2 | 3 | //Create the connection to Stitch 4 | stitch <- MongoDBStitch(""); 5 | 6 | //Add an API key to link this device to a specific Stitch User 7 | const API_KEY = ""; 8 | 9 | //Ensure you are authenticated to Stitch 10 | stitch.loginWithApiKey(API_KEY); 11 | 12 | function log(data) { 13 | stitch.executeFunction("logTemperatureReading", [data], function (error, response) { 14 | if (error) { 15 | server.log("error: " + error.details); 16 | } else { 17 | server.log("temperature logged"); 18 | } 19 | }); 20 | } 21 | 22 | // Register a function to receive sensor data from the device 23 | device.on("reading.sent", log); 24 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/temp.device.nut: -------------------------------------------------------------------------------- 1 | #require "HTS221.device.lib.nut:2.0.1" 2 | #require "LPS22HB.class.nut:1.0.0" 3 | 4 | // Define constants 5 | const sleepTime = 120; 6 | 7 | // Declare Global Variables 8 | tempSensor <- null; 9 | pressureSensor <- null; 10 | led <- null 11 | 12 | // Define functions 13 | function takeReading(){ 14 | local conditions = {}; 15 | local reading = tempSensor.read(); 16 | conditions.temp <- reading.temperature; 17 | conditions.humid <- reading.humidity; 18 | reading = pressureSensor.read(); 19 | conditions.press <- reading.pressure; 20 | 21 | // Send 'conditions' to the agent 22 | agent.send("reading.sent", conditions); 23 | 24 | // Set the imp to sleep when idle, ie. program complete 25 | imp.onidle(function() { 26 | server.sleepfor(sleepTime); 27 | }); 28 | } 29 | 30 | // Start of program 31 | 32 | // Configure I2C bus for sensors 33 | local i2c = hardware.i2c89; 34 | i2c.configure(CLOCK_SPEED_400_KHZ); 35 | 36 | tempSensor = HTS221(i2c); 37 | tempSensor.setMode(HTS221_MODE.ONE_SHOT); 38 | 39 | pressureSensor = LPS22HB(i2c); 40 | pressureSensor.softReset(); 41 | 42 | // Take a reading 43 | takeReading(); 44 | -------------------------------------------------------------------------------- /IoTTemperatureTracking/twilio_webhook.js: -------------------------------------------------------------------------------- 1 | exports = function(message){ 2 | //Parse the date 3 | var userDate = new Date(message.Body.substring(5,message.Body.length)); 4 | 5 | //Define Services and Collections 6 | var mongodb = context.services.get("mongodb-atlas"); 7 | var TempData = mongodb.db("Imp").collection("TempData"); 8 | var twilio = context.services.get("twilio"); 9 | var responseMessage = "No weather data found"; 10 | 11 | if(message.Body.toLowerCase() === "temp" || message.Body.toLowerCase() === "temp now"){ 12 | var data = TempData.find().sort({"Timestamp" : -1}).limit(1).toArray(); 13 | if (data.length === 1){ 14 | responseMessage = "As of " + data[0].Date + " the indoor temperature was " + data[0].indoorTemp + "°F and the outdoor temperature was " + data[0].outdoorTemp + "°F."; 15 | } 16 | }else if(!isNaN(userDate.valueOf())){ 17 | var data = TempData.find({"Timestamp" : {"$lte" : userDate.getTime()/1000}}).sort({"Timestamp" : -1}).limit(1).toArray(); 18 | if (date.length === 1){ 19 | responseMessage = "As of " + data[0].Date + " the indoor temperature was " + data[0].indoorTemp + "°F and the outdoor temperature was " + data[0].outdoorTemp + "°F."; 20 | } 21 | }else{ 22 | responseMessage = "Invalid Request: Try \"Temp Now\" or \"Temp [Date]\""; 23 | } 24 | 25 | //Send the response 26 | return twilio.send({ 27 | from : context.values.get("TwilioPhone"), 28 | to : message.From, 29 | body : responseMessage 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MongoDB Stitch Examples 2 | 3 | | Documentation | 4 | | ---------------------------------------------------------------------------------------------- | 5 | | [blog-comments-simple](https://docs.mongodb.com/stitch/getting-started/first-stitch-app/) | 6 | | [ToDo (Web)](https://docs.mongodb.com/stitch/getting-started/todo-web/) | 7 | | [ToDo (Android)](https://docs.mongodb.com/stitch/getting-started/todo-android/) | 8 | | [ToDo (iOS)](https://docs.mongodb.com/stitch/getting-started/todo-ios/) | 9 | | [Dashboard](https://docs.mongodb.com/stitch/getting-started/dashboard/) | 10 | | [IoT Temperature Tracker](https://docs.mongodb.com/stitch/getting-started/temperature-tracker/)| 11 | 12 | [![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 13 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.mongodb.example.pushnotification" 7 | minSdkVersion 21 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | repositories { 22 | google() 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation 'com.android.support:appcompat-v7:27.1.1' 28 | implementation 'com.android.support.constraint:constraint-layout:1.1.2' 29 | implementation 'com.android.support:design:27.1.1' 30 | testImplementation 'junit:junit:4.12' 31 | 32 | implementation 'com.google.android.gms:play-services-gcm:15.0.1' 33 | implementation 'org.mongodb:stitch-android-core:4.0.0-beta-3' 34 | implementation 'org.mongodb:stitch-android-services-fcm:4.0.0-beta-3' 35 | 36 | implementation 'com.google.firebase:firebase-core:16.0.0' 37 | implementation 'com.google.firebase:firebase-messaging:17.0.0' 38 | } 39 | 40 | apply plugin: 'com.google.gms.google-services' 41 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/YOU/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/androidTest/java/com/mongodb/example/pushnotification/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.mongodb.example.pushnotification; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.mongodb.example.pushnotification", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/java/com/mongodb/example/pushnotification/MyFirebaseMessagingService.java: -------------------------------------------------------------------------------- 1 | package com.mongodb.example.pushnotification; 2 | 3 | import android.app.Notification; 4 | import android.app.NotificationManager; 5 | import android.content.Context; 6 | import android.support.v4.app.NotificationCompat; 7 | 8 | import com.google.firebase.messaging.RemoteMessage; 9 | import com.google.firebase.messaging.FirebaseMessagingService; 10 | 11 | public class MyFirebaseMessagingService extends FirebaseMessagingService { 12 | 13 | @Override 14 | public void onMessageReceived(RemoteMessage message) { 15 | RemoteMessage.Notification notification = message.getNotification(); 16 | if (notification == null) { return; } 17 | 18 | // By default, notifications will only appear if the app is in the background. 19 | // Create a new notification here to show in case the app is in the foreground. 20 | Notification.Builder notificationBuilder; 21 | NotificationManager manager = 22 | (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 23 | if (android.os.Build.VERSION.SDK_INT >= 26) { 24 | notificationBuilder = new Notification.Builder(getApplicationContext(), "channel_id"); 25 | } else { 26 | notificationBuilder = new Notification.Builder(getApplicationContext()); 27 | } 28 | 29 | notificationBuilder.setContentTitle(notification.getTitle()) 30 | .setContentText(notification.getBody()) 31 | .setSmallIcon(R.mipmap.ic_launcher); 32 | 33 | notificationBuilder.setAutoCancel(true) 34 | .setDefaults(NotificationCompat.DEFAULT_ALL); 35 | 36 | manager.notify(1, notificationBuilder.build()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/layout/content_result.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mongodb/stitch-examples/6473701012bbe3808343a36eed0f538133fc3804/StitchSamplePushNotificationApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 4 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Stitch Sample Push Notification App 3 | holidays 4 | quotes 5 | events 6 | Update Subscriptions 7 | TBD 8 | TBD 9 | TBD 10 | 11 | -------------------------------------------------------------------------------- /StitchSamplePushNotificationApp/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 9 | 10 | -------------------------------------------------------------------------------- /todo/android-mobile/todo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /todo/android-mobile/todo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /todo/android-mobile/todo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 180dp 6 | 16dp 7 | 16dp 8 | 9 | -------------------------------------------------------------------------------- /todo/android-mobile/todo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Todo 3 | todo_web_app-kkqke 4 | TBD 5 | TBD 6 | 153606348799-b0vmthckcud6dvlg60qi2rcilmogs3rb.apps.googleusercontent.com 7 | TodoList 8 | Settings 9 | Refresh 10 | Clear 11 | Logout 12 | Choose a login provider 13 | Fetch the kids 14 | Add 15 | Cancel 16 | Log in with Facebook 17 | 18 | -------------------------------------------------------------------------------- /todo/android-mobile/todo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 9 | 10 | -------------------------------------------------------------------------------- /todo/android/todo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /todo/android/todo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /todo/android/todo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 180dp 6 | 16dp 7 | 16dp 8 | 9 | -------------------------------------------------------------------------------- /todo/android/todo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Todo 3 | TBD 4 | TBD 5 | TBD 6 | TBD 7 | TodoList 8 | Settings 9 | Refresh 10 | Clear 11 | Logout 12 | Choose a login provider 13 | Fetch the kids 14 | Add 15 | Cancel 16 | Log in with Facebook 17 | 18 | -------------------------------------------------------------------------------- /todo/android/todo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |