谷歌敏感权限和新的更新包逻辑
This commit is contained in:
parent
24e07db6e1
commit
f52e10b96f
@ -114,15 +114,15 @@ dependencies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// 链接包需要注释掉 否正无法更新 谷歌包需要打开
|
// 链接包需要注释掉 否正无法更新 谷歌包需要打开
|
||||||
project.afterEvaluate {
|
//project.afterEvaluate {
|
||||||
android.applicationVariants.all { variant ->
|
// android.applicationVariants.all { variant ->
|
||||||
variant.outputs.each { output ->
|
// variant.outputs.each { output ->
|
||||||
output.processResources.doFirst { pm->
|
// output.processResources.doFirst { pm->
|
||||||
String manifestPath = output.processResources.manifestFile;
|
// String manifestPath = output.processResources.manifestFile;
|
||||||
def manifestContent = file(manifestPath).getText()
|
// def manifestContent = file(manifestPath).getText()
|
||||||
manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
|
// manifestContent = manifestContent.replace('android.permission.REQUEST_INSTALL_PACKAGES', '')
|
||||||
file(manifestPath).write(manifestContent)
|
// file(manifestPath).write(manifestContent)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
@ -47,9 +47,7 @@
|
|||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.MODIFY_AUDIO_SETTINGS"
|
android:name="android.permission.MODIFY_AUDIO_SETTINGS"
|
||||||
tools:node="remove" />
|
tools:node="remove" />
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.REQUEST_INSTALL_PACKAGES"
|
|
||||||
tools:node="remove" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
@ -57,6 +57,15 @@ public class ConfigBean {
|
|||||||
private String txVideoUgcLicenceUrl;//腾讯直播视频鉴权
|
private String txVideoUgcLicenceUrl;//腾讯直播视频鉴权
|
||||||
private String txPlayUgcLicenceUrl;//腾讯短视频鉴权
|
private String txPlayUgcLicenceUrl;//腾讯短视频鉴权
|
||||||
private String txVideoUgcKey;
|
private String txVideoUgcKey;
|
||||||
|
private String google_isup;
|
||||||
|
@JSONField(name = "google_isup")
|
||||||
|
public String getGoogle_isup() {
|
||||||
|
return google_isup;
|
||||||
|
}
|
||||||
|
@JSONField(name = "google_isup")
|
||||||
|
public void setGoogle_isup(String google_isup) {
|
||||||
|
this.google_isup = google_isup;
|
||||||
|
}
|
||||||
|
|
||||||
@JSONField(name = "tx_play_ugc_licence_url")
|
@JSONField(name = "tx_play_ugc_licence_url")
|
||||||
public String getTxPlayUgcLicenceUrl() {
|
public String getTxPlayUgcLicenceUrl() {
|
||||||
|
@ -165,7 +165,8 @@ public class CommonHttpUtil {
|
|||||||
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
//或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题
|
||||||
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
|
HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG)
|
||||||
.params("langue", lang)
|
.params("langue", lang)
|
||||||
.params("version", "6.4.1")
|
.params("version", ""+VersionUtil.getVersion())
|
||||||
|
.params("from", "android")
|
||||||
.execute(new HttpCallback() {
|
.execute(new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.yunbao.common.utils;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -8,6 +9,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
@ -47,7 +49,7 @@ public class VersionUtil {
|
|||||||
|
|
||||||
|
|
||||||
//是否是谷歌版本
|
//是否是谷歌版本
|
||||||
public static void showDialog(final Context context, ConfigBean configBean, final String downloadUrl) {
|
public static void showDialog(final Activity context, ConfigBean configBean, final String downloadUrl) {
|
||||||
if (configBean.getForceUpdate() != 0) {
|
if (configBean.getForceUpdate() != 0) {
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||||
if (!TextUtils.isEmpty(downloadUrl)) {
|
if (!TextUtils.isEmpty(downloadUrl)) {
|
||||||
@ -79,6 +81,7 @@ public class VersionUtil {
|
|||||||
|
|
||||||
//谷歌更新
|
//谷歌更新
|
||||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||||
|
if (configBean.getGoogle_isup().equals("0")) {
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
.setContent(configBean.getUpdateDes())
|
.setContent(configBean.getUpdateDes())
|
||||||
@ -99,7 +102,29 @@ public class VersionUtil {
|
|||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
.show();
|
.show();
|
||||||
|
} else {
|
||||||
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
|
.setContent(configBean.getUpdateDes())
|
||||||
|
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||||
|
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||||
|
.setCancelable(false)
|
||||||
|
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||||
|
public void onCancelClick() {
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||||
|
context.startActivity(i);
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||||
@ -124,7 +149,7 @@ public class VersionUtil {
|
|||||||
.updateContent(configBean.getUpdateDes())
|
.updateContent(configBean.getUpdateDes())
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
},2000);
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -133,7 +158,9 @@ public class VersionUtil {
|
|||||||
} else {
|
} else {
|
||||||
ToastUtil.show(R.string.version_download_url_error);
|
ToastUtil.show(R.string.version_download_url_error);
|
||||||
}
|
}
|
||||||
}else if(CommonAppConfig.IS_GOOGLE_PLAY == true){
|
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||||
|
if (configBean.getGoogle_isup().equals("0")) {
|
||||||
|
Log.e("tagg", "111111");
|
||||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
.setContent(configBean.getUpdateDes())
|
.setContent(configBean.getUpdateDes())
|
||||||
@ -154,6 +181,30 @@ public class VersionUtil {
|
|||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
.show();
|
.show();
|
||||||
|
} else {
|
||||||
|
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||||
|
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||||
|
.setContent(configBean.getUpdateDes())
|
||||||
|
.setConfrimString(WordUtil.getString(R.string.version_immediate_use))
|
||||||
|
.setCancelString(WordUtil.getString(R.string.version_not_update))
|
||||||
|
.setCancelable(false)
|
||||||
|
.setClickCallback(new DialogUitl.SimpleCallback2() {
|
||||||
|
public void onCancelClick() {
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
|
Intent i = new Intent(android.content.Intent.ACTION_VIEW);
|
||||||
|
i.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.pdlive.shayu"));
|
||||||
|
context.startActivity(i);
|
||||||
|
context.finish();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@
|
|||||||
<string name="share_cancel">分享取消</string>
|
<string name="share_cancel">分享取消</string>
|
||||||
<string name="version_update">版本更新</string>
|
<string name="version_update">版本更新</string>
|
||||||
<string name="versions">版本號</string>
|
<string name="versions">版本號</string>
|
||||||
<string name="version_immediate_use">立即使用</string>
|
<string name="version_immediate_use">立即更新</string>
|
||||||
<string name="version_not_update">暫不更新</string>
|
<string name="version_not_update">暫不更新</string>
|
||||||
<string name="version_latest">已經是最新版本</string>
|
<string name="version_latest">已經是最新版本</string>
|
||||||
<string name="version_download_url_error">下載地址無效</string>
|
<string name="version_download_url_error">下載地址無效</string>
|
||||||
|
@ -25,6 +25,6 @@ ext {
|
|||||||
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S",
|
||||||
|
|
||||||
// true表示谷歌支付 false
|
// true表示谷歌支付 false
|
||||||
isGooglePlay : false
|
isGooglePlay : true
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -195,6 +195,24 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
public void onSetupSuccess(boolean isSelf) {
|
public void onSetupSuccess(boolean isSelf) {
|
||||||
super.onSetupSuccess(isSelf);
|
super.onSetupSuccess(isSelf);
|
||||||
Log.d(TAG, "内购服务初始化完成");
|
Log.d(TAG, "内购服务初始化完成");
|
||||||
|
// googleBillingUtil.queryPurchaseHistoryAsyncInApp(new PurchaseHistoryResponseListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onPurchaseHistoryResponse(@NonNull BillingResult billingResult, @Nullable List<PurchaseHistoryRecord> list) {
|
||||||
|
// Log.e(TAG,list.get(0).getPurchaseToken());
|
||||||
|
// //谷歌掉单处理
|
||||||
|
//// CommonHttpUtil.Google_sec_pay(purchase.getPurchaseToken(), purchase.getOrderId(), purchase.getSku(), new HttpCallback() {
|
||||||
|
//// @Override
|
||||||
|
//// public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//// });
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
List<Purchase> data = googleBillingUtil.queryPurchasesInApp(MainActivity.this);
|
||||||
|
if(data!=null&&data.size()>0) {
|
||||||
|
Log.e(TAG, data.get(0).getSku());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -284,6 +302,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
.addOnGoogleBillingListener(MainActivity.this, mOnMyGoogleBillingListener)
|
.addOnGoogleBillingListener(MainActivity.this, mOnMyGoogleBillingListener)
|
||||||
.build(MainActivity.this);
|
.build(MainActivity.this);
|
||||||
|
|
||||||
|
|
||||||
//在请求一下这个接口给我后台版本号
|
//在请求一下这个接口给我后台版本号
|
||||||
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
||||||
@Override
|
@Override
|
||||||
@ -446,7 +465,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
showInvitationCode();
|
showInvitationCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkVersion();
|
|
||||||
loginIM();
|
loginIM();
|
||||||
CommonAppConfig.getInstance().setLaunched(true);
|
CommonAppConfig.getInstance().setLaunched(true);
|
||||||
mFristLoad = true;
|
mFristLoad = true;
|
||||||
@ -542,6 +560,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
});
|
});
|
||||||
//获取指导员账号
|
//获取指导员账号
|
||||||
ConversationIMListManager.get(this).getUserInstructor(this);
|
ConversationIMListManager.get(this).getUserInstructor(this);
|
||||||
|
checkVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -570,6 +589,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
public void onError(String error) {
|
public void onError(String error) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user