Skip to content

Commit

Permalink
Initial commit of functions sample.
Browse files Browse the repository at this point in the history
Change-Id: Ibf330d8e6699922c8ac906b12dbd39b41a6ffec7
  • Loading branch information
samtstern committed Mar 16, 2018
1 parent ea60abc commit 4ddb4e8
Show file tree
Hide file tree
Showing 41 changed files with 1,259 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ the sample you wish to run.
- [Crash](crash/README.md)
- [Database](database/README.md)
- [Firestore](firestore/README.md)
- [Functions](functions/README.md)
- [Dynamic Links](dynamiclinks/README.md)
- [Invites](invites/README.md)
- [Messaging](messaging/README.md)
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cp mock-google-services.json crash/app/google-services.json
cp mock-google-services.json database/app/google-services.json
cp mock-google-services.json dynamiclinks/app/google-services.json
cp mock-google-services.json firestore/app/google-services.json
cp mock-google-services.json functions/app/google-services.json
cp mock-google-services.json invites/app/google-services.json
cp mock-google-services.json perf/app/google-services.json
cp mock-google-services.json messaging/app/google-services.json
Expand Down
2 changes: 2 additions & 0 deletions functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
.firebaserc
61 changes: 61 additions & 0 deletions functions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Firebase Functions Quickstart
=============================

Introduction
------------

This quickstart demontstrates **Callable Functions** which are HTTPS Cloud Functions
that can be invoked directly from your mobile application.

- [Read more about callable functions](https://firebase.google.com/docs/functions/callable)

Getting Started
---------------

- [Add Firebase to your Android Project](https://firebase.google.com/docs/android/setup).
- Deploy the provided cloud functions:

```bash
# Move to the `functions` subdirectory of quickstart-android
cd functions

# Install all of the dependencies of the cloud functions
cd functions
npm install
cd ../

# Deploy functions to your Firebase project
firebase --project=YOUR_PROJECT_ID deploy --only functions
```

- Run the sample on Android device or emulator.

Screenshots
-----------
<img src="app/src/screen.png" height="534" width="300"/>

Support
-------

- [Stack Overflow](https://stackoverflow.com/questions/tagged/firebase-crash-reporting)
- [Firebase Support](https://firebase.google.com/support/)

License
-------

Copyright 2018 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
1 change: 1 addition & 0 deletions functions/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions functions/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apply plugin: 'com.android.application'
check.dependsOn 'assembleDebugAndroidTest'

android {
compileSdkVersion 27
buildToolsVersion '27.0.2'

defaultConfig {
applicationId "com.google.samples.quickstart.functions"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.0'
}

dependencies {
compile 'com.android.support:support-v4:27.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:customtabs:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'

compile 'com.google.firebase:firebase-functions:12.0.0'

compile 'com.firebaseui:firebase-ui-auth:3.2.2'
compile 'com.google.firebase:firebase-auth:12.0.0'
compile 'com.google.android.gms:play-services-auth:12.0.0'

testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestCompile 'com.android.support.test:runner:1.0.1'
}

apply plugin: 'com.google.gms.google-services'
25 changes: 25 additions & 0 deletions functions/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

-keepattributes EnclosingMethod
-keepattributes InnerClasses

-dontwarn org.xmlpull.v1.**
-dontnote org.xmlpull.v1.**
-keep class org.xmlpull.** { *; }
-keepclassmembers class org.xmlpull.** { *; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.google.samples.quickstart.functions;


import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.assertTrue;

@LargeTest
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {

@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);

@Test
public void mainActivityTest() {
assertTrue(1 + 1 == 2);
}
}
32 changes: 32 additions & 0 deletions functions/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.samples.quickstart.functions">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Loading

0 comments on commit 4ddb4e8

Please sign in to comment.