shits working - yo
This commit is contained in:
parent
39468821b4
commit
7ecb64fde7
8
.gitignore
vendored
8
.gitignore
vendored
@ -247,9 +247,5 @@ $RECYCLE.BIN/
|
|||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
.idea/caches
|
||||||
#
|
app/release
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
7
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
7
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="Default" />
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
@ -6,9 +6,8 @@ android {
|
|||||||
applicationId "com.blackforestbytes.simplecloudnotifier"
|
applicationId "com.blackforestbytes.simplecloudnotifier"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 2
|
||||||
versionName "1.0"
|
versionName "0.2"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@ -20,9 +19,12 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||||
testImplementation 'junit:junit:4.12'
|
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
implementation 'com.google.firebase:firebase-core:16.0.3'
|
||||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
implementation 'com.google.firebase:firebase-messaging:17.3.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
55
app/google-services.json
Normal file
55
app/google-services.json
Normal file
@ -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"
|
||||||
|
}
|
@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
@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());
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,7 @@
|
|||||||
package="com.blackforestbytes.simplecloudnotifier">
|
package="com.blackforestbytes.simplecloudnotifier">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
@ -12,10 +12,19 @@
|
|||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/icon" />
|
||||||
|
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
|
||||||
|
|
||||||
|
<service android:name=".FBMService">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -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.
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,12 @@ package com.blackforestbytes.simplecloudnotifier;
|
|||||||
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
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 {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -9,5 +15,18 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
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<InstanceIdResult>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(InstanceIdResult instanceIdResult) {
|
||||||
|
Log.d("FB::ID", instanceIdResult.getId());
|
||||||
|
Log.d("FB::TOKEN", instanceIdResult.getToken());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable/icon.png
Normal file
BIN
app/src/main/res/drawable/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
@ -15,4 +15,15 @@
|
|||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="Get ID"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
||||||
*/
|
|
||||||
public class ExampleUnitTest {
|
|
||||||
@Test
|
|
||||||
public void addition_isCorrect() {
|
|
||||||
assertEquals(4, 2 + 2);
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,6 +8,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.1.4'
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
BIN
data/graphic.png
Normal file
BIN
data/graphic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
BIN
data/icon_512.png
Normal file
BIN
data/icon_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
BIN
data/screenshot.png
Normal file
BIN
data/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
data/screenshot_2.png
Normal file
BIN
data/screenshot_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue
Block a user