diff --git a/.gitignore b/.gitignore
index 4a65044..5b9a472 100644
--- a/.gitignore
+++ b/.gitignore
@@ -247,9 +247,5 @@ $RECYCLE.BIN/
#########################################################################################
-
-#
-#
-#
-#
-#
+.idea/caches
+app/release
\ No newline at end of file
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
deleted file mode 100644
index 7ffeed8..0000000
Binary files a/.idea/caches/build_file_checksums.ser and /dev/null differ
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..dd4c951
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index f3754de..539becf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,9 +6,8 @@ android {
applicationId "com.blackforestbytes.simplecloudnotifier"
minSdkVersion 15
targetSdkVersion 27
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ versionCode 2
+ versionName "0.2"
}
buildTypes {
release {
@@ -20,9 +19,12 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
+
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+
+ implementation 'com.google.firebase:firebase-core:16.0.3'
+ implementation 'com.google.firebase:firebase-messaging:17.3.2'
}
+
+apply plugin: 'com.google.gms.google-services'
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100644
index 0000000..c1b7b82
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,55 @@
+{
+ "project_info": {
+ "project_number": "232728961679",
+ "firebase_url": "https://simplecloudnotifier-ea7ef.firebaseio.com",
+ "project_id": "simplecloudnotifier-ea7ef",
+ "storage_bucket": "simplecloudnotifier-ea7ef.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:232728961679:android:23c75317f79601c9",
+ "android_client_info": {
+ "package_name": "com.blackforestbytes.simplecloudnotifier"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "232728961679-o7gig6f684mp1l1ok7719v3jf3csejc1.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.blackforestbytes.simplecloudnotifier",
+ "certificate_hash": "3bcafbd39256422f0cb51fd446a228c26543afb4"
+ }
+ },
+ {
+ "client_id": "232728961679-t1h2eo5keha2lrvhsvdr5kgbkbfkja0o.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyBasR6JLAjM5Ut0rPb0euE_9DdDoTkcvKQ"
+ }
+ ],
+ "services": {
+ "analytics_service": {
+ "status": 1
+ },
+ "appinvite_service": {
+ "status": 2,
+ "other_platform_oauth_client": [
+ {
+ "client_id": "232728961679-t1h2eo5keha2lrvhsvdr5kgbkbfkja0o.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ },
+ "ads_service": {
+ "status": 2
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/blackforestbytes/simplecloudnotifier/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/blackforestbytes/simplecloudnotifier/ExampleInstrumentedTest.java
deleted file mode 100644
index 0073786..0000000
--- a/app/src/androidTest/java/com/blackforestbytes/simplecloudnotifier/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.blackforestbytes.simplecloudnotifier;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.blackforestbytes.simplecloudnotifier", appContext.getPackageName());
- }
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9851b19..a13d8de 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,7 +3,7 @@
package="com.blackforestbytes.simplecloudnotifier">
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java b/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java
new file mode 100644
index 0000000..bdeadfe
--- /dev/null
+++ b/app/src/main/java/com/blackforestbytes/simplecloudnotifier/FBMService.java
@@ -0,0 +1,53 @@
+package com.blackforestbytes.simplecloudnotifier;
+
+import android.util.Log;
+
+import com.google.firebase.messaging.FirebaseMessagingService;
+import com.google.firebase.messaging.RemoteMessage;
+
+public class FBMService extends FirebaseMessagingService
+{
+ /**
+ * Called if InstanceID token is updated. This may occur if the security of
+ * the previous token had been compromised. Note that this is called when the InstanceID token
+ * is initially generated so this is where you would retrieve the token.
+ */
+ @Override
+ public void onNewToken(String token)
+ {
+ Log.i("Firebase::NewToken", token);
+ }
+
+ @Override
+ public void onMessageReceived(RemoteMessage remoteMessage) {
+ // [START_EXCLUDE]
+ // There are two types of messages data messages and notification messages. Data messages are handled
+ // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type
+ // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app
+ // is in the foreground. When the app is in the background an automatically generated notification is displayed.
+ // When the user taps on the notification they are returned to the app. Messages containing both notification
+ // and data payloads are treated as notification messages. The Firebase console always sends notification
+ // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options
+ // [END_EXCLUDE]
+
+ Log.i("FB::MessageReceived<0>", "");
+
+
+ // TODO(developer): Handle FCM messages here.
+ // Not getting messages here? See why this may be: https://goo.gl/39bRNJ
+ Log.i("FB::MessageReceived<1>", "From: " + remoteMessage.getFrom());
+
+ // Check if message contains a data payload.
+ if (remoteMessage.getData().size() > 0) {
+ Log.i("FB::MessageReceived<3>", "Payload: " + remoteMessage.getData());
+ }
+
+ // Check if message contains a notification payload.
+ if (remoteMessage.getNotification() != null) {
+ Log.i("FB::MessageReceived<2>", "Payload: " + remoteMessage.getNotification().getBody());
+ }
+
+ // Also if you intend on generating your own notifications as a result of a received FCM
+ // message, here is where that should be initiated. See sendNotification method below.
+ }
+}
diff --git a/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java b/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java
index 86bdd87..e66d6aa 100644
--- a/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java
+++ b/app/src/main/java/com/blackforestbytes/simplecloudnotifier/MainActivity.java
@@ -2,6 +2,12 @@ package com.blackforestbytes.simplecloudnotifier;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.firebase.iid.FirebaseInstanceId;
+import com.google.firebase.iid.InstanceIdResult;
public class MainActivity extends AppCompatActivity {
@@ -9,5 +15,18 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+ findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(InstanceIdResult instanceIdResult) {
+ Log.d("FB::ID", instanceIdResult.getId());
+ Log.d("FB::TOKEN", instanceIdResult.getToken());
+ }
+ });
+ }
+ });
}
}
diff --git a/app/src/main/res/drawable/icon.png b/app/src/main/res/drawable/icon.png
new file mode 100644
index 0000000..2eff47e
Binary files /dev/null and b/app/src/main/res/drawable/icon.png differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 84f1951..f83c626 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -15,4 +15,15 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/blackforestbytes/simplecloudnotifier/ExampleUnitTest.java b/app/src/test/java/com/blackforestbytes/simplecloudnotifier/ExampleUnitTest.java
deleted file mode 100644
index 747770d..0000000
--- a/app/src/test/java/com/blackforestbytes/simplecloudnotifier/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.blackforestbytes.simplecloudnotifier;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 077cb2f..c8daecc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,6 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
+ classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/data/graphic.png b/data/graphic.png
new file mode 100644
index 0000000..a36c99e
Binary files /dev/null and b/data/graphic.png differ
diff --git a/data/icon_512.png b/data/icon_512.png
new file mode 100644
index 0000000..2eff47e
Binary files /dev/null and b/data/icon_512.png differ
diff --git a/data/screenshot.png b/data/screenshot.png
new file mode 100644
index 0000000..491c55b
Binary files /dev/null and b/data/screenshot.png differ
diff --git a/data/screenshot_2.png b/data/screenshot_2.png
new file mode 100644
index 0000000..9410fa2
Binary files /dev/null and b/data/screenshot_2.png differ