Skip to content

Instantly share code, notes, and snippets.

👀
Forever coding

Mitch Tabian mitchtabian

View GitHub Profile
@mitchtabian
mitchtabian / MainActivity.java
Last active Apr 14, 2017
Firebase Authentication
View MainActivity.java
package com.tabian.firebaseauthentication;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@mitchtabian
mitchtabian / AddToDatabase.java
Created Apr 14, 2017
How to use a Firebase Database [Android Real-Time Database]
View AddToDatabase.java
package com.tabian.firebaseaddtodatabase;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@mitchtabian
mitchtabian / AndroidManifest.xml
Last active Apr 14, 2017
Firebase-Read-Database
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tabian.firebasereaddata">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tabian.firebaseuploadimage">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.STORAGE" />
@mitchtabian
mitchtabian / AndroidManifest.xml
Created Apr 14, 2017
FirebaseSendPushNotification
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tabian.firebasepushnotifications">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@mitchtabian
mitchtabian / MainActivity.java
Created Apr 14, 2017
FirebaseCrashReporting
View MainActivity.java
/*
***Logging Type1***
*/
//to just log actions to the Firebase Dashboard you can use this
FirebaseCrash.log("Some message that you want to log");
//This type of logging is going to be analogous to this:
Log.d(TAG, "Some message that you want to log");
@mitchtabian
mitchtabian / AndroidManifest.xml
Created Apr 14, 2017
FirebaseOnClickPushNotification
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tabian.firebasepushnotifications">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@mitchtabian
mitchtabian / AndroidManifest.xml
Created Apr 14, 2017
FirebasePushNotificationTopics
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tabian.firebasepushnotifications">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
View dependencies.java
//RecyclerView
compile 'com.android.support:recyclerview-v7:26.+'
//Firebase Authentication
compile 'com.google.firebase:firebase-auth:11.4.0'
//Firebase Realtime Database
compile 'com.google.firebase:firebase-database:11.4.0'
//Firebase Cloud Messaging
View SendToken.java
private void sendRegistrationToServer(String token) {
Log.d(TAG, "sendRegistrationToServer: sending token to server: " + token);
DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
reference.child(getString(R.string.dbnode_users))
.child(FirebaseAuth.getInstance().getCurrentUser().getUid())
.child(getString(R.string.field_messaging_token))
.setValue(token);
}
You can’t perform that action at this time.