Oyen333第一次提交
This commit is contained in:
@@ -8,7 +8,7 @@ android {
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.web.bintang918"
|
||||
applicationId "com.web.bintang"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 31
|
||||
versionCode 109
|
||||
|
||||
@@ -5,6 +5,25 @@
|
||||
"storage_bucket": "bintang918-ios.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:985316013410:android:fe369439e4bc860cc6e83b",
|
||||
"android_client_info": {
|
||||
"package_name": "com.web.bintang"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAhLRvWS13LTqexIcRVWptbPSXwcLmmLzM"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:985316013410:android:1af4f1fec28e354cc6e83b",
|
||||
|
||||
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.web.bintang918",
|
||||
"applicationId": "com.web.bintang",
|
||||
"variantName": "processReleaseResources",
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.web.bintang918">
|
||||
package="com.web.bintang">
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.web.bintang918;
|
||||
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import com.web.base.MainActivity;
|
||||
|
||||
public class MainActivity2 extends com.web.base.MainActivity2 {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
userId = 112;
|
||||
saveInt(MainActivity2.this,"user_code",userId);
|
||||
saveInt(MainActivity2.this,"version_code",getVersion());
|
||||
MainActivity.saveString(this, "base_url", "https://m.bintang918.net/");
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getVersion(){
|
||||
try {
|
||||
PackageManager packageManager = getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
|
||||
String StringversionName = packageInfo.versionName; // 版本号
|
||||
int versionCode = packageInfo.versionCode; // 版本码
|
||||
// 在这里可以使用versionName和versionCode进行相关的操作
|
||||
// Log.d("VersionInfo", "VersionName: " + versionName + ", VersionCode: " + versionCode);
|
||||
return versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
package com.web.bintang918;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
import com.google.firebase.messaging.FirebaseMessagingService;
|
||||
import com.google.firebase.messaging.RemoteMessage;
|
||||
import com.google.gson.Gson;
|
||||
import com.web.base.GsonUtils;
|
||||
import com.web.base.MessageInfo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class MyFirebaseMessageingService extends FirebaseMessagingService {
|
||||
|
||||
public MyFirebaseMessageingService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
|
||||
super.onMessageReceived(remoteMessage);
|
||||
Map<String, String> serviceData = remoteMessage.getData(); //后台推送数据
|
||||
if (serviceData != null && serviceData.containsKey("message")) {
|
||||
String value = serviceData.get("message");
|
||||
Gson gson = new Gson();
|
||||
MessageInfo messageInfo = gson.fromJson(value, MessageInfo.class);
|
||||
showNotification(messageInfo);
|
||||
// if (remoteMessage.getNotification() != null) {
|
||||
// showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
||||
// }
|
||||
} else {
|
||||
//收到通知 创建notify
|
||||
if (remoteMessage.getNotification() != null) {
|
||||
showNotification(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void showNotification(MessageInfo messageInfo) {
|
||||
Intent notifyIntent = new Intent(this, com.web.base.MainActivity2.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||
ComponentName launchComponent = null;
|
||||
launchComponent = getApplication()
|
||||
.getPackageManager()
|
||||
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||
.getComponent();
|
||||
notifyIntent.setComponent(launchComponent);
|
||||
}
|
||||
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||
notifyIntent.putExtra("message", messageInfo);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
// Intent notifyIntent = new Intent(this, MainActivity2.class);
|
||||
// notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
// // notifyIntent.putExtra("message", messageInfo);
|
||||
// notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||
// notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||
// PendingIntent pendingIntent;
|
||||
// pendingIntent = PendingIntent.getActivity
|
||||
// (this, 0, notifyIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channelwinway = null;
|
||||
NotificationCompat.Builder notificationBuilder = null;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
channelwinway = new NotificationChannel(getString(com.web.base.R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
channelwinway.enableLights(true);
|
||||
channelwinway.enableVibration(true);
|
||||
notificationManager.createNotificationChannel(channelwinway);
|
||||
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.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)
|
||||
.setContentTitle(messageInfo.getTitle())
|
||||
.setContentText(messageInfo.getContent())
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
}
|
||||
notificationManager.notify(0, notificationBuilder.build());
|
||||
}
|
||||
|
||||
private void showNotification(String title, String body) {
|
||||
Intent notifyIntent = new Intent(this, MainActivity2.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||
ComponentName launchComponent = null;
|
||||
launchComponent = getApplication()
|
||||
.getPackageManager()
|
||||
.getLaunchIntentForPackage(getApplication().getPackageName())
|
||||
.getComponent();
|
||||
notifyIntent.setComponent(launchComponent);
|
||||
}
|
||||
notifyIntent.putExtra("message", body);
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, new Random().nextInt(10000), notifyIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channelwinway = null;
|
||||
NotificationCompat.Builder notificationBuilder = null;
|
||||
MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
||||
if (messageInfo != null) {
|
||||
body = messageInfo.getContent();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
channelwinway = new NotificationChannel(getString(com.web.base.R.string.app_name), "notify", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
channelwinway.enableLights(true);
|
||||
channelwinway.enableVibration(true);
|
||||
notificationManager.createNotificationChannel(channelwinway);
|
||||
notificationBuilder = new NotificationCompat.Builder(this, channelwinway.getId())
|
||||
.setSmallIcon(com.web.base.R.mipmap.ic_launcher)
|
||||
.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)
|
||||
.setContentTitle(title)
|
||||
.setContentText(body)
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(pendingIntent);
|
||||
}
|
||||
notificationManager.notify(0, notificationBuilder.build());
|
||||
//存储数据
|
||||
// saveNotifyMessage(body);
|
||||
}
|
||||
|
||||
|
||||
// public void saveNotifyMessage(String body) {
|
||||
// MessageInfo messageInfo = GsonUtils.getObjFromJSON(body, MessageInfo.class);
|
||||
// String savenotify = Utils.get(getApplication(),ApiService.savenotify,"");
|
||||
// if(messageInfo!=null){
|
||||
// if(TextUtils.isEmpty(savenotify)){
|
||||
// GsonUtils.getListFromJSON(savenotify,)
|
||||
// }
|
||||
// }
|
||||
// String jsonString = GsonUtils.beanToJSONString(chatMessageBeans);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param key 要设置的key
|
||||
// */
|
||||
// public static void set(Context activity, String key, String is) {
|
||||
// SharedPreferences nameSetting = getConfigShared(activity);
|
||||
// SharedPreferences.Editor namePref = nameSetting.edit();
|
||||
// namePref.putString(key, is);
|
||||
// namePref.commit();
|
||||
// }
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.web.bintang918;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.tencent.smtt.export.external.TbsCoreSettings;
|
||||
import com.tencent.smtt.sdk.QbSdk;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class WebApplication extends Application {
|
||||
|
||||
|
||||
public static Context application;
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// 设置开启优化方案
|
||||
application = this;
|
||||
HashMap map = new HashMap();
|
||||
map.put(TbsCoreSettings.TBS_SETTINGS_USE_SPEEDY_CLASSLOADER, true);
|
||||
map.put(TbsCoreSettings.TBS_SETTINGS_USE_DEXLOADER_SERVICE, true);
|
||||
QbSdk.initTbsSettings(map);
|
||||
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
|
||||
@Override
|
||||
public void onCoreInitFinished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewInitFinished(boolean b) {
|
||||
|
||||
}
|
||||
});
|
||||
QbSdk.setDownloadWithoutWifi(true);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ android {
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.web.mk88"
|
||||
applicationId "com.web.mk88aud"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 31
|
||||
versionCode 106
|
||||
@@ -25,13 +25,13 @@ android {
|
||||
}
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('mk88aud.jks')
|
||||
storeFile file('mk88.jks')
|
||||
storePassword "android2014"
|
||||
keyAlias 'key0'
|
||||
keyPassword "android2014"
|
||||
}
|
||||
release {
|
||||
storeFile file('mk88aud.jks')
|
||||
storeFile file('mk88.jks')
|
||||
storePassword "android2014"
|
||||
keyAlias 'key0'
|
||||
keyPassword "android2014"
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "637535395676",
|
||||
"project_id": "mk88au",
|
||||
"storage_bucket": "mk88au.firebasestorage.app"
|
||||
"project_number": "52740131004",
|
||||
"project_id": "mk88aud",
|
||||
"storage_bucket": "mk88aud.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:637535395676:android:4a3c0ba171a6445b11ab99",
|
||||
"mobilesdk_app_id": "1:52740131004:android:0ac002bce5d93980ee68b9",
|
||||
"android_client_info": {
|
||||
"package_name": "com.web.mk88"
|
||||
"package_name": "com.web.mk88aud"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyBVa3ICPExBtE4YSVn0Fuimd0FoELPCvWA"
|
||||
"current_key": "AIzaSyBd7vIJNQmpgI-C90GSUSnni3t72feVu_Y"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
|
||||
BIN
Mk88aud/mk88.jks
Normal file
BIN
Mk88aud/mk88.jks
Normal file
Binary file not shown.
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.web.mk88",
|
||||
"applicationId": "com.web.mk88aud",
|
||||
"variantName": "processReleaseResources",
|
||||
"elements": [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.web.mk88">
|
||||
package="com.web.mk88aud">
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.web.mk88;
|
||||
package com.web.mk88aud;
|
||||
|
||||
|
||||
import android.content.pm.PackageInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.web.mk88;
|
||||
package com.web.mk88aud;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
@@ -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.app_logo)
|
||||
.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.app_logo)
|
||||
.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.app_logo)
|
||||
.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.app_logo)
|
||||
.setSmallIcon(R.mipmap.app_logo)
|
||||
.setContentTitle(title)
|
||||
.setContentText(body)
|
||||
.setAutoCancel(true)
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.web.mk88;
|
||||
package com.web.mk88aud;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
Reference in New Issue
Block a user