Skip to content

Commit 473bc3f

Browse files
committed
Initial commit
0 parents  commit 473bc3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1319
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'com.google.gms.google-services'
4+
}
5+
6+
android {
7+
compileSdk 32
8+
9+
defaultConfig {
10+
applicationId "com.example.myfirebasenotification"
11+
minSdk 21
12+
targetSdk 32
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
}
30+
31+
dependencies {
32+
33+
implementation 'androidx.appcompat:appcompat:1.4.1'
34+
implementation 'com.google.android.material:material:1.6.0'
35+
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
36+
implementation 'com.google.firebase:firebase-messaging:23.0.6'
37+
testImplementation 'junit:junit:4.13.2'
38+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
39+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
40+
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
41+
implementation 'com.google.code.gson:gson:2.6.2'
42+
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
43+
}

app/google-services.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"project_info": {
3+
"project_number": "374200276571",
4+
"project_id": "sospolice-c48e6",
5+
"storage_bucket": "sospolice-c48e6.appspot.com"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:374200276571:android:e4dd04c4985a6915f0117e",
11+
"android_client_info": {
12+
"package_name": "com.example.myfirebasenotification"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "374200276571-eiuuq6dl5qh7s2d1f0d25uvsvu705l10.apps.googleusercontent.com",
18+
"client_type": 3
19+
}
20+
],
21+
"api_key": [
22+
{
23+
"current_key": "AIzaSyBdL-3SKWBHyG0ethM7W9QNaewft3UPUh8"
24+
}
25+
],
26+
"services": {
27+
"appinvite_service": {
28+
"other_platform_oauth_client": [
29+
{
30+
"client_id": "374200276571-eiuuq6dl5qh7s2d1f0d25uvsvu705l10.apps.googleusercontent.com",
31+
"client_type": 3
32+
}
33+
]
34+
}
35+
}
36+
}
37+
],
38+
"configuration_version": "1"
39+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.myfirebasenotification;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.example.myfirebasenotification", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.myfirebasenotification">
4+
5+
<uses-permission android:name="android.permission.VIBRATE" />
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
8+
<uses-permission android:name="com.google.android.c2dm.permission.RECIEVE"/>
9+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
10+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
11+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
12+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
13+
14+
15+
<uses-permission android:name="android.permission.SEND_SMS" />
16+
17+
<application
18+
android:allowBackup="true"
19+
android:icon="@mipmap/ic_launcher"
20+
android:label="@string/app_name"
21+
android:roundIcon="@mipmap/ic_launcher_round"
22+
android:supportsRtl="true"
23+
android:theme="@style/Theme.MyFirebaseNotification">
24+
<activity
25+
android:name=".ui.activities.MainActivity"
26+
android:exported="true">
27+
<intent-filter>
28+
<action android:name="android.intent.action.MAIN" />
29+
30+
<category android:name="android.intent.category.LAUNCHER" />
31+
</intent-filter>
32+
</activity>
33+
34+
<service
35+
android:name=".utils.MyFirebaseMessagingService"
36+
android:exported="false">
37+
<intent-filter>
38+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
39+
</intent-filter>
40+
</service>
41+
42+
</application>
43+
44+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.example.myfirebasenotification.api;
2+
3+
import com.example.myfirebasenotification.models.MyResponse;
4+
import com.example.myfirebasenotification.models.NotificationSender;
5+
6+
import retrofit2.Call;
7+
import retrofit2.http.Body;
8+
import retrofit2.http.Headers;
9+
import retrofit2.http.POST;
10+
11+
public interface APIService {
12+
@Headers(
13+
{
14+
"Content-Type:application/json",
15+
"Authorization:key=AAAAVyATFls:APA91bF3FO2HP3h71mNVGtbcACddcRnz6sZBrUubsRCUyGzB_bg3o5W9TUxLR6q36Pif6CYdpsYtJ8Q6Tq8XTjsvWu7m2QSKpnVGYWMlRr7sladBejug-F-4YGugDXbRVLGHIwQgMI67"
16+
}
17+
)
18+
@POST("fcm/send")
19+
Call<MyResponse> sendNotification(@Body NotificationSender body);
20+
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.myfirebasenotification.api;
2+
3+
import retrofit2.Retrofit;
4+
import retrofit2.converter.gson.GsonConverterFactory;
5+
6+
public class Client {
7+
private static Retrofit retrofit = null;
8+
9+
public static Retrofit getClient(String url) {
10+
if (retrofit == null) {
11+
retrofit = new Retrofit.Builder().baseUrl(url).addConverterFactory(GsonConverterFactory.create()).build();
12+
}
13+
return retrofit;
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.example.myfirebasenotification.models;
2+
3+
public class Data {
4+
private String Title;
5+
private String Message;
6+
7+
public Data(String title, String message) {
8+
Title = title;
9+
Message = message;
10+
}
11+
12+
public Data() {
13+
}
14+
15+
public String getTitle() {
16+
return Title;
17+
}
18+
19+
public void setTitle(String title) {
20+
Title = title;
21+
}
22+
23+
public String getMessage() {
24+
return Message;
25+
}
26+
27+
public void setMessage(String message) {
28+
Message = message;
29+
}
30+
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.example.myfirebasenotification.models;
2+
3+
public class MyResponse {
4+
public int success;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.example.myfirebasenotification.models;
2+
3+
import com.example.myfirebasenotification.models.Data;
4+
5+
public class NotificationSender {
6+
public Data data;
7+
public String to;
8+
9+
public NotificationSender(Data data, String to) {
10+
this.data = data;
11+
this.to = to;
12+
}
13+
14+
public NotificationSender() {
15+
}
16+
}

0 commit comments

Comments
 (0)