version:1.5.6
fix:修复app升级 update:40h,50minipro
This commit is contained in:
110
app/build.gradle
110
app/build.gradle
@@ -1,6 +1,5 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: "com.tencent.android.tpns"
|
||||
|
||||
def appName() {
|
||||
return "CubeZYAppStore"
|
||||
@@ -18,8 +17,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 23
|
||||
versionName "1.3.1"
|
||||
versionCode 48
|
||||
versionName "1.5.6"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -28,11 +27,6 @@ android {
|
||||
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
|
||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||
}
|
||||
|
||||
manifestPlaceholders = [
|
||||
XG_ACCESS_ID : "1500033122",
|
||||
XG_ACCESS_KEY: "A5QBQVQ7KLQD",
|
||||
]
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
@@ -54,6 +48,14 @@ android {
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
mtk12 {
|
||||
storeFile file("keystore/mtkAndroid12.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "mtk12"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
cube8183 {
|
||||
storeFile file("keystore/TeclastMTK12.jks")
|
||||
storePassword "123456"
|
||||
@@ -70,6 +72,15 @@ android {
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
Teclast8515 {
|
||||
storeFile file("keystore/Teclast8515.keystore")
|
||||
storePassword "123456"
|
||||
keyAlias "Teclast8515"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
iPlay50SE {
|
||||
storeFile file("keystore/iPlay50SE.keystore")
|
||||
storePassword "123456"
|
||||
@@ -96,6 +107,23 @@ android {
|
||||
keyPassword "android"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
iPlay50miniPro {
|
||||
storeFile file("keystore/iPlay50miniPro.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "iplay50minipro"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
iPlay40H {
|
||||
storeFile file("keystore/iPlay40h.keystore")
|
||||
storePassword "android"
|
||||
keyAlias "platform"
|
||||
keyPassword "android"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -127,6 +155,34 @@ android {
|
||||
signingConfig signingConfigs.teclast8183
|
||||
}
|
||||
|
||||
Teclast8515Debug.initWith(debug)
|
||||
Teclast8515Debug {
|
||||
buildConfigField "String", "platform", '"8515"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.Teclast8515
|
||||
}
|
||||
|
||||
Teclast8515Release.initWith(release)
|
||||
Teclast8515Release {
|
||||
buildConfigField "String", "platform", '"8515"'
|
||||
signingConfig signingConfigs.Teclast8515
|
||||
}
|
||||
|
||||
iPlay50ProDebug.initWith(debug)
|
||||
iPlay50ProDebug {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.mtk12
|
||||
}
|
||||
|
||||
iPlay50ProRelease.initWith(release)
|
||||
iPlay50ProRelease {
|
||||
buildConfigField "String", "platform", '"MTK"'
|
||||
signingConfig signingConfigs.mtk12
|
||||
}
|
||||
|
||||
iPlay50SEDebug.initWith(debug)
|
||||
iPlay50SEDebug {
|
||||
buildConfigField "String", "platform", '"ipaly50SE"'
|
||||
@@ -169,6 +225,34 @@ android {
|
||||
signingConfig signingConfigs.iPlay50mini
|
||||
}
|
||||
|
||||
iPlay50miniProDebug.initWith(debug)
|
||||
iPlay50miniProDebug {
|
||||
buildConfigField "String", "platform", '"miniG99"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50miniPro
|
||||
}
|
||||
|
||||
iPlay50miniProRelease.initWith(release)
|
||||
iPlay50miniProRelease {
|
||||
buildConfigField "String", "platform", '"miniG99"'
|
||||
signingConfig signingConfigs.iPlay50miniPro
|
||||
}
|
||||
|
||||
iPlay40HDebug.initWith(debug)
|
||||
iPlay40HDebug {
|
||||
buildConfigField "String", "platform", '"iplay40h"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50mini
|
||||
}
|
||||
|
||||
iPlay40HRelease.initWith(release)
|
||||
iPlay40HRelease {
|
||||
buildConfigField "String", "platform", '"iplay40h"'
|
||||
signingConfig signingConfigs.iPlay50mini
|
||||
}
|
||||
|
||||
zhanRuiDebug.initWith(debug)
|
||||
zhanRuiDebug {
|
||||
debuggable true
|
||||
@@ -225,17 +309,23 @@ android {
|
||||
sourceSets {
|
||||
Cube8183Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
Teclast8183Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
Teclast8515Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
iPlay50ProDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
iPlay50SEDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
iPlay50miniDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
iPlay5013Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
iPlay50miniProDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
zhanRuiDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
|
||||
Cube8183Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
Teclast8183Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
Teclast8515Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
iPlay50ProRelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
iPlay50SERelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
iPlay50miniRelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
iPlay5013Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
iPlay50miniProRelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
zhanRuiRelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
}
|
||||
@@ -294,10 +384,6 @@ dependencies {
|
||||
implementation 'com.google.zxing:core:3.5.0'
|
||||
//MMKV
|
||||
implementation 'com.tencent:mmkv-static:1.2.13'
|
||||
//腾讯移动推送 TPNS
|
||||
implementation 'com.tencent.tpns:tpns:1.3.2.0-release'
|
||||
//阿里云推送
|
||||
implementation 'com.aliyun.ams:alicloud-android-push:3.8.0'
|
||||
//banner图
|
||||
implementation 'com.zhpan.library:bannerview:2.6.4'
|
||||
//更换字体框架
|
||||
|
||||
BIN
app/keystore/Teclast8515.keystore
Normal file
BIN
app/keystore/Teclast8515.keystore
Normal file
Binary file not shown.
BIN
app/keystore/iPlay40h.keystore
Normal file
BIN
app/keystore/iPlay40h.keystore
Normal file
Binary file not shown.
BIN
app/keystore/iPlay50miniPro.jks
Normal file
BIN
app/keystore/iPlay50miniPro.jks
Normal file
Binary file not shown.
BIN
app/keystore/mtkAndroid12.keystore
Normal file
BIN
app/keystore/mtkAndroid12.keystore
Normal file
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.uiui.zyappstore"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
@@ -12,34 +11,14 @@
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.MASTER_CLEAR" />
|
||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||
<!-- 系统权限,有系统签名可以使用 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="com.uiui.zyappstore.permission.JPUSH_MESSAGE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<permission
|
||||
android:name="com.uiui.zyappstore.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="com.uiui.zyappstore.permission.XGPUSH_RECEIVE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||
|
||||
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
|
||||
@@ -102,8 +81,6 @@
|
||||
android:name="com.uiui.zyappstore.activity.DownloadManagerActivity"
|
||||
android:screenOrientation="behind" />
|
||||
|
||||
<service android:name="com.uiui.zyappstore.service.GuardService" />
|
||||
<service android:name="com.uiui.zyappstore.service.StepService" />
|
||||
<service android:name="com.uiui.zyappstore.service.DownloadService" />
|
||||
<service
|
||||
android:name="com.uiui.zyappstore.service.main.MainService"
|
||||
@@ -161,168 +138,7 @@
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="${applicationId}"
|
||||
android:scheme="tpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.InnerTpnsActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY_V2" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="${applicationId}"
|
||||
android:scheme="stpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 【必须】 信鸽receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
<!-- 【必须】 信鸽SDK的内部广播 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.SDK" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- 【必须】移动推送 TPNS service -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.service.XGVipPushService"
|
||||
android:persistent="true"
|
||||
android:process=":xg_vip_service" />
|
||||
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
<action android:name="com.uiui.zyappstore.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service> <!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="com.uiui.zyappstore.XGVIP_PUSH_AUTH" />
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="com.uiui.zyappstore.TPUSH_PROVIDER" />
|
||||
|
||||
<!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="com.uiui.zyappstore.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true"
|
||||
tools:replace="android:exported" />
|
||||
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name="com.uiui.zyappstore.push.tpush.MessageReceiver">
|
||||
<intent-filter>
|
||||
<!-- 接收消息透传 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
|
||||
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- MQTT START -->
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<provider
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="com.uiui.zyappstore.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" />
|
||||
<!-- MQTT END -->
|
||||
|
||||
<!-- 消息接收监听器 (用户可自主扩展) -->
|
||||
<receiver
|
||||
android:name=".push.alipush.AliyunMessageReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".push.alipush.AliMessageIntentService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_ID"
|
||||
android:value="1500033122" />
|
||||
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="A5QBQVQ7KLQD" />
|
||||
|
||||
<!-- 请填写你自己的- appKey -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appkey"
|
||||
android:value="333816246" />
|
||||
<!-- 请填写你自己的appSecret -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appsecret"
|
||||
android:value="b8cdbee64b5a4d1a8e212924ee71b0d3" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.uiui.zyappstore"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
@@ -12,34 +11,14 @@
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.MASTER_CLEAR" />
|
||||
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
|
||||
<!-- 系统权限,有系统签名可以使用 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="com.uiui.zyappstore.permission.JPUSH_MESSAGE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK VIP版本所需权限 -->
|
||||
<permission
|
||||
android:name="com.uiui.zyappstore.permission.XGPUSH_RECEIVE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="com.uiui.zyappstore.permission.XGPUSH_RECEIVE" />
|
||||
|
||||
<!-- 【必须】 移动推送 TPNS SDK 所需权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
|
||||
|
||||
<!-- 【常用】 移动推送 TPNS SDK所需权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
|
||||
@@ -102,9 +81,6 @@
|
||||
android:name="com.uiui.zyappstore.activity.DownloadManagerActivity"
|
||||
android:screenOrientation="behind" />
|
||||
|
||||
<service android:name="com.uiui.zyappstore.service.GuardService" />
|
||||
<service android:name="com.uiui.zyappstore.service.StepService" />
|
||||
<service android:name="com.uiui.zyappstore.service.DownloadService" />
|
||||
<service
|
||||
android:name="com.uiui.zyappstore.service.main.MainService"
|
||||
android:enabled="true"
|
||||
@@ -161,168 +137,7 @@
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.TpnsActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="${applicationId}"
|
||||
android:scheme="tpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.tencent.android.tpush.InnerTpnsActivity"
|
||||
android:exported="false"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.OPEN_TPNS_ACTIVITY_V2" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="${applicationId}"
|
||||
android:scheme="stpns" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 【必须】 信鸽receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service">
|
||||
<intent-filter android:priority="0x7fffffff">
|
||||
|
||||
<!-- 【必须】 信鸽SDK的内部广播 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.SDK" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.INTERNAL_PUSH_MESSAGE" />
|
||||
<action android:name="com.tencent.android.xg.vip.action.ACTION_SDK_KEEPALIVE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- 【必须】移动推送 TPNS service -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.service.XGVipPushService"
|
||||
android:persistent="true"
|
||||
android:process=":xg_vip_service" />
|
||||
<!-- 【必须】通知 service ,android:name 部分改为包名.XGVIP_PUSH_ACTION -->
|
||||
<service
|
||||
android:name="com.tencent.android.tpush.rpc.XGRemoteService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<!-- 【必须】请修改为当前APP名包.XGVIP_PUSH_ACTION -->
|
||||
<action android:name="com.uiui.zyappstore.XGVIP_PUSH_ACTION" />
|
||||
</intent-filter>
|
||||
</service> <!-- 【必须】【注意】authorities 修改为包名.XGVIP_PUSH_AUTH -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGPushProvider"
|
||||
android:authorities="com.uiui.zyappstore.XGVIP_PUSH_AUTH" />
|
||||
|
||||
<!-- 【必须】【注意】authorities 修改为包名.TPUSH_PROVIDER -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.SettingsContentProvider"
|
||||
android:authorities="com.uiui.zyappstore.TPUSH_PROVIDER" />
|
||||
|
||||
<!-- 【可选】用于增强保活能力 -->
|
||||
<provider
|
||||
android:name="com.tencent.android.tpush.XGVipPushKAProvider"
|
||||
android:authorities="com.uiui.zyappstore.AUTH_XGPUSH_KEEPALIVE"
|
||||
android:exported="true"
|
||||
tools:replace="android:exported" />
|
||||
|
||||
<!-- 【可选】APP实现的Receiver,用于接收消息透传和操作结果的回调,请根据需要添加 -->
|
||||
<!-- YOUR_PACKAGE_PATH.CustomPushReceiver需要改为自己的Receiver: -->
|
||||
<receiver android:name="com.uiui.zyappstore.push.tpush.MessageReceiver">
|
||||
<intent-filter>
|
||||
<!-- 接收消息透传 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.PUSH_MESSAGE" />
|
||||
<!-- 监听注册、反注册、设置/删除标签、通知被点击等处理结果 -->
|
||||
<action android:name="com.tencent.android.xg.vip.action.FEEDBACK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!-- MQTT START -->
|
||||
<service
|
||||
android:name="com.tencent.tpns.mqttchannel.services.MqttService"
|
||||
android:exported="false"
|
||||
android:process=":xg_vip_service" />
|
||||
|
||||
<provider
|
||||
android:name="com.tencent.tpns.baseapi.base.SettingsContentProvider"
|
||||
android:authorities="com.uiui.zyappstore.XG_SETTINGS_PROVIDER"
|
||||
android:exported="false" />
|
||||
<!-- MQTT END -->
|
||||
|
||||
<!-- 消息接收监听器 (用户可自主扩展) -->
|
||||
<receiver
|
||||
android:name=".push.alipush.AliyunMessageReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".push.alipush.AliMessageIntentService"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_OPENED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.push2.action.NOTIFICATION_REMOVED" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alibaba.sdk.android.push.RECEIVE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- 【必须】 请修改为 APP 的 AccessId,“15”开头的10位数字,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_ID"
|
||||
android:value="1500033122" />
|
||||
<!-- 【必须】 请修改为APP的AccessKey,“A”开头的12位字符串,中间没空格 -->
|
||||
<meta-data
|
||||
android:name="XG_V2_ACCESS_KEY"
|
||||
android:value="A5QBQVQ7KLQD" />
|
||||
|
||||
<!-- 请填写你自己的- appKey -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appkey"
|
||||
android:value="333816246" />
|
||||
<!-- 请填写你自己的appSecret -->
|
||||
<meta-data
|
||||
android:name="com.alibaba.app.appsecret"
|
||||
android:value="b8cdbee64b5a4d1a8e212924ee71b0d3" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -15,7 +15,7 @@ import com.uiui.zyappstore.adapter.AppAdapter;
|
||||
import com.uiui.zyappstore.base.BaseActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.common.CommonDatas;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ClassAppActivity extends BaseActivity {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
String className = intent.getStringExtra(CommonDatas.APP_CLASS_NAME);
|
||||
String className = intent.getStringExtra(CommonConfig.APP_CLASS_NAME);
|
||||
if (!TextUtils.isEmpty(className)) {
|
||||
mMoreappTvTitle.setText(className);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class ClassAppActivity extends BaseActivity {
|
||||
ToastUtil.show("功能暂未开放");
|
||||
}
|
||||
});
|
||||
int classId = intent.getIntExtra(CommonDatas.APP_CLASS_ID, 0);
|
||||
int classId = intent.getIntExtra(CommonConfig.APP_CLASS_ID, 0);
|
||||
mAppAdapter = new AppAdapter(this);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
|
||||
mRecyclerView.setLayoutManager(gridLayoutManager);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -31,12 +32,14 @@ import com.uiui.zyappstore.base.BaseActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.bean.GlideCircleWithBorder;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.helper.CustomSnapHelper;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
import com.uiui.zyappstore.utils.FileUtils;
|
||||
import com.uiui.zyappstore.utils.StorageUtils;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
import com.uiui.zyappstore.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -139,6 +142,10 @@ public class DetailsActivity extends BaseActivity {
|
||||
tv_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!Utils.canDownloadApp(DetailsActivity.this)) {
|
||||
ToastUtil.show("应用市场已被禁止安装");
|
||||
return;
|
||||
}
|
||||
if (installed && !update) {
|
||||
ApkUtils.openApp(DetailsActivity.this, appInfo.getApp_package());
|
||||
} else {
|
||||
|
||||
@@ -26,9 +26,6 @@ import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.bean.UserInfo;
|
||||
import com.uiui.zyappstore.fragment.FeaturedFragment;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.service.GuardService;
|
||||
import com.uiui.zyappstore.service.DownloadService;
|
||||
import com.uiui.zyappstore.service.StepService;
|
||||
import com.uiui.zyappstore.service.main.MainService;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.SPUtils;
|
||||
@@ -67,7 +64,6 @@ public class MainActivity extends BaseActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.e(TAG, "onCreate");
|
||||
startService(new Intent(MainActivity.this, DownloadService.class));
|
||||
starService();
|
||||
JGYUtils.getInstance().checkLocalExternalFiles();
|
||||
}
|
||||
@@ -107,10 +103,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void starService() {
|
||||
startService(new Intent(this, GuardService.class));
|
||||
startService(new Intent(this, StepService.class));
|
||||
startService(new Intent(this, MainService.class));
|
||||
startService(new Intent(this, DownloadService.class));
|
||||
}
|
||||
|
||||
private void initTabLayout() {
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.uiui.zyappstore.adapter.AppAdapter;
|
||||
import com.uiui.zyappstore.base.BaseActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.common.CommonDatas;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.fragment.FeaturedFragment;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
@@ -56,7 +56,7 @@ public class MoreAppActivity extends BaseActivity {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
String extra = intent.getStringExtra(CommonDatas.MORE_APP_TITLE);
|
||||
String extra = intent.getStringExtra(CommonConfig.MORE_APP_TITLE);
|
||||
if (!TextUtils.isEmpty(extra)) {
|
||||
mMoreappTvTitle.setText(extra);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.uiui.zyappstore.adapter.AppAdapter;
|
||||
import com.uiui.zyappstore.base.BaseActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
|
||||
@@ -130,7 +131,7 @@ public class SearcherActivity extends BaseActivity {
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
getAllAppPackageName();
|
||||
} else {
|
||||
int setting_admin_app = Settings.System.getInt(getContentResolver(), "setting_admin_app", 1);
|
||||
int setting_admin_app = Settings.System.getInt(getContentResolver(), CommonConfig.APP_ADMIN, 1);
|
||||
if (setting_admin_app == 0) {
|
||||
ToastUtil.debugShow("搜索功能已禁用");
|
||||
} else {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.activity.DetailsActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.GlideCircleWithBorder;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
import com.uiui.zyappstore.utils.FileUtils;
|
||||
import com.uiui.zyappstore.utils.StorageUtils;
|
||||
@@ -137,9 +138,7 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
||||
if (installed && !update) {
|
||||
ApkUtils.openApp(mContext, appInfo.getApp_package());
|
||||
} else {
|
||||
int is_storeinstall = Settings.Global.getInt(mContext.getContentResolver(), "setting_is_storeinstall", 0);
|
||||
Log.e(TAG, "onClick: " + is_storeinstall);
|
||||
if (is_storeinstall == 0) {
|
||||
if (!Utils.canDownloadApp(mContext)) {
|
||||
ToastUtil.show("应用市场已被禁止安装");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
|
||||
@@ -23,22 +20,14 @@ import com.scwang.smartrefresh.layout.api.RefreshHeader;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushConfig;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.manager.ConnectManager;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.push.PushManager;
|
||||
import com.uiui.zyappstore.receiver.AppManagerReceiver;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
import com.uiui.zyappstore.utils.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by asus on 2017/10/27.
|
||||
@@ -73,9 +62,6 @@ public class BaseApplication extends Application {
|
||||
Log.i(TAG, "mmkv root: " + rootDir);
|
||||
|
||||
JGYUtils.init(this);
|
||||
PushManager.init(this);
|
||||
tPushInit();
|
||||
aliyunPushInit();
|
||||
ToastUtil.init(this);
|
||||
ConnectManager.init(this);
|
||||
Aria.init(this);
|
||||
@@ -88,91 +74,8 @@ public class BaseApplication extends Application {
|
||||
registAppReceive();
|
||||
NetInterfaceManager.init(this);
|
||||
JGYUtils.hookWebView();
|
||||
|
||||
//全局字体初始化
|
||||
// CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
|
||||
// // .setDefaultFontPath("fonts/1234.ttf")
|
||||
// .setDefaultFontPath("fonts/SourceHanSansCN-ExtraLight.ttf")
|
||||
//// .setDefaultFontPath("fonts/test.ttf")
|
||||
// .setFontAttrId(R.attr.fontPath)
|
||||
// .build()
|
||||
// );
|
||||
}
|
||||
|
||||
private void tPushInit() {
|
||||
XGPushConfig.enableDebug(this, true);
|
||||
XGPushManager.registerPush(this, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
//token在设备卸载重装的时候有可能会变
|
||||
Log.e("TPush", "注册成功,设备token为:" + data);
|
||||
List<XGPushManager.AccountInfo> accountInfoList = new ArrayList<>();
|
||||
accountInfoList.add(new XGPushManager.AccountInfo(XGPushManager.AccountType.CUSTOM.getValue(), Utils.getSerial()));
|
||||
XGPushManager.upsertAccounts(getApplicationContext(), accountInfoList, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object data, int flag) {
|
||||
Log.e("TPush", "onSuccess, data:" + data + ", flag:" + flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object data, int errCode, String msg) {
|
||||
Log.e("TPush", "onFail, data:" + data + ", code:" + errCode + ", msg:" + msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object data, int errCode, String msg) {
|
||||
Log.e("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void aliyunPushInit() {
|
||||
PushServiceFactory.init(this);
|
||||
final CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
pushService.setLogLevel(CloudPushService.LOG_DEBUG);
|
||||
pushService.register(this, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String response) {
|
||||
Log.e("AliyunPush", "init cloudchannel success");
|
||||
Log.e("AliyunPush", "init cloudchannel success " + pushService.getDeviceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMessage) {
|
||||
Log.e("AliyunPush", "init cloudchannel failed -- errorcode:" + errorCode + " -- errorMessage:" + errorMessage);
|
||||
}
|
||||
});
|
||||
String account = Utils.getSerial();
|
||||
pushService.bindAccount(account, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.e("AliyunPush", "bind account " + account + " success\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMsg) {
|
||||
Log.e("AliyunPush", "bind account " + account + " failed." +
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg);
|
||||
}
|
||||
});
|
||||
String alias = Utils.getSerial();
|
||||
pushService.addAlias(account, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.e("AliyunPush", "add alias " + alias + " success\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMsg) {
|
||||
Log.e("AliyunPush", "add alias " + alias + " failed." +
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private AppManagerReceiver mAppManagerReceiver;
|
||||
|
||||
private void registAppReceive() {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.uiui.zyappstore.common;
|
||||
|
||||
|
||||
public class CommonConfig {
|
||||
public static final String MMKV_ID = "InterProcessKV";
|
||||
|
||||
public static final String FLAG_FIRST_ENTER = "iflytek_first_enter";
|
||||
|
||||
public static final String MORE_APP_TITLE = "moreAppTitle";
|
||||
public static final String APP_CLASS_ID = "class_id";
|
||||
public static final String APP_CLASS_NAME = "class_name";
|
||||
|
||||
/*应用市场是否禁止下载*/
|
||||
public static final String APP_STORE_INSTALL = "iflytek_setting_is_storeinstall";
|
||||
/*是否禁止应用打开*/
|
||||
public static final String APP_INSTALLATION = "iflytek_setting_other_appInstaller";
|
||||
/*是否为管理员app*/
|
||||
public static final String APP_ADMIN = "iflytek_setting_admin_app";
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.uiui.zyappstore.common;
|
||||
|
||||
|
||||
public class CommonDatas {
|
||||
public static final String FLAG_FIRST_ENTER = "qch_first_enter";
|
||||
|
||||
public static final String MORE_APP_TITLE = "moreAppTitle";
|
||||
public static final String APP_CLASS_ID = "class_id";
|
||||
public static final String APP_CLASS_NAME = "class_name";
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.util.Log;
|
||||
|
||||
import com.jakewharton.disklrucache.DiskLruCache;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -30,7 +31,7 @@ import java.io.Serializable;
|
||||
public class CacheHelper {
|
||||
private static final String TAG = "DiskLruCacheHelper";
|
||||
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
private static final String DIR_NAME = "diskCache";
|
||||
private static final int MAX_COUNT = 1024 * 1024 * 1024;
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.content.res.Resources;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -34,7 +33,6 @@ import com.bumptech.glide.request.transition.Transition;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.activity.ClassAppActivity;
|
||||
import com.uiui.zyappstore.activity.ManagerAppActivity;
|
||||
import com.uiui.zyappstore.activity.MoreAppActivity;
|
||||
import com.uiui.zyappstore.adapter.AppAdapter;
|
||||
import com.uiui.zyappstore.adapter.BannerViewHolder;
|
||||
@@ -45,7 +43,7 @@ import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.Banner;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.bean.ImageUrl;
|
||||
import com.uiui.zyappstore.common.CommonDatas;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.DensityUtil;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
@@ -224,7 +222,7 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, MoreAppActivity.class);
|
||||
intent.putExtra(CommonDatas.MORE_APP_TITLE, EXCLUSIVE_APP);
|
||||
intent.putExtra(CommonConfig.MORE_APP_TITLE, EXCLUSIVE_APP);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
@@ -232,7 +230,7 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mContext, MoreAppActivity.class);
|
||||
intent.putExtra(CommonDatas.MORE_APP_TITLE, POPULAR_APP);
|
||||
intent.putExtra(CommonConfig.MORE_APP_TITLE, POPULAR_APP);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
@@ -619,8 +617,8 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
int classId = appClassBean.getId();
|
||||
String className = appClassBean.getName();
|
||||
Intent intent = new Intent(getActivity(), ClassAppActivity.class);
|
||||
intent.putExtra(CommonDatas.APP_CLASS_ID, classId);
|
||||
intent.putExtra(CommonDatas.APP_CLASS_NAME, className);
|
||||
intent.putExtra(CommonConfig.APP_CLASS_ID, classId);
|
||||
intent.putExtra(CommonConfig.APP_CLASS_NAME, className);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.utils.TimeUtils;
|
||||
|
||||
public class ConnectManager {
|
||||
@@ -30,7 +31,7 @@ public class ConnectManager {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static ConnectManager sInstance;
|
||||
private Context mContext;
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
private ConnectManager(Context context) {
|
||||
if (context == null) {
|
||||
|
||||
@@ -21,12 +21,7 @@ import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
|
||||
public class HTTPInterface {
|
||||
private static final int GET_ALL_APPINFO = 0;
|
||||
private static final int GET_USERINFO = 1;
|
||||
private static final int GET_SORTAPP = 2;
|
||||
|
||||
|
||||
public static void checkUpdate(final Context context, String packageName, String versionCode) {
|
||||
NetInterfaceManager.getInstance()
|
||||
@@ -37,11 +32,12 @@ public class HTTPInterface {
|
||||
.subscribe(new Observer<BaseResponse<AppInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
Log.e("checkUpdate", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<AppInfo> appInfoBaseResponse) {
|
||||
Log.e("checkUpdate", "onNext: " + appInfoBaseResponse);
|
||||
int code = appInfoBaseResponse.code;
|
||||
if (code == 200) {
|
||||
AppInfo appInfo = appInfoBaseResponse.data;
|
||||
@@ -62,10 +58,9 @@ public class HTTPInterface {
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
Log.e("checkUpdate", "onComplete: ");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void checkUpdate(Context context) {
|
||||
|
||||
@@ -5,16 +5,12 @@ import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.sdk.android.push.CloudPushService;
|
||||
import com.alibaba.sdk.android.push.CommonCallback;
|
||||
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory;
|
||||
import com.tencent.android.tpush.XGIOperateCallback;
|
||||
import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyappstore.bean.AppClassBean;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.Banner;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.disklrucache.CacheHelper;
|
||||
import com.uiui.zyappstore.network.api.AdminAppApi;
|
||||
import com.uiui.zyappstore.network.api.AdminAppClassApi;
|
||||
@@ -54,7 +50,7 @@ public class NetInterfaceManager {
|
||||
private static NetInterfaceManager sInstance;
|
||||
private Context mContext;
|
||||
private Retrofit mRetrofit;
|
||||
private MMKV mMMKV = MMKV.defaultMMKV();
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
private OkHttpClient okHttpClient;
|
||||
private CacheHelper cacheHelper;
|
||||
|
||||
@@ -218,6 +214,8 @@ public class NetInterfaceManager {
|
||||
set.add(JGYUtils.iPlayMiniTag);
|
||||
} else if (platform == JGYUtils.iPlay5013Platform) {
|
||||
set.add(JGYUtils.iPlay5013Tag);
|
||||
} else if (platform == JGYUtils.iPlay50miniProPlatform) {
|
||||
set.add(JGYUtils.iPlay50miniProTag);
|
||||
}
|
||||
});
|
||||
setpushTag(set);
|
||||
@@ -225,30 +223,30 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
private void setpushTag(Set<String> tagSets) {
|
||||
XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object o, int i) {
|
||||
Log.e("setPushTags", "onSuccess: " + o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(Object o, int i, String s) {
|
||||
Log.e("setPushTags", "onFail: " + o);
|
||||
}
|
||||
});
|
||||
String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
|
||||
CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorCode, String errorMsg) {
|
||||
Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
|
||||
"errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||
}
|
||||
});
|
||||
// XGPushManager.clearAndAppendTags(mContext, "clearAndAppendTags :" + System.currentTimeMillis(), tagSets, new XGIOperateCallback() {
|
||||
// @Override
|
||||
// public void onSuccess(Object o, int i) {
|
||||
// Log.e("setPushTags", "onSuccess: " + o);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(Object o, int i, String s) {
|
||||
// Log.e("setPushTags", "onFail: " + o);
|
||||
// }
|
||||
// });
|
||||
// String[] tag = new ArrayList<>(tagSets).toArray(new String[tagSets.size()]);
|
||||
// CloudPushService pushService = PushServiceFactory.getCloudPushService();
|
||||
// pushService.bindTag(CloudPushService.DEVICE_TARGET, tag, null, new CommonCallback() {
|
||||
// @Override
|
||||
// public void onSuccess(String s) {
|
||||
// Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " success\n");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailed(String errorCode, String errorMsg) {
|
||||
// Log.e("bindTag", "bind tag " + Arrays.toString(tag) + " failed." +
|
||||
// "errorCode: " + errorCode + ", errorMsg:" + errorMsg + "\n");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.uiui.zyappstore.push;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.uiui.zyappstore.disklrucache.CacheHelper;
|
||||
import com.uiui.zyappstore.utils.FileUtils;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class PushManager {
|
||||
private static final String TAG = PushManager.class.getSimpleName();
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static PushManager sInstance;
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private CacheHelper mCacheHelper;
|
||||
|
||||
private PushManager(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
this.mContext = context;
|
||||
this.mResolver = context.getContentResolver();
|
||||
this.mCacheHelper = new CacheHelper(context);
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new PushManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static PushManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
throw new IllegalStateException("You must be init PushManager first");
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
// 9.强制安装应用
|
||||
private static final String ACTION_FORCE_INSTALLAPK = "9";
|
||||
|
||||
public void setPushContent(String title, String extras) {
|
||||
switch (title) {
|
||||
case ACTION_FORCE_INSTALLAPK:
|
||||
forceInstallApk( extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private void forceInstallApk(String jsonString) {
|
||||
if (TextUtils.isEmpty(jsonString)) {
|
||||
return;
|
||||
}
|
||||
JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject();
|
||||
final String packages = jsonObject.get("package").getAsString();
|
||||
ToastUtil.debugShow("收到应用安装消息:包名" + packages);
|
||||
String url = jsonObject.get("url").getAsString();
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
if (Aria.download(this).taskExists(url)) {
|
||||
List<DownloadEntity> entity = Aria.download(this).getDownloadEntity(url);
|
||||
for (DownloadEntity downloadEntity : entity) {
|
||||
Aria.download(this).load(downloadEntity.getId()).cancel(true);
|
||||
}
|
||||
}
|
||||
File file = new File(JGYUtils.getInstance().getDownLoadPath());
|
||||
file.mkdirs();
|
||||
FileUtils.ariaDownload(mContext, url, jsonObject);
|
||||
Aria.download(this).resumeAllTask();
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.uiui.zyappstore.push.alipush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.sdk.android.push.AliyunMessageIntentService;
|
||||
import com.alibaba.sdk.android.push.notification.CPushMessage;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by liyazhou on 17/8/22.
|
||||
* 为避免推送广播被系统拦截的小概率事件,我们推荐用户通过IntentService处理消息互调,接入步骤:
|
||||
* 1. 创建IntentService并继承AliyunMessageIntentService
|
||||
* 2. 覆写相关方法,并在Manifest的注册该Service
|
||||
* 3. 调用接口CloudPushService.setPushIntentService
|
||||
* 详细用户可参考:https://help.aliyun.com/document_detail/30066.html#h2-2-messagereceiver-aliyunmessageintentservice
|
||||
*/
|
||||
|
||||
public class AliMessageIntentService extends AliyunMessageIntentService {
|
||||
private static final String TAG = AliyunMessageIntentService.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* 推送通知的回调方法
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
protected void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
|
||||
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送消息的回调方法
|
||||
*
|
||||
* @param context
|
||||
* @param cPushMessage
|
||||
*/
|
||||
@Override
|
||||
protected void onMessage(Context context, CPushMessage cPushMessage) {
|
||||
Log.i(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* 从通知栏打开通知的扩展处理
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationOpened(Context context, String title, String summary, String extraMap) {
|
||||
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
|
||||
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知删除回调
|
||||
*
|
||||
* @param context
|
||||
* @param messageId
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationRemoved(Context context, String messageId) {
|
||||
Log.i(TAG, "onNotificationRemoved : " + messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html#h3-3-4-basiccustompushnotification-api
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
* @param openType
|
||||
* @param openActivity
|
||||
* @param openUrl
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
|
||||
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package com.uiui.zyappstore.push.alipush;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.sdk.android.push.MessageReceiver;
|
||||
import com.alibaba.sdk.android.push.notification.CPushMessage;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.uiui.zyappstore.push.PushManager;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: 正纬
|
||||
* @since: 15/4/9
|
||||
* @version: 1.1
|
||||
* @feature: 用于接收推送的通知和消息
|
||||
*/
|
||||
public class AliyunMessageReceiver extends MessageReceiver {
|
||||
// 消息接收部分的LOG_TAG
|
||||
public static final String TAG = AliyunMessageReceiver.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* 推送通知的回调方法
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
public void onNotification(Context context, String title, String summary, Map<String, String> extraMap) {
|
||||
// TODO 处理推送通知
|
||||
if (null != extraMap) {
|
||||
for (Map.Entry<String, String> entry : extraMap.entrySet()) {
|
||||
Log.i(TAG, "@Get diy param : Key=" + entry.getKey() + " , Value=" + entry.getValue());
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "@收到通知 && 自定义消息为空");
|
||||
}
|
||||
Log.i(TAG, "收到一条推送通知 : " + title + ", summary:" + summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用处于前台时通知到达回调。注意:该方法仅对自定义样式通知有效,相关详情请参考https://help.aliyun.com/document_detail/30066.html?spm=5176.product30047.6.620.wjcC87#h3-3-4-basiccustompushnotification-api
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
* @param openType
|
||||
* @param openActivity
|
||||
* @param openUrl
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationReceivedInApp(Context context, String title, String summary, Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
|
||||
Log.i(TAG, "onNotificationReceivedInApp : " + " : " + title + " : " + summary + " " + extraMap + " : " + openType + " : " + openActivity + " : " + openUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送消息的回调方法
|
||||
*
|
||||
* @param context
|
||||
* @param cPushMessage
|
||||
*/
|
||||
@Override
|
||||
public void onMessage(Context context, CPushMessage cPushMessage) {
|
||||
Log.e(TAG, "收到一条推送消息 : " + cPushMessage.getTitle() + ", content:" + cPushMessage.getContent());
|
||||
String title = cPushMessage.getTitle();
|
||||
String content = cPushMessage.getContent();
|
||||
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
|
||||
String extras = "";
|
||||
if (extrasJson.get("extras") != null) {
|
||||
extras = extrasJson.get("extras").toString();
|
||||
}
|
||||
PushManager.getInstance().setPushContent(title, extras);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从通知栏打开通知的扩展处理
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationOpened(Context context, String title, String summary, String extraMap) {
|
||||
Log.i(TAG, "onNotificationOpened : " + " : " + title + " : " + summary + " : " + extraMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知删除回调
|
||||
*
|
||||
* @param context
|
||||
* @param messageId
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationRemoved(Context context, String messageId) {
|
||||
Log.i(TAG, "onNotificationRemoved : " + messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无动作通知点击回调。当在后台或阿里云控制台指定的通知动作为无逻辑跳转时,通知点击回调为onNotificationClickedWithNoAction而不是onNotificationOpened
|
||||
*
|
||||
* @param context
|
||||
* @param title
|
||||
* @param summary
|
||||
* @param extraMap
|
||||
*/
|
||||
@Override
|
||||
protected void onNotificationClickedWithNoAction(Context context, String title, String summary, String extraMap) {
|
||||
Log.i(TAG, "onNotificationClickedWithNoAction : " + " : " + title + " : " + summary + " : " + extraMap);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.uiui.zyappstore.push.tpush;
|
||||
|
||||
/**
|
||||
* Created by chacewang on 2019/7/5.
|
||||
*/
|
||||
|
||||
public class Constants {
|
||||
public static final int TEST_LOCAL_NOTIFICATION = 1;
|
||||
public static final int TEST_NOTIFICATION = 2;
|
||||
public static final int TEST_SET_TAG = 3;
|
||||
public static final int TEST_DEL_TAG = 4;
|
||||
public static final int TEST_SET_ACCOUNT = 5;
|
||||
public static final int TEST_DEL_ACCOUNT = 6;
|
||||
|
||||
public static final String LOCAL_NOTIFICATION_TITLE = "localtest";
|
||||
public static final String TEST_TAG_NAME = "DiagnosisTag";
|
||||
}
|
||||
@@ -1,313 +0,0 @@
|
||||
package com.uiui.zyappstore.push.tpush;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.tencent.android.tpush.NotificationAction;
|
||||
import com.tencent.android.tpush.XGPushBaseReceiver;
|
||||
import com.tencent.android.tpush.XGPushClickedResult;
|
||||
import com.tencent.android.tpush.XGPushRegisterResult;
|
||||
import com.tencent.android.tpush.XGPushShowedResult;
|
||||
import com.tencent.android.tpush.XGPushTextMessage;
|
||||
import com.uiui.zyappstore.push.PushManager;
|
||||
import com.uiui.zyappstore.push.tpush.common.NotificationService;
|
||||
import com.uiui.zyappstore.push.tpush.po.XGNotification;
|
||||
import com.uiui.zyappstore.utils.FileUtils;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MessageReceiver extends XGPushBaseReceiver {
|
||||
public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW";
|
||||
public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION";
|
||||
public static final String LogTag = "xg.test";
|
||||
|
||||
private static final String TAG = MessageReceiver.class.getSimpleName();
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private PackageManager mPackageManager;
|
||||
|
||||
/**
|
||||
* 消息透传处理
|
||||
*
|
||||
* @param context
|
||||
* @param message 解析自定义的 JSON
|
||||
*/
|
||||
@Override
|
||||
public void onTextMessage(Context context, XGPushTextMessage message) {
|
||||
this.mContext = context;
|
||||
this.mResolver = context.getContentResolver();
|
||||
this.mPackageManager = context.getPackageManager();
|
||||
|
||||
String text = "收到消息:" + message.toString();
|
||||
// 获取自定义key-value
|
||||
String customContent = message.getCustomContent();
|
||||
if (customContent != null && customContent.length() != 0) {
|
||||
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
|
||||
// key1为前台配置的key
|
||||
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
|
||||
String value = obj.get("key").getAsString();
|
||||
Log.d(LogTag, "get custom value:" + value);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
// APP自主处理消息的过程...
|
||||
Log.e(LogTag, text);
|
||||
show(context, text);
|
||||
processCustomMessage(context, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知展示
|
||||
*
|
||||
* @param context
|
||||
* @param notifiShowedRlt 包含通知的内容
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) {
|
||||
if (context == null || notifiShowedRlt == null) {
|
||||
return;
|
||||
}
|
||||
XGNotification notific = new XGNotification();
|
||||
notific.setMsg_id(notifiShowedRlt.getMsgId());
|
||||
notific.setTitle(notifiShowedRlt.getTitle());
|
||||
notific.setContent(notifiShowedRlt.getContent());
|
||||
// notificationActionType==1为Activity,2为url,3为intent
|
||||
notific.setNotificationActionType(notifiShowedRlt
|
||||
.getNotificationActionType());
|
||||
// Activity,url,intent都可以通过getActivity()获得
|
||||
notific.setActivity(notifiShowedRlt.getActivity());
|
||||
notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
.format(Calendar.getInstance().getTime()));
|
||||
NotificationService.getInstance(context).save(notific);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) {
|
||||
testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION);
|
||||
} else {
|
||||
testIntent.putExtra("step", Constants.TEST_NOTIFICATION);
|
||||
}
|
||||
context.sendBroadcast(testIntent);
|
||||
|
||||
Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION);
|
||||
context.sendBroadcast(viewIntent);
|
||||
show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString());
|
||||
Log.d(LogTag, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel());
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
*/
|
||||
@Override
|
||||
public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
// 在这里拿token
|
||||
String token = message.getToken();
|
||||
text = "注册成功1. token:" + token;
|
||||
} else {
|
||||
text = message + "注册失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反注册回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
*/
|
||||
@Override
|
||||
public void onUnregisterResult(Context context, int errorCode) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "反注册成功";
|
||||
} else {
|
||||
text = "反注册失败" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标签回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param tagName 设置的 TAG
|
||||
*/
|
||||
@Override
|
||||
public void onSetTagResult(Context context, int errorCode, String tagName) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "\"" + tagName + "\"设置成功";
|
||||
} else {
|
||||
text = "\"" + tagName + "\"设置失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_SET_TAG);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除标签的回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param tagName 设置的 TAG
|
||||
*/
|
||||
@Override
|
||||
public void onDeleteTagResult(Context context, int errorCode, String tagName) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (errorCode == XGPushBaseReceiver.SUCCESS) {
|
||||
text = "\"" + tagName + "\"删除成功";
|
||||
} else {
|
||||
text = "\"" + tagName + "\"删除失败,错误码:" + errorCode;
|
||||
}
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_DEL_TAG);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置账号回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param account 设置的账号
|
||||
*/
|
||||
@Override
|
||||
public void onSetAccountResult(Context context, int errorCode, String account) {
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除账号回调
|
||||
*
|
||||
* @param context
|
||||
* @param errorCode 0 为成功,其它为错误码
|
||||
* @param account 设置的账号
|
||||
*/
|
||||
@Override
|
||||
public void onDeleteAccountResult(Context context, int errorCode, String account) {
|
||||
Intent testIntent = new Intent(TEST_ACTION);
|
||||
testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT);
|
||||
context.sendBroadcast(testIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetAttributeResult(Context context, int i, String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteAttributeResult(Context context, int i, String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) {
|
||||
Log.i(LogTag, "action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击
|
||||
*
|
||||
* @param context
|
||||
* @param message 包含被点击通知的内容
|
||||
*/
|
||||
@Override
|
||||
public void onNotificationClickedResult(Context context, XGPushClickedResult message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
String text = "";
|
||||
if (message.getActionType() == NotificationAction.clicked.getType()) {
|
||||
// 通知在通知栏被点击啦。。。。。
|
||||
// APP自己处理点击的相关动作
|
||||
// 这个动作可以在activity的onResume也能监听,请看第3点相关内容
|
||||
text = "通知被打开 :" + message;
|
||||
} else if (message.getActionType() == NotificationAction.delete.getType()) {
|
||||
// 通知被清除啦。。。。
|
||||
// APP自己处理通知被清除后的相关动作
|
||||
text = "通知被清除 :" + message;
|
||||
}
|
||||
Toast.makeText(context, "广播接收到通知被点击:" + message.toString(),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
// 获取自定义key-value
|
||||
String customContent = message.getCustomContent();
|
||||
if (customContent != null && customContent.length() != 0) {
|
||||
JsonObject obj = JsonParser.parseString(customContent).getAsJsonObject();
|
||||
// key1为前台配置的key
|
||||
if (!TextUtils.isEmpty(obj.get("key").getAsString())) {
|
||||
String value = obj.get("key").getAsString();
|
||||
Log.d(LogTag, "get custom value:" + value);
|
||||
}
|
||||
// ...
|
||||
}
|
||||
// APP自主处理的过程。。。
|
||||
Log.d(LogTag, text);
|
||||
show(context, text);
|
||||
}
|
||||
|
||||
private void show(Context context, String text) {
|
||||
// Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
if (context == null || message == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String title = message.getTitle();
|
||||
String content = message.getContent();
|
||||
JsonObject extrasJson = JsonParser.parseString(content).getAsJsonObject();
|
||||
|
||||
String extras = "";
|
||||
if (extrasJson.get("extras") != null) {
|
||||
extras = extrasJson.get("extras").toString();
|
||||
}
|
||||
PushManager.getInstance().setPushContent(title, extras);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.uiui.zyappstore.push.tpush.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class DBOpenHelper extends SQLiteOpenHelper {
|
||||
|
||||
public DBOpenHelper(Context context) {
|
||||
super(context, "XGExample.db", null, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
db.execSQL("CREATE TABLE notification (id integer primary key autoincrement,msg_id varchar(64),title varchar(128),activity varchar(256),notificationActionType varchar(512),content text,update_time varchar(16))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.uiui.zyappstore.push.tpush.common;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
|
||||
import com.uiui.zyappstore.push.tpush.po.XGNotification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NotificationService {
|
||||
private DBOpenHelper dbOpenHelper;
|
||||
private static NotificationService instance = null;
|
||||
|
||||
public NotificationService(Context context) {
|
||||
this.dbOpenHelper = new DBOpenHelper(context);
|
||||
}
|
||||
|
||||
public synchronized static NotificationService getInstance(Context ctx) {
|
||||
if (null == instance) {
|
||||
instance = new NotificationService(ctx);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void save(XGNotification notification) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("msg_id", notification.getMsg_id());
|
||||
values.put("title", notification.getTitle());
|
||||
values.put("content", notification.getContent());
|
||||
values.put("activity", notification.getActivity());
|
||||
values.put("notificationActionType", notification.getNotificationActionType());
|
||||
values.put("update_time", notification.getUpdate_time());
|
||||
db.insert("notification", null, values);
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
db.delete("notification", "id=?", new String[] { id.toString() });
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
db.delete("notification", "", null);
|
||||
}
|
||||
|
||||
public void update(XGNotification notification) {
|
||||
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("msg_id", notification.getMsg_id());
|
||||
values.put("title", notification.getTitle());
|
||||
values.put("content", notification.getContent());
|
||||
values.put("activity", notification.getActivity());
|
||||
values.put("notificationActionType", notification.getNotificationActionType());
|
||||
values.put("update_time", notification.getUpdate_time());
|
||||
db.update("notification", values, "id=?", new String[] { notification
|
||||
.getId().toString() });
|
||||
}
|
||||
|
||||
public XGNotification find(Integer id) {
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
"id=?", new String[] { id.toString() }, null, null,
|
||||
null, "1");
|
||||
try {
|
||||
if (cursor.moveToFirst()) {
|
||||
return new XGNotification(cursor.getInt(cursor
|
||||
.getColumnIndex("id")), cursor.getLong(cursor
|
||||
.getColumnIndex("msg_id")), cursor.getString(cursor
|
||||
.getColumnIndex("title")), cursor.getString(cursor
|
||||
.getColumnIndex("content")), cursor.getString(cursor
|
||||
.getColumnIndex("activity")), cursor.getInt(cursor
|
||||
.getColumnIndex("notificationActionType")), cursor.getString(cursor
|
||||
.getColumnIndex("update_time")));
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public List<XGNotification> getScrollData(int currentPage, int lineSize,
|
||||
String msg_id) {
|
||||
String firstResult = String.valueOf((currentPage - 1) * lineSize);
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
if (msg_id == null || "".equals(msg_id)) {
|
||||
cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
null, null, null, null, "update_time DESC",
|
||||
firstResult + "," + lineSize);
|
||||
} else {
|
||||
cursor = db
|
||||
.query("notification",
|
||||
new String[] { "id,msg_id,title,content,activity,notificationActionType,update_time" },
|
||||
"msg_id like ?", new String[] { msg_id + "%" },
|
||||
null, null, "update_time DESC", firstResult
|
||||
+ "," + lineSize);
|
||||
}
|
||||
List<XGNotification> notifications = new ArrayList<XGNotification>();
|
||||
while (cursor.moveToNext()) {
|
||||
notifications.add(new XGNotification(cursor.getInt(cursor
|
||||
.getColumnIndex("id")), cursor.getLong(cursor
|
||||
.getColumnIndex("msg_id")), cursor.getString(cursor
|
||||
.getColumnIndex("title")), cursor.getString(cursor
|
||||
.getColumnIndex("content")), cursor.getString(cursor
|
||||
.getColumnIndex("activity")), cursor.getInt(cursor
|
||||
.getColumnIndex("notificationActionType")), cursor.getString(cursor
|
||||
.getColumnIndex("update_time"))));
|
||||
}
|
||||
return notifications;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
SQLiteDatabase db = dbOpenHelper.getReadableDatabase();
|
||||
Cursor cursor = db.rawQuery("select count(*) from notification", null);
|
||||
try {
|
||||
cursor.moveToFirst();
|
||||
return cursor.getInt(0);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.uiui.zyappstore.push.tpush.po;
|
||||
|
||||
public class XGNotification {
|
||||
private Integer id;
|
||||
private Long msg_id;
|
||||
private String title;
|
||||
private String content;
|
||||
private String activity;
|
||||
private int notificationActionType;
|
||||
private String update_time;
|
||||
|
||||
public XGNotification() {
|
||||
|
||||
}
|
||||
|
||||
public XGNotification(Integer id, Long msg_id, String title,
|
||||
String content, String activity, int notificationActionType, String update_time) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.msg_id = msg_id;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.activity = activity;
|
||||
this.notificationActionType = notificationActionType;
|
||||
this.update_time = update_time;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getMsg_id() {
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
public void setMsg_id(Long msg_id) {
|
||||
this.msg_id = msg_id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getUpdate_time() {
|
||||
return update_time;
|
||||
}
|
||||
|
||||
public void setUpdate_time(String update_time) {
|
||||
this.update_time = update_time;
|
||||
}
|
||||
|
||||
public String getActivity() {
|
||||
return activity;
|
||||
}
|
||||
|
||||
public void setActivity(String activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public int getNotificationActionType() {
|
||||
return notificationActionType;
|
||||
}
|
||||
|
||||
public void setNotificationActionType(int notificationActionType) {
|
||||
this.notificationActionType = notificationActionType;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiui.zyappstore.service.GuardService;
|
||||
import com.uiui.zyappstore.service.main.MainService;
|
||||
import com.uiui.zyappstore.service.StepService;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
@@ -23,11 +19,8 @@ public class BootReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
case Intent.ACTION_BOOT_COMPLETED:
|
||||
case BOOT_COMPLETED:
|
||||
context.startService(new Intent(context, MainService.class));
|
||||
context.startService(new Intent(context, StepService.class));
|
||||
context.startService(new Intent(context, GuardService.class));
|
||||
LogUtils.e("StoreBootReceiver", "booting BootReceiver");
|
||||
JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||
// JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
|
||||
|
||||
public class InstallResultReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "InstallResultReceiver";
|
||||
|
||||
@@ -22,7 +21,6 @@ public class InstallResultReceiver extends BroadcastReceiver {
|
||||
// an Intent broadcast.
|
||||
//throw new UnsupportedOperationException("Not yet implemented");
|
||||
|
||||
|
||||
if (intent != null) {
|
||||
final int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS,
|
||||
PackageInstaller.STATUS_FAILURE);
|
||||
@@ -43,16 +41,17 @@ public class InstallResultReceiver extends BroadcastReceiver {
|
||||
// while (iterator.hasNext()) {
|
||||
// Log.d("KEY", iterator.next());
|
||||
// }
|
||||
String STATUS = intent.getStringExtra(PackageInstaller.EXTRA_STATUS);
|
||||
// String STATUS = intent.getStringExtra(PackageInstaller.EXTRA_STATUS);
|
||||
String PACKAGE_NAME = intent.getStringExtra(PackageInstaller.EXTRA_PACKAGE_NAME);
|
||||
String SESSION_ID = intent.getStringExtra(PackageInstaller.EXTRA_SESSION_ID);
|
||||
// String SESSION_ID = intent.getStringExtra(PackageInstaller.EXTRA_SESSION_ID);
|
||||
String STATUS_MESSAGE = intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE);
|
||||
String LEGACY_STATUS = intent.getStringExtra("android.content.pm.extra.LEGACY_STATUS");
|
||||
// String LEGACY_STATUS = intent.getStringExtra("android.content.pm.extra.LEGACY_STATUS");
|
||||
// Log.e("fht", STATUS);
|
||||
// Log.e("fht", PACKAGE_NAME);
|
||||
// Log.e("fht", SESSION_ID);
|
||||
// Log.e("fht", LEGACY_STATUS);
|
||||
// Log.e("fht", STATUS_MESSAGE);
|
||||
Log.e(TAG, "onReceive: " + STATUS_MESSAGE);
|
||||
if (STATUS_MESSAGE != null && STATUS_MESSAGE.equals("INSTALL_SUCCEEDED")) {
|
||||
ToastUtil.show(PACKAGE_NAME + "安装成功");
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.uiui.zyappstore.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
// 下载管理服务
|
||||
public class DownloadService extends Service {
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
flags = START_STICKY;
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
startService(new Intent(this, StepService.class));
|
||||
startService(new Intent(this, GuardService.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId) {
|
||||
super.onStart(intent, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
package com.uiui.zyappstore.service;
|
||||
|
||||
/**
|
||||
* 作者 mjsheng
|
||||
* 日期 2019/4/1 10:58
|
||||
* 邮箱 501802639@qq.com
|
||||
* 来自:
|
||||
*/
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.uiui.zyappstore.KeepAliveConnection;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.receiver.NewAppReceiver;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
import com.uiui.zyappstore.utils.SPUtils;
|
||||
import com.uiui.zyappstore.utils.ServiceAliveUtils;
|
||||
import com.uiui.zyappstore.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
* 守护进程 双进程通讯
|
||||
*
|
||||
* @author LiGuangMin
|
||||
* @time Created by 2018/8/17 11:27
|
||||
*/
|
||||
public class GuardService extends Service {
|
||||
private final static String TAG = GuardService.class.getSimpleName();
|
||||
private ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
LogUtils.e(TAG, "GuardService:建立链接");
|
||||
boolean isServiceRunning = ServiceAliveUtils.isServiceAlice(GuardService.this);
|
||||
if (!isServiceRunning) {
|
||||
Intent i = new Intent(GuardService.this, DownloadService.class);
|
||||
startService(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
// 断开链接
|
||||
startService(new Intent(GuardService.this, StepService.class));
|
||||
// 重新绑定
|
||||
bindService(new Intent(GuardService.this, StepService.class), mServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new KeepAliveConnection.Stub() {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
registerNewAppReceiver();
|
||||
}
|
||||
|
||||
private NewAppReceiver mNewAppReceiver;
|
||||
|
||||
private void registerNewAppReceiver() {
|
||||
if (mNewAppReceiver == null) {
|
||||
mNewAppReceiver = new NewAppReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||
filter.addDataScheme("package");
|
||||
registerReceiver(mNewAppReceiver, filter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mNewAppReceiver != null) {
|
||||
unregisterReceiver(mNewAppReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Aria.init(this);
|
||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||
Aria.download(this).register();
|
||||
bindService(new Intent(this, StepService.class), mServiceConnection, Context.BIND_IMPORTANT);
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
|
||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||
@Download.onTaskRunning
|
||||
protected void running(DownloadTask task) {
|
||||
LogUtils.e("mjsheng", "我在下载=--------------::" + task.getState() + "-------" + task.getPercent() + "-------" + task.getExtendField());
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
//在这里处理任务完成的状态
|
||||
final String downloadPath = task.getFilePath();
|
||||
if (null != task.getExtendField()) {
|
||||
JsonObject jsonObject = JsonParser.parseString(task.getExtendField()).getAsJsonObject();
|
||||
String packageName = jsonObject.get("app_package").getAsString();
|
||||
File file = new File(downloadPath);
|
||||
int admin_id = (int) SPUtils.get(GuardService.this, "admin_id", -1);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDownloadAppControl()
|
||||
.sendDownloadApp(packageName, file.length(), Utils.getSerial(), admin_id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
String msg = baseResponse.msg;
|
||||
Log.e("taskComplete", "onNext: " + "code" + code + ",msg:" + msg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("taskComplete", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
new Thread(() -> ApkUtils.installApp(GuardService.this, downloadPath)).start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.uiui.zyappstore.service;
|
||||
|
||||
/**
|
||||
* 作者 mjsheng
|
||||
* 日期 2019/4/1 10:57
|
||||
* 邮箱 501802639@qq.com
|
||||
* 来自:
|
||||
*/
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.uiui.zyappstore.KeepAliveConnection;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
import com.uiui.zyappstore.utils.ServiceAliveUtils;
|
||||
|
||||
/**
|
||||
* 主进程 双进程通讯
|
||||
*
|
||||
* @author LiGuangMin
|
||||
* @time Created by 2018/8/17 11:26
|
||||
*/
|
||||
public class StepService extends Service {
|
||||
|
||||
private final static String TAG = StepService.class.getSimpleName();
|
||||
private ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
||||
LogUtils.e(TAG, "StepService:建立链接");
|
||||
boolean isServiceRunning = ServiceAliveUtils.isServiceAlice(StepService.this);
|
||||
if (!isServiceRunning) {
|
||||
Intent i = new Intent(StepService.this, DownloadService.class);
|
||||
startService(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName componentName) {
|
||||
// 断开链接
|
||||
startService(new Intent(StepService.this, GuardService.class));
|
||||
// 重新绑定
|
||||
bindService(new Intent(StepService.this, GuardService.class), mServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return new KeepAliveConnection.Stub() {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
// startForeground(1, new Notification());
|
||||
// 绑定建立链接
|
||||
bindService(new Intent(this, GuardService.class), mServiceConnection, Context.BIND_IMPORTANT);
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,21 +5,36 @@ import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
import com.uiui.zyappstore.KeepAliveConnection;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.network.HTTPInterface;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.LogUtils;
|
||||
import com.uiui.zyappstore.utils.SPUtils;
|
||||
import com.uiui.zyappstore.utils.Utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class MainService extends Service implements MainSContact.MainView, NetworkUtils.OnNetworkStatusChangedListener, LifecycleProvider<ActivityEvent> {
|
||||
@@ -32,13 +47,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
Log.e(TAG, "网络未连接");
|
||||
// ToastUtil.show("网络未连接");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnected(NetworkUtils.NetworkType networkType) {
|
||||
Log.e(TAG, "网络已连接");
|
||||
// ToastUtil.show("网络已连接");
|
||||
if (JGYUtils.getInstance().isScreenOn()) {
|
||||
HTTPInterface.checkUpdate(MainService.this);
|
||||
HTTPInterface.checkUpdate(MainService.this, "com.uiui.sn");
|
||||
@@ -64,25 +77,27 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
return RxLifecycleAndroid.bindActivity(lifecycleSubject);
|
||||
}
|
||||
|
||||
public MainService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
// TODO: Return the communication channel to the service.
|
||||
// throw new UnsupportedOperationException("Not yet implemented");
|
||||
return new KeepAliveConnection.Stub() {
|
||||
};
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
Aria.download(this).register();
|
||||
// return START_STICKY;
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Log.e(TAG, "onCreate: ");
|
||||
|
||||
Aria.download(this).register();
|
||||
|
||||
HTTPInterface.checkUpdate(MainService.this);
|
||||
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
mPresenter = new MainSPresenter(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
@@ -110,4 +125,67 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
public void setSnTag() {
|
||||
|
||||
}
|
||||
|
||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||
@Download.onTaskRunning
|
||||
void running(DownloadTask task) {
|
||||
LogUtils.e(TAG, "running: " + "getState = " + task.getState() + "getPercent = " + task.getPercent() + "getExtendField = " + task.getExtendField());
|
||||
}
|
||||
|
||||
@Download.onTaskComplete
|
||||
void taskComplete(DownloadTask task) {
|
||||
Log.e(TAG, "taskComplete: " );
|
||||
//在这里处理任务完成的状态
|
||||
final String downloadPath = task.getFilePath();
|
||||
if (null != task.getExtendField()) {
|
||||
JsonObject jsonObject = JsonParser.parseString(task.getExtendField()).getAsJsonObject();
|
||||
String packageName = jsonObject.get("app_package").getAsString();
|
||||
File file = new File(downloadPath);
|
||||
int admin_id = (int) SPUtils.get(MainService.this, "admin_id", -1);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getDownloadAppControl()
|
||||
.sendDownloadApp(packageName, file.length(), Utils.getSerial(), admin_id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
String msg = baseResponse.msg;
|
||||
Log.e("taskComplete", "onNext: " + "code" + code + ",msg:" + msg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("taskComplete", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
ApkUtils.installApp(MainService.this, task.getFilePath());
|
||||
}
|
||||
|
||||
@Download.onTaskFail
|
||||
void taskFail(DownloadTask task, Exception e) {
|
||||
Log.e(TAG, "taskFail: ");
|
||||
Aria.download(this).resumeAllTask();
|
||||
try {
|
||||
final String filepath = task.getFilePath();
|
||||
final String packageName = task.getExtendField();
|
||||
Log.e(TAG, "taskFail: " + packageName + " filepath: " + filepath);
|
||||
Aria.download(this).load(task.getDownloadEntity().getId()).cancel(true);
|
||||
} catch (Exception ex) {
|
||||
Log.e(TAG, "taskFail: " + "Exception: " + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.google.gson.JsonObject;
|
||||
import com.uiui.zyappstore.BuildConfig;
|
||||
import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.bean.LocalApp;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.gson.GsonUtils;
|
||||
import com.uiui.zyappstore.receiver.InstallResultReceiver;
|
||||
|
||||
@@ -89,7 +90,7 @@ public class ApkUtils {
|
||||
}
|
||||
|
||||
public static void openApp(Context context, String packageName) {
|
||||
int setting_other_appInstaller = Settings.Global.getInt(context.getContentResolver(), "setting_other_appInstaller", 0);
|
||||
int setting_other_appInstaller = Settings.Global.getInt(context.getContentResolver(), CommonConfig.APP_INSTALLATION, 0);
|
||||
Log.e(TAG, "openApp: " + setting_other_appInstaller);
|
||||
if (setting_other_appInstaller == 0) {
|
||||
ToastUtil.show("已禁止应用打开");
|
||||
@@ -390,7 +391,6 @@ public class ApkUtils {
|
||||
ToastUtil.show("正在安装应用");
|
||||
install(packageInstaller, sessionId, context);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public class JGYUtils {
|
||||
public static final int ipaly50SEPlatform = 10;
|
||||
public static final int iPlayMiniPlatform = 13;
|
||||
public static final int iPlay5013Platform = 14;
|
||||
public static final int iPlay50miniProPlatform = 16;
|
||||
public static final int UnknowPlatform = 0;
|
||||
|
||||
public static final String MTKTag = "MTK";
|
||||
@@ -73,6 +74,7 @@ public class JGYUtils {
|
||||
public static final String ipaly50SETag = "ipaly50SE";
|
||||
public static final String iPlayMiniTag = "T811";
|
||||
public static final String iPlay5013Tag = "iplay5013";
|
||||
public static final String iPlay50miniProTag = "miniG99";
|
||||
|
||||
|
||||
private JGYUtils(Context context) {
|
||||
@@ -352,7 +354,10 @@ public class JGYUtils {
|
||||
} else if (iPlay5013Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "ipaly50 13");
|
||||
return iPlay5013Platform;
|
||||
} else {
|
||||
}else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "miniG99");
|
||||
return iPlay50miniProPlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
@@ -394,6 +399,8 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(iPlayMiniPlatform);
|
||||
} else if (iPlay5013Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay5013Platform);
|
||||
} else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay50miniProPlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.util.Base64;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
||||
import com.uiui.zyappstore.common.CommonDatas;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -103,7 +103,7 @@ public class SPUtils {
|
||||
|
||||
//还原状态firstEnter信息
|
||||
private static void reductFirstEnter(Context context){
|
||||
put(context, CommonDatas.FLAG_FIRST_ENTER,CommonDatas.FLAG_FIRST_ENTER);
|
||||
put(context, CommonConfig.FLAG_FIRST_ENTER, CommonConfig.FLAG_FIRST_ENTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
@@ -34,9 +33,8 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -57,8 +55,6 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private static final String TAG = Utils.class.getSimpleName();
|
||||
@@ -804,4 +800,10 @@ public class Utils {
|
||||
return Settings.System.putString(context.getContentResolver(), "aole_app_forbid", String.join(",", hashSet));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canDownloadApp(Context context) {
|
||||
int app = Settings.Global.getInt(context.getContentResolver(), CommonConfig.APP_STORE_INSTALL, 1);
|
||||
Log.e(TAG, "canDownloadApp: " + app);
|
||||
return app == 1;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "com.tencent.android.tpns:tpnsplugin:1.8.0"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Reference in New Issue
Block a user