version:1.4

fix:
add:没有应用不显示提示页
This commit is contained in:
2022-01-25 16:19:00 +08:00
parent a6e3aa58e0
commit 9a3222a2ba
8 changed files with 99 additions and 46 deletions

View File

@@ -39,8 +39,8 @@ android {
productFlavors {
beta {
flavorDimensions "default"
versionCode 4
versionName "1.3"
versionCode 5
versionName "1.4"
manifestPlaceholders = [
JPUSH_PKGNAME: "com.uiui.appstore",
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.

View File

@@ -54,7 +54,7 @@ public class HintActivity extends BaseActivity {
bt_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ApkUtils.openApp(HintActivity.this, "com.uiui.sn");
// ApkUtils.openApp(HintActivity.this, "com.uiui.sn");
finish();
}
});

View File

@@ -96,7 +96,6 @@ public class MainActivity extends BaseActivity {
// PackageManager pm = getPackageManager();
// pm.setApplicationEnabledSetting("com.tencent.qqmusic", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
startService(new Intent(MainActivity.this, MyDownloadService.class));
CheckUpdateBySNinfo();
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。如果已经初始化但没有登录成功则执行重新登录。
private void init() {
JPushInterface.init(getApplicationContext());
@@ -431,7 +414,7 @@ public class MainActivity extends BaseActivity {
}
//没有绑定
else if (code == 300) {
// SPUtils.put(MainActivity.this, "isLogined", 0);
SPUtils.put(MainActivity.this, "isLogined", 0);
// Intent intent = new Intent();
// intent.putExtra("text", getResources().getString(R.string.no_bind));
// intent.setClass(MainActivity.this, HintActivity.class);

View File

@@ -436,13 +436,6 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
mRvResult.setVisibility(View.GONE);
iv_nodata.setImageDrawable(getActivity().getDrawable(R.drawable.app_nodata));
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();
}
}
}

View File

@@ -1,7 +1,6 @@
package com.uiui.appstore.receiver;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
@@ -9,6 +8,7 @@ import android.util.Log;
import com.uiui.appstore.service.GuardService;
import com.uiui.appstore.service.InitJpushServer;
import com.uiui.appstore.service.StepService;
import com.uiui.appstore.utils.JGYUtils;
import com.uiui.appstore.utils.LogUtils;
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, GuardService.class));
LogUtils.e("StoreBootReceiver", "booting BootReceiver");
//启动设备信息
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.receiver.BootReceiver"));
context.sendBroadcast(bootIntent);
JGYUtils.getInstance().wakeUpDeviceInfo();
break;
}
}

View File

@@ -8,6 +8,8 @@ import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import com.uiui.appstore.utils.JGYUtils;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
@@ -52,15 +54,9 @@ public class NewAppReceiver extends BroadcastReceiver {
}
Log.e(TAG, "sendAppInfo: " + state + packageName);
if ("com.uiui.sn".equals(packageName)) {
//启动设备信息
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.receiver.BootReceiver"));
context.sendBroadcast(bootIntent);
JGYUtils.getInstance().wakeUpDeviceInfo();
} else if ("com.uiuios.updatetools".equals(packageName)) {
//启动升级组件
Intent bootIntent = new Intent(BootReceiver.BOOT_COMPLETED);
bootIntent.setComponent(new ComponentName("com.uiuios.updatetools", "com.uiuios.updatetools.receiver.BootReceiver"));
context.sendBroadcast(bootIntent);
JGYUtils.getInstance().wakeUpUpdateTools();
}
newAppListener.setNewAppListener(packageName);
}

View File

@@ -3,12 +3,22 @@ package com.uiui.appstore.service;
import android.app.Service;
import android.content.Intent;
import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import com.uiui.appstore.KeepAliveConnection;
import com.uiui.appstore.network.HTTPInterface;
import com.uiui.appstore.utils.SPUtils;
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 InitJpushServer() {
@@ -24,14 +34,16 @@ public class InitJpushServer extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
HTTPInterface.checkUpdate(InitJpushServer.this);
HTTPInterface.checkUpdate(InitJpushServer.this, "com.uiui.sn");
start.onstar(System.currentTimeMillis());
return START_STICKY;
}
@Override
public void onCreate() {
super.onCreate();
Observable.create(subscribe)
.throttleFirst(3, TimeUnit.HOURS)
.subscribe(timeObserver);
File file = new File(DOWNLOAD_PATH);
if (file.isFile() || !file.exists()) {
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";
}

View File

@@ -1,6 +1,7 @@
package com.uiui.appstore.utils;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
@@ -16,6 +17,7 @@ import android.text.TextUtils;
import android.util.Log;
import com.uiui.appstore.BuildConfig;
import com.uiui.appstore.receiver.BootReceiver;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -70,7 +72,6 @@ public class JGYUtils {
}
private int getBatteryLevel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BatteryManager batteryManager = (BatteryManager) mContext.getSystemService(Context.BATTERY_SERVICE);
@@ -157,8 +158,6 @@ public class JGYUtils {
}
private static void sendAllweb(Context context) {
Intent intent = new Intent("qch_app_website")
.setPackage("com.android.settings");
@@ -317,4 +316,32 @@ public class JGYUtils {
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);
}
}