File tree Expand file tree Collapse file tree 6 files changed +136
-0
lines changed
Expand file tree Collapse file tree 6 files changed +136
-0
lines changed Original file line number Diff line number Diff line change 1+ /build
Original file line number Diff line number Diff line change 1+ apply plugin : ' com.android.library'
2+
3+ android {
4+ compileSdkVersion 30
5+
6+
7+
8+ defaultConfig {
9+ minSdkVersion 14
10+ targetSdkVersion 31
11+ versionCode 1
12+ versionName " 1.0"
13+
14+ testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
15+
16+ }
17+
18+ buildTypes {
19+ release {
20+ minifyEnabled false
21+ proguardFiles getDefaultProguardFile(' proguard-android-optimize.txt' ), ' proguard-rules.pro'
22+ }
23+ }
24+
25+ }
26+
27+ dependencies {
28+ implementation fileTree(dir : ' libs' , include : [' *.jar' ])
29+ implementation project(path : ' :mixpush-core' )
30+ implementation ' com.google.firebase:firebase-messaging:18.0.0'
31+
32+ }
33+
34+ group = MAVEN_GROUP_ID
35+ version = MAVEN_PUBLISH_VERSION
Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 1+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
2+ package =" com.mixpush.fcm" >
3+ <application >
4+ <!-- <service android:name=".java.MyFirebaseMessagingService">-->
5+ <!-- <intent-filter>-->
6+ <!-- <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
7+ <!-- </intent-filter>-->
8+ <!-- </service>-->
9+ <!-- <!– Set custom default icon. This is used when no icon is set for incoming notification messages.-->
10+ <!-- See README(https://goo.gl/l4GJaQ) for more. –>-->
11+ <!-- <meta-data-->
12+ <!-- android:name="com.google.firebase.messaging.default_notification_icon"-->
13+ <!-- android:resource="@drawable/ic_stat_ic_notification" />-->
14+ <!-- <!– Set color used with incoming notification messages. This is used when no color is set for the incoming-->
15+ <!-- notification message. See README(https://goo.gl/6BKBk7) for more. –>-->
16+ <!-- <meta-data-->
17+ <!-- android:name="com.google.firebase.messaging.default_notification_color"-->
18+ <!-- android:resource="@color/colorAccent" />-->
19+ <!-- <meta-data-->
20+ <!-- android:name="com.google.firebase.messaging.default_notification_channel_id"-->
21+ <!-- android:value="@string/default_notification_channel_id" />-->
22+ </application >
23+ </manifest >
Original file line number Diff line number Diff line change 1+ package com .mixpush .fcm ;
2+
3+ import android .content .Context ;
4+ import androidx .annotation .NonNull ;
5+ import com .google .android .gms .tasks .OnCompleteListener ;
6+ import com .google .android .gms .tasks .Task ;
7+ import com .google .firebase .iid .FirebaseInstanceId ;
8+ import com .google .firebase .iid .InstanceIdResult ;
9+ import com .mixpush .core .BaseUnifiedPushProvider ;
10+
11+ public class FcmPushProvider extends BaseUnifiedPushProvider {
12+ private String appId ;
13+ private String appKey ;
14+
15+
16+
17+ @ Override
18+ public void register (Context context ) {
19+ FirebaseInstanceId .getInstance ().getInstanceId ()
20+ .addOnCompleteListener (new OnCompleteListener <InstanceIdResult >() {
21+ @ Override
22+ public void onComplete (@ NonNull Task <InstanceIdResult > task ) {
23+ if (!task .isSuccessful ()) {
24+ // Log.w(TAG, "getInstanceId failed", task.getException());
25+ return ;
26+ }
27+
28+ // Get new Instance ID token
29+ String token = task .getResult ().getToken ();
30+
31+ // Log and toast
32+ // String msg = getString(R.string.msg_token_fmt, token);
33+ // Log.d(TAG, msg);
34+ // Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
35+ }
36+ });
37+
38+ }
39+
40+ @ Override
41+ public void unRegister (Context context ) {
42+ }
43+
44+ @ Override
45+ public String getToken (Context context ) {
46+ return null ;
47+ }
48+
49+ @ Override
50+ public boolean isSupport (Context context ) {
51+ return false ;
52+ }
53+ }
Original file line number Diff line number Diff line change 1+ <resources >
2+ <string name =" app_name" >gcm</string >
3+ </resources >
You can’t perform that action at this time.
0 commit comments