新增了一些工程
This commit is contained in:
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.web.telur33"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 31
|
||||
versionCode 106
|
||||
versionName "v1.0.6"
|
||||
versionCode 107
|
||||
versionName "v1.0.7"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "852761213386",
|
||||
"project_id": "telur33b",
|
||||
"storage_bucket": "telur33b.firebasestorage.app"
|
||||
"project_number": "871184240883",
|
||||
"project_id": "telur33-fc50f",
|
||||
"storage_bucket": "telur33-fc50f.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:852761213386:android:e1559f6562c328de77f733",
|
||||
"mobilesdk_app_id": "1:871184240883:android:6032511c53b8d909f52786",
|
||||
"android_client_info": {
|
||||
"package_name": "com.web.telur33"
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCztC24cM2X_RALbJRB2-yUGZZ1KYEFjL0"
|
||||
"current_key": "AIzaSyAEOXP2ncswpTlFQojx1IAlfZYvUFsLPPw"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 106,
|
||||
"versionName": "v1.0.6",
|
||||
"versionCode": 107,
|
||||
"versionName": "v1.0.7",
|
||||
"outputFile": "telur33-release.apk"
|
||||
}
|
||||
]
|
||||
|
||||
Binary file not shown.
@@ -1,15 +1,21 @@
|
||||
package com.web.telur33;
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.web.base.LogUtils;
|
||||
import com.web.base.MainActivity;
|
||||
|
||||
public class MainActivity2 extends com.web.base.MainActivity2 {
|
||||
@@ -24,15 +30,25 @@ public class MainActivity2 extends com.web.base.MainActivity2 {
|
||||
super.onCreate(savedInstanceState);
|
||||
//订阅主题
|
||||
FirebaseMessaging.getInstance().subscribeToTopic("demo")
|
||||
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
String msg = "Subscribed";
|
||||
if (!task.isSuccessful()) {
|
||||
msg = "Subscribe failed";
|
||||
}
|
||||
|
||||
.addOnCompleteListener(task -> {
|
||||
String msg = "Subscribed";
|
||||
if (!task.isSuccessful()) {
|
||||
msg = "Subscribe failed";
|
||||
}
|
||||
LogUtils.i("结果是啥:"+msg);
|
||||
|
||||
});
|
||||
|
||||
|
||||
FirebaseMessaging.getInstance().getToken()
|
||||
.addOnCompleteListener(task -> {
|
||||
if (!task.isSuccessful()) {
|
||||
// Log.w(TAG, "Fetching FCM registration token failed", task.getException());
|
||||
return;
|
||||
}
|
||||
// Get new FCM registration token
|
||||
String token = task.getResult();
|
||||
LogUtils.i("结果是啥1111:"+token);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -83,14 +83,14 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||
channelwinway.enableVibration(true);
|
||||
notificationManager.createNotificationChannel(channelwinway);
|
||||
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.setSmallIcon(R.mipmap.app_logo)
|
||||
.setContentTitle(messageInfo.getTitle())
|
||||
.setContentText(messageInfo.getContent())
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
} else {
|
||||
notificationBuilder = new NotificationCompat.Builder(this, getString(com.web.base.R.string.app_name))
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.setSmallIcon(R.mipmap.app_logo)
|
||||
.setContentTitle(messageInfo.getTitle())
|
||||
.setContentText(messageInfo.getContent())
|
||||
.setAutoCancel(true)
|
||||
@@ -129,14 +129,14 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||
channelwinway.enableVibration(true);
|
||||
notificationManager.createNotificationChannel(channelwinway);
|
||||
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.setSmallIcon(R.mipmap.app_logo)
|
||||
.setContentTitle(title)
|
||||
.setContentText(body)
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
} else {
|
||||
notificationBuilder = new NotificationCompat.Builder(this, getString(com.web.base.R.string.app_name))
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.setSmallIcon(R.mipmap.app_logo)
|
||||
.setContentTitle(title)
|
||||
.setContentText(body)
|
||||
.setAutoCancel(true)
|
||||
@@ -168,4 +168,5 @@ public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||
// namePref.putString(key, is);
|
||||
// namePref.commit();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user