[Modify]谷歌下架原因排查
This commit is contained in:
@@ -265,7 +265,7 @@ dependencies {
|
||||
|
||||
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
|
||||
|
||||
implementation 'com.appsflyer:af-android-sdk:6.2.3'
|
||||
implementation 'com.appsflyer:af-android-sdk:6.8.0'
|
||||
|
||||
implementation 'com.github.zhpanvip:BannerViewPager:3.5.6'
|
||||
|
||||
@@ -277,9 +277,6 @@ dependencies {
|
||||
//Adjust接入
|
||||
implementation 'com.adjust.sdk:adjust-android:4.33.0'
|
||||
implementation 'com.android.installreferrer:installreferrer:2.2'
|
||||
implementation 'com.adjust.sdk:adjust-android-samsung-referrer:4.33.0'
|
||||
implementation 'com.adjust.sdk:adjust-android-xiaomi-referrer:4.33.0'
|
||||
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
|
||||
// Add the following if you are using the Adjust SDK inside web views on your app
|
||||
implementation 'com.adjust.sdk:adjust-android-webbridge:4.33.0'
|
||||
|
||||
|
34
app/proguard-rules.pro
vendored
34
app/proguard-rules.pro
vendored
@@ -440,19 +440,9 @@
|
||||
-keep class android.support.v8.renderscript.** { *; }
|
||||
-keep class androidx.renderscript.** { *; }
|
||||
|
||||
-keep class com.google.android.gms.common.ConnectionResult {
|
||||
int SUCCESS;
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
|
||||
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
|
||||
java.lang.String getId();
|
||||
boolean isLimitAdTrackingEnabled();
|
||||
}
|
||||
|
||||
## Appsflyer
|
||||
-keep class com.appsflyer.** { *; }
|
||||
-dontwarn com.android.installreferrer
|
||||
|
||||
## easypermissions
|
||||
-keepclassmembers class * {
|
||||
@@ -468,11 +458,19 @@
|
||||
-keep interface com.yalantis.ucrop.** { *; }
|
||||
|
||||
## BannerViewPage
|
||||
-keep class androidx.recyclerview.widget.**{*;}
|
||||
-keep class androidx.viewpager2.widget.**{*;}
|
||||
-keep class androidx.recyclerview.widget.** { *; }
|
||||
-keep class androidx.viewpager2.widget.** { *; }
|
||||
|
||||
## Adust SDK
|
||||
-keep public class com.adjust.sdk.**{ *; }
|
||||
-keep public class com.android.installreferrer.**{ *; }
|
||||
-keep class com.sec.android.app.samsungapps.installreferrer.**{ *; }
|
||||
-keep class com.miui.referrer.** {*;}
|
||||
## Adjust
|
||||
-keep class com.adjust.sdk.** { *; }
|
||||
-keep class com.google.android.gms.common.ConnectionResult {
|
||||
int SUCCESS;
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
|
||||
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
|
||||
java.lang.String getId();
|
||||
boolean isLimitAdTrackingEnabled();
|
||||
}
|
||||
-keep public class com.android.installreferrer.**{ *; }
|
@@ -70,6 +70,8 @@
|
||||
<uses-permission android:name="${applicationId}.push.permission.MESSAGE" />
|
||||
<uses-permission android:name="com.meizu.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||
<!-- AppsFlyer需要,参考:https://dev.appsflyer.com/hc/docs/install-android-sdk#setting-required-permissions -->
|
||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
||||
|
||||
<application
|
||||
android:name=".application.XChatApplication"
|
||||
@@ -1022,15 +1024,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".reciever.NotificationClickReceiver" />
|
||||
<receiver
|
||||
android:name="com.adjust.sdk.AdjustReferrerReceiver"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.INSTALL_PACKAGES">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name="com.netease.nimlib.service.NimService"
|
||||
android:process=":core" />
|
||||
|
@@ -59,9 +59,14 @@ public class ReportManager implements IReportService {
|
||||
//Adjust初始化
|
||||
private void initAdjust() {
|
||||
String appToken = XChatConstants.ADJUST_APP_TOKEN;
|
||||
String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
|
||||
String environment;
|
||||
if (XChatApplication.isDebug()) {
|
||||
environment = AdjustConfig.ENVIRONMENT_SANDBOX;
|
||||
} else {
|
||||
environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
|
||||
}
|
||||
AdjustConfig config = new AdjustConfig(XChatApplication.instance(), appToken, environment);
|
||||
config.setLogLevel(LogLevel.VERBOSE);
|
||||
config.setLogLevel(LogLevel.WARN);
|
||||
Adjust.onCreate(config);
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,6 @@ import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.UriHelper;
|
||||
import com.yizhuan.xchat_android_core.upgrade.bean.NewestVersionInfo;
|
||||
import com.yizhuan.xchat_android_core.upgrade.model.UpgradeModel;
|
||||
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
|
||||
|
||||
public class AppUpdateDialog extends DialogFragment implements View.OnClickListener {
|
||||
@@ -97,9 +96,6 @@ public class AppUpdateDialog extends DialogFragment implements View.OnClickListe
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.tvLater:
|
||||
if (UpgradeModel.get().isDownloading()) {
|
||||
UpgradeModel.get().stopDownload();
|
||||
}
|
||||
dismissAllowingStateLoss();
|
||||
break;
|
||||
|
||||
|
@@ -92,9 +92,10 @@ dependencies {
|
||||
api 'androidx.room:room-rxjava2:2.3.0'
|
||||
|
||||
//firebase推送、统计
|
||||
implementation 'com.google.firebase:firebase-messaging:22.0.0'
|
||||
implementation 'com.google.android.gms:play-services-base:17.6.0'
|
||||
implementation 'com.google.firebase:firebase-messaging:23.1.1'
|
||||
implementation 'com.google.android.gms:play-services-base:18.1.0'
|
||||
implementation 'com.google.firebase:firebase-core:19.0.0'
|
||||
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
|
||||
|
||||
//googleplay内购
|
||||
api 'com.google.android.gms:play-services-wallet:19.1.0'
|
||||
|
@@ -11,14 +11,6 @@ import io.reactivex.Single;
|
||||
*/
|
||||
public interface IUpgradeModel {
|
||||
|
||||
/**
|
||||
* 下载最新版本
|
||||
*
|
||||
* @param downLoadListener
|
||||
* @return
|
||||
*/
|
||||
Single<String> downloadNewVersion(UpgradeModel.DownLoadListener downLoadListener);
|
||||
|
||||
/**
|
||||
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
||||
*
|
||||
@@ -26,10 +18,6 @@ public interface IUpgradeModel {
|
||||
*/
|
||||
Single<NewestVersionInfo> checkUpgrade();
|
||||
|
||||
boolean isDownloading();
|
||||
|
||||
void stopDownload();
|
||||
|
||||
void setHasShowDialog(boolean flag);
|
||||
|
||||
boolean isHasShowDialog();
|
||||
|
@@ -45,13 +45,6 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
||||
|
||||
private static final String TAG = "UpgradeModel";
|
||||
|
||||
private NewestVersionInfo newestVersionInfo;
|
||||
private DownloadSerialQueue serialQueue;
|
||||
private DownloadTask downloadTask;
|
||||
|
||||
private DownLoadListener downLoadListener;
|
||||
private boolean isDownloading = false;
|
||||
|
||||
private final Api api;
|
||||
private static IUpgradeModel model;
|
||||
|
||||
@@ -74,133 +67,8 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
||||
|
||||
private UpgradeModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
serialQueue = new DownloadSerialQueue(new DownloadListener1() {
|
||||
@Override
|
||||
public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Log.e(TAG, "taskStart() called with: task = [" + task + "], model = [" + model + "]");
|
||||
if (task.getId() != downloadTask.getId()) {
|
||||
return;
|
||||
}
|
||||
if (downLoadListener == null) {
|
||||
return;
|
||||
}
|
||||
downLoadListener.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {
|
||||
Log.e(TAG, "retry() called with: task = [" + task + "], cause = [" + cause + "]");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {
|
||||
Log.e(TAG, "connected() called with: task = [" + task + "], blockCount = [" + blockCount + "], currentOffset = [" + currentOffset + "], totalLength = [" + totalLength + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {
|
||||
Log.e(TAG, "progress() called with: task = [" + task + "], currentOffset = [" + currentOffset + "], totalLength = [" + totalLength + "]");
|
||||
if (task.getId() != downloadTask.getId()) {
|
||||
return;
|
||||
}
|
||||
if (downLoadListener == null) {
|
||||
return;
|
||||
}
|
||||
downLoadListener.onProgress(currentOffset, totalLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {
|
||||
Log.e(TAG, "taskEnd() called with: task = [" + task + "], cause = [" + cause + "], realCause = [" + realCause + "], model = [" + model + "]");
|
||||
if (task.getId() != downloadTask.getId()) {
|
||||
return;
|
||||
}
|
||||
downloadTask = null;
|
||||
if (downLoadListener == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cause != EndCause.COMPLETED) {
|
||||
if (realCause != null) {
|
||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_01));
|
||||
} else {
|
||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_02));
|
||||
}
|
||||
downLoadListener = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String downloadFileMD5 = MD5Utils.getFileMD5String(task.getFile());
|
||||
if (Objects.equals(downloadFileMD5, newestVersionInfo.getUpdateFileMd5())) {
|
||||
downLoadListener.onComplete(task.getFile());
|
||||
installApp(task.getFile());
|
||||
} else {
|
||||
downLoadListener.onError(ResUtil.getString(R.string.upgrade_model_upgrademodel_03));
|
||||
}
|
||||
downLoadListener = null;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
downLoadListener.onError(e.getMessage());
|
||||
downLoadListener = null;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装
|
||||
*/
|
||||
private void installApp(File file) {
|
||||
try {
|
||||
Intent install = new Intent(Intent.ACTION_VIEW);
|
||||
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
Uri contentUri = FileProvider.getUriForFile(getContext(), getContext().getPackageName() + ".fileprovider", file);
|
||||
install.setDataAndType(contentUri, "application/vnd.android.package-archive");
|
||||
} else {
|
||||
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
|
||||
}
|
||||
BasicConfig.INSTANCE.getAppContext().startActivity(install);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载新版本
|
||||
*
|
||||
* @param downLoadListener
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> downloadNewVersion(DownLoadListener downLoadListener) {
|
||||
if (null == newestVersionInfo || TextUtils.isEmpty(newestVersionInfo.getUpdateDownloadLink())) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_04)));
|
||||
}
|
||||
if (downloadTask != null) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_05)));
|
||||
}
|
||||
|
||||
this.downLoadListener = downLoadListener;
|
||||
downloadTask = new DownloadTask.Builder(newestVersionInfo.getUpdateDownloadLink(),
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS))
|
||||
.setFilenameFromResponse(true)
|
||||
.setMinIntervalMillisCallbackProcess(100)
|
||||
.setPassIfAlreadyCompleted(false)
|
||||
.setAutoCallbackToUIThread(true)
|
||||
.build();
|
||||
serialQueue.enqueue(downloadTask);
|
||||
|
||||
return Single.just(ResUtil.getString(R.string.upgrade_model_upgrademodel_06));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取最新版本信息,后台会根据我们的公参获取到我们的版本号渠道号
|
||||
*
|
||||
@@ -210,38 +78,18 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
||||
public Single<NewestVersionInfo> checkUpgrade() {
|
||||
return api.loadNewestVersion()
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.flatMap(new Function<ServiceResult<NewestVersionInfo>, SingleSource<NewestVersionInfo>>() {
|
||||
@Override
|
||||
public SingleSource<NewestVersionInfo> apply(ServiceResult<NewestVersionInfo> respone) throws Exception {
|
||||
if (respone.isSuccess() && respone.getData() == null) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_07)));
|
||||
}
|
||||
if (respone.isSuccess() && respone.getData() != null) {
|
||||
newestVersionInfo = respone.getData();
|
||||
return Single.just(respone.getData());
|
||||
}
|
||||
return Single.error(new Throwable(respone.getMessage()));
|
||||
.flatMap((Function<ServiceResult<NewestVersionInfo>, SingleSource<NewestVersionInfo>>) respone -> {
|
||||
if (respone.isSuccess() && respone.getData() == null) {
|
||||
return Single.error(new Throwable(ResUtil.getString(R.string.upgrade_model_upgrademodel_07)));
|
||||
}
|
||||
if (respone.isSuccess() && respone.getData() != null) {
|
||||
return Single.just(respone.getData());
|
||||
}
|
||||
return Single.error(new Throwable(respone.getMessage()));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDownloading() {
|
||||
if (downloadTask == null) {
|
||||
return false;
|
||||
}
|
||||
return serialQueue.getWorkingTaskId() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopDownload() {
|
||||
if (downloadTask != null) {
|
||||
downloadTask.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHasShowDialog(boolean flag) {
|
||||
this.hasShowDialog = flag;
|
||||
@@ -252,17 +100,6 @@ public class UpgradeModel extends BaseModel implements IUpgradeModel {
|
||||
return hasShowDialog;
|
||||
}
|
||||
|
||||
public interface DownLoadListener {
|
||||
public void onStart();
|
||||
|
||||
public void onComplete(File file);
|
||||
|
||||
public void onProgress(long currentOffset, long totalLength);
|
||||
|
||||
public void onError(String reason);
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 获取最新版本信息
|
||||
|
@@ -40,7 +40,11 @@ MobSDK {
|
||||
}
|
||||
|
||||
permissions {
|
||||
exclude "android.permission.READ_PHONE_STATE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION", "android.permission.QUERY_ALL_PACKAGES"
|
||||
exclude "android.permission.READ_PHONE_STATE", "android.permission.ACCESS_FINE_LOCATION",
|
||||
"android.permission.ACCESS_COARSE_LOCATION", "android.permission.QUERY_ALL_PACKAGES",
|
||||
"android.permission.GET_ACCOUNTS", "android.permission.ACCESS_WIFI_STATE",
|
||||
"android.permission.READ_SMS", "android.permission.RECEIVE_SMS",
|
||||
"android.permission.READ_CONTACTS"
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user