version:1.4
fix: add:没有应用不显示提示页
This commit is contained in:
@@ -39,8 +39,8 @@ android {
|
|||||||
productFlavors {
|
productFlavors {
|
||||||
beta {
|
beta {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 4
|
versionCode 5
|
||||||
versionName "1.3"
|
versionName "1.4"
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: "com.uiui.appstore",
|
JPUSH_PKGNAME: "com.uiui.appstore",
|
||||||
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.
|
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class HintActivity extends BaseActivity {
|
|||||||
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ApkUtils.openApp(HintActivity.this, "com.uiui.sn");
|
// ApkUtils.openApp(HintActivity.this, "com.uiui.sn");
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ public class MainActivity extends BaseActivity {
|
|||||||
// PackageManager pm = getPackageManager();
|
// PackageManager pm = getPackageManager();
|
||||||
// pm.setApplicationEnabledSetting("com.tencent.qqmusic", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
// pm.setApplicationEnabledSetting("com.tencent.qqmusic", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
|
||||||
startService(new Intent(MainActivity.this, MyDownloadService.class));
|
startService(new Intent(MainActivity.this, MyDownloadService.class));
|
||||||
CheckUpdateBySNinfo();
|
|
||||||
starService();
|
starService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,22 +196,6 @@ public class MainActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void CheckUpdateBySNinfo() {
|
|
||||||
//检测设备信息的更新
|
|
||||||
PackageManager pm = getPackageManager();
|
|
||||||
PackageInfo packageInfo = null;
|
|
||||||
try {
|
|
||||||
packageInfo = pm.getPackageInfo("com.uiui.sn", 0);
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (null != packageInfo) {
|
|
||||||
// OKGO.checkUpdateByPackage(handler, packageInfo.packageName, String.valueOf(packageInfo.versionCode));
|
|
||||||
} else {
|
|
||||||
// OKGO.checkUpdateByPackage(handler, "com.uiui.sn", "0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化 JPush。如果已经初始化,但没有登录成功,则执行重新登录。
|
// 初始化 JPush。如果已经初始化,但没有登录成功,则执行重新登录。
|
||||||
private void init() {
|
private void init() {
|
||||||
JPushInterface.init(getApplicationContext());
|
JPushInterface.init(getApplicationContext());
|
||||||
@@ -431,7 +414,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
//没有绑定
|
//没有绑定
|
||||||
else if (code == 300) {
|
else if (code == 300) {
|
||||||
// SPUtils.put(MainActivity.this, "isLogined", 0);
|
SPUtils.put(MainActivity.this, "isLogined", 0);
|
||||||
// Intent intent = new Intent();
|
// Intent intent = new Intent();
|
||||||
// intent.putExtra("text", getResources().getString(R.string.no_bind));
|
// intent.putExtra("text", getResources().getString(R.string.no_bind));
|
||||||
// intent.setClass(MainActivity.this, HintActivity.class);
|
// intent.setClass(MainActivity.this, HintActivity.class);
|
||||||
|
|||||||
@@ -436,13 +436,6 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
|||||||
mRvResult.setVisibility(View.GONE);
|
mRvResult.setVisibility(View.GONE);
|
||||||
iv_nodata.setImageDrawable(getActivity().getDrawable(R.drawable.app_nodata));
|
iv_nodata.setImageDrawable(getActivity().getDrawable(R.drawable.app_nodata));
|
||||||
iv_nodata.setVisibility(View.VISIBLE);
|
iv_nodata.setVisibility(View.VISIBLE);
|
||||||
if (!BuildConfig.DEBUG) {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
// intent.putExtra("text", getResources().getString(R.string.no_app));
|
|
||||||
intent.setClass(getActivity(), HintActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
getActivity().finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.uiui.appstore.receiver;
|
package com.uiui.appstore.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -9,6 +8,7 @@ import android.util.Log;
|
|||||||
import com.uiui.appstore.service.GuardService;
|
import com.uiui.appstore.service.GuardService;
|
||||||
import com.uiui.appstore.service.InitJpushServer;
|
import com.uiui.appstore.service.InitJpushServer;
|
||||||
import com.uiui.appstore.service.StepService;
|
import com.uiui.appstore.service.StepService;
|
||||||
|
import com.uiui.appstore.utils.JGYUtils;
|
||||||
import com.uiui.appstore.utils.LogUtils;
|
import com.uiui.appstore.utils.LogUtils;
|
||||||
|
|
||||||
public class BootReceiver extends BroadcastReceiver {
|
public class BootReceiver extends BroadcastReceiver {
|
||||||
@@ -27,10 +27,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||||||
context.startService(new Intent(context, StepService.class));
|
context.startService(new Intent(context, StepService.class));
|
||||||
context.startService(new Intent(context, GuardService.class));
|
context.startService(new Intent(context, GuardService.class));
|
||||||
LogUtils.e("StoreBootReceiver", "booting BootReceiver");
|
LogUtils.e("StoreBootReceiver", "booting BootReceiver");
|
||||||
//启动设备信息
|
JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||||
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
|
||||||
bootIntent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.receiver.BootReceiver"));
|
|
||||||
context.sendBroadcast(bootIntent);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import android.content.Intent;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.uiui.appstore.utils.JGYUtils;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
@@ -52,15 +54,9 @@ public class NewAppReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
Log.e(TAG, "sendAppInfo: " + state + packageName);
|
Log.e(TAG, "sendAppInfo: " + state + packageName);
|
||||||
if ("com.uiui.sn".equals(packageName)) {
|
if ("com.uiui.sn".equals(packageName)) {
|
||||||
//启动设备信息
|
JGYUtils.getInstance().wakeUpDeviceInfo();
|
||||||
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
|
||||||
bootIntent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.receiver.BootReceiver"));
|
|
||||||
context.sendBroadcast(bootIntent);
|
|
||||||
} else if ("com.uiuios.updatetools".equals(packageName)) {
|
} else if ("com.uiuios.updatetools".equals(packageName)) {
|
||||||
//启动升级组件
|
JGYUtils.getInstance().wakeUpUpdateTools();
|
||||||
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
|
||||||
bootIntent.setComponent(new ComponentName("com.uiuios.updatetools", "com.uiuios.updatetools.receiver.BootReceiver"));
|
|
||||||
context.sendBroadcast(bootIntent);
|
|
||||||
}
|
}
|
||||||
newAppListener.setNewAppListener(packageName);
|
newAppListener.setNewAppListener(packageName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,22 @@ package com.uiui.appstore.service;
|
|||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.uiui.appstore.KeepAliveConnection;
|
import com.uiui.appstore.KeepAliveConnection;
|
||||||
import com.uiui.appstore.network.HTTPInterface;
|
import com.uiui.appstore.network.HTTPInterface;
|
||||||
|
import com.uiui.appstore.utils.SPUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
public class InitJpushServer extends Service {
|
public class InitJpushServer extends Service {
|
||||||
public InitJpushServer() {
|
public InitJpushServer() {
|
||||||
@@ -24,14 +34,16 @@ public class InitJpushServer extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
HTTPInterface.checkUpdate(InitJpushServer.this);
|
start.onstar(System.currentTimeMillis());
|
||||||
HTTPInterface.checkUpdate(InitJpushServer.this, "com.uiui.sn");
|
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
Observable.create(subscribe)
|
||||||
|
.throttleFirst(3, TimeUnit.HOURS)
|
||||||
|
.subscribe(timeObserver);
|
||||||
File file = new File(DOWNLOAD_PATH);
|
File file = new File(DOWNLOAD_PATH);
|
||||||
if (file.isFile() || !file.exists()) {
|
if (file.isFile() || !file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
@@ -39,5 +51,50 @@ public class InitJpushServer extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private interface Start {
|
||||||
|
void onstar(long time);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Start start;
|
||||||
|
|
||||||
|
private final ObservableOnSubscribe<Long> subscribe = new ObservableOnSubscribe<Long>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter emitter) throws Exception {
|
||||||
|
start = new Start() {
|
||||||
|
@Override
|
||||||
|
public void onstar(long time) {
|
||||||
|
emitter.onNext(time);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Observer<Long> timeObserver = new Observer<Long>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(Long aLong) {
|
||||||
|
Log.e("TimeObserver", "onNext: " + aLong);
|
||||||
|
int isLogined = (int) SPUtils.get(InitJpushServer.this, "isLogined", 2);
|
||||||
|
if (isLogined == 2) return;
|
||||||
|
HTTPInterface.checkUpdate(InitJpushServer.this);
|
||||||
|
HTTPInterface.checkUpdate(InitJpushServer.this, "com.uiui.sn");
|
||||||
|
// HTTPInterface.checkUpdate(InitJpushServer.this, "com.uiui.os");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final String DOWNLOAD_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + File.separator + "jgy";
|
private final String DOWNLOAD_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + File.separator + "jgy";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.uiui.appstore.utils;
|
package com.uiui.appstore.utils;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.ContextWrapper;
|
import android.content.ContextWrapper;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -16,6 +17,7 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.uiui.appstore.BuildConfig;
|
import com.uiui.appstore.BuildConfig;
|
||||||
|
import com.uiui.appstore.receiver.BootReceiver;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -70,7 +72,6 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int getBatteryLevel() {
|
private int getBatteryLevel() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
|
||||||
@@ -157,8 +158,6 @@ public class JGYUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void sendAllweb(Context context) {
|
private static void sendAllweb(Context context) {
|
||||||
Intent intent = new Intent("qch_app_website")
|
Intent intent = new Intent("qch_app_website")
|
||||||
.setPackage("com.android.settings");
|
.setPackage("com.android.settings");
|
||||||
@@ -317,4 +316,32 @@ public class JGYUtils {
|
|||||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PACKAGE_DEVICEINFO = "com.uiui.sn";
|
||||||
|
public static final String PACKAGE_APPSTORE = "com.uiui.appstore";
|
||||||
|
public static final String PACKAGE_UPDATETOOLS = "com.uiui.updatetools";
|
||||||
|
public static final String CLASS_DEVICEINFO = "com.uiui.sn.receiver.BootReceiver";
|
||||||
|
public static final String CLASS_APPSTORE = "com.uiui.appstore.receiver.BootReceiver";
|
||||||
|
public static final String CLASS_UPDATETOOLS = "com.uiui.updatetools.receiver.BootReceiver";
|
||||||
|
|
||||||
|
public void wakeUpDeviceInfo() {
|
||||||
|
//启动设备信息
|
||||||
|
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
||||||
|
bootIntent.setComponent(new ComponentName(PACKAGE_DEVICEINFO, CLASS_DEVICEINFO));
|
||||||
|
mContext.sendBroadcast(bootIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wakeUpAppstore() {
|
||||||
|
//启动应用市场
|
||||||
|
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
||||||
|
bootIntent.setComponent(new ComponentName(PACKAGE_APPSTORE, CLASS_APPSTORE));
|
||||||
|
mContext.sendBroadcast(bootIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wakeUpUpdateTools() {
|
||||||
|
//启动升级组件
|
||||||
|
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
|
||||||
|
bootIntent.setComponent(new ComponentName(PACKAGE_UPDATETOOLS, CLASS_UPDATETOOLS));
|
||||||
|
mContext.sendBroadcast(bootIntent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user