Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
505c68fb6b | |||
053d819d27 |
@ -44,7 +44,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.EACCES" />
|
<uses-permission android:name="android.permission.EACCES" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.nfc"
|
android:name="android.hardware.nfc"
|
||||||
android:required="true" />
|
android:required="true" />
|
||||||
|
@ -9,28 +9,41 @@ import android.content.IntentFilter;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.os.Environment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
|
||||||
import com.alct.mdp.MDPLocationCollectionManager;
|
import com.alct.mdp.MDPLocationCollectionManager;
|
||||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||||
import com.arpa.hndahesudintocctmsdriver.request.net.Api;
|
import com.arpa.hndahesudintocctmsdriver.request.net.Api;
|
||||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.BillLocationUtils;
|
import com.arpa.hndahesudintocctmsdriver.util.BillLocationUtils;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.SPUtils;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.location.LocationGDUtil;
|
||||||
import com.dahe.mylibrary.CommonBaseLibrary;
|
import com.dahe.mylibrary.CommonBaseLibrary;
|
||||||
|
import com.dahe.mylibrary.utils.TimeUtil;
|
||||||
import com.dahe.mylibrary.utils.ToastUtils;
|
import com.dahe.mylibrary.utils.ToastUtils;
|
||||||
import com.esign.esignsdk.EsignSdk;
|
import com.esign.esignsdk.EsignSdk;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||||
import com.gyf.cactus.Cactus;
|
import com.gyf.cactus.Cactus;
|
||||||
import com.gyf.cactus.callback.CactusBackgroundCallback;
|
import com.gyf.cactus.callback.CactusBackgroundCallback;
|
||||||
import com.gyf.cactus.callback.CactusCallback;
|
import com.gyf.cactus.callback.CactusCallback;
|
||||||
|
import com.permissionx.guolindev.PermissionX;
|
||||||
import com.tencent.bugly.crashreport.CrashReport;
|
import com.tencent.bugly.crashreport.CrashReport;
|
||||||
import com.umeng.commonsdk.UMConfigure;
|
import com.umeng.commonsdk.UMConfigure;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import cn.jiguang.verifysdk.api.JVerificationInterface;
|
import cn.jiguang.verifysdk.api.JVerificationInterface;
|
||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application implements CactusCallback {
|
||||||
|
|
||||||
// String key = "f9d35b1133cff1f6e3960c89b249e03f";
|
// String key = "f9d35b1133cff1f6e3960c89b249e03f";
|
||||||
String key = "19ac0aa74338e487e45057faf7212401";
|
String key = "19ac0aa74338e487e45057faf7212401";
|
||||||
String license = "HF41uGxM/1i3CtW98DimoA97BlNTAnQ+DiEAihYmZ2jR1jqC4be253joEJbOJgFDIzp5aIoeuXSWWHFaDVfaHL2Pks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Zf4nhKzTeXGIjCTFO4TNVucrlGU7tyJcrRCDVdfV24fziH+hB3QGckpuYzzjefr7hZalLRJ/w8dPw/8dCY1wnWq3AJ3zw2g1PzMxl51q7AgdKvwc1ERcGBns0zb8PK6vGKCnJq3uHiJEnslbTI0MEosje+h+OPO7hf2QofErewjI19wHEOv4dTvuFLh3VmGFMObAmov5kI47705fjSxCvAPGATBrfUSwim+5EQ1hanc5IcXe0/nOTiRUNEpZ+x65zVydqAs7490yqQiIUQvPazEwcal7vH2OD54lCcgpxKxqdmGc5/bp5UnqB45+n+iuInV/Q9DMOQVk15uaVZmhS8VaCqH21CmfH/ZGLb9wiEpaRLrPZLKX3bK7MT9Z0/OlDnb2QUKU8LMMIhLuQQntzsf0Wn4kA/0e9QAJJQ==";
|
||||||
|
|
||||||
@ -41,6 +54,7 @@ public class App extends Application {
|
|||||||
public static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态
|
public static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态
|
||||||
private Context con;
|
private Context con;
|
||||||
public static App mApplication = null;
|
public static App mApplication = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@ -78,29 +92,34 @@ public class App extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PendingIntent pendingIntent =
|
PendingIntent pendingIntent =
|
||||||
// PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
// Cactus.getInstance()
|
Cactus.getInstance()
|
||||||
// .isDebug(true)
|
.isDebug(true)
|
||||||
// //可选,设置通知栏点击事件
|
.setTitle("好运司机")
|
||||||
// .setPendingIntent(pendingIntent)
|
.setContent("您的接单助手!")
|
||||||
//// .setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
|
.setChannelId("gld")
|
||||||
//// .setMusicId(R.raw.main) //可选,设置音乐
|
.setChannelName("好运司机")
|
||||||
//// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
|
.setServiceId(Integer.MAX_VALUE)
|
||||||
//// .addCallback(new CactusCallback())//可选,运行时回调
|
//可选,设置通知栏点击事件
|
||||||
// .setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
.setPendingIntent(pendingIntent)
|
||||||
// .setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
.setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
|
||||||
// .setTitle("大河好运")
|
.setMusicId(R.raw.main) //可选,设置音乐
|
||||||
// .setSmallIcon(R.drawable.diver_logo)
|
// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
|
||||||
// .addBackgroundCallback(new CactusBackgroundCallback() {
|
// .addCallback(new CactusCallback())//可选,运行时回调
|
||||||
// @Override
|
.setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||||
// public void onBackground(boolean b) {
|
.setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||||
// if (b){
|
.setSmallIcon(R.drawable.diver_logo)
|
||||||
// getBillLocation();
|
.addCallback(this)
|
||||||
// }
|
.addBackgroundCallback(new CactusBackgroundCallback() {
|
||||||
// }
|
@Override
|
||||||
// })
|
public void onBackground(boolean b) {
|
||||||
// .register(this);
|
if (b) {
|
||||||
|
getBillLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static App getApp() {
|
public static App getApp() {
|
||||||
@ -149,4 +168,62 @@ public class App extends Application {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doWork(int i) {
|
||||||
|
|
||||||
|
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
FileOutputStream fos = null;
|
||||||
|
try {
|
||||||
|
String nowString = TimeUtil.getNowString(TimeUtil.DEFAULT_FORMAT);
|
||||||
|
String content = i + "当前时间:"+nowString;
|
||||||
|
String fileName = "location" + ".txt";
|
||||||
|
|
||||||
|
if (Environment.getExternalStorageState().equals(
|
||||||
|
Environment.MEDIA_MOUNTED)) {
|
||||||
|
//获取文件输出路径
|
||||||
|
String path = Environment.getExternalStorageDirectory()
|
||||||
|
+ "/crashinfo2/";
|
||||||
|
//创建文件夹和文件
|
||||||
|
File dir = new File(path);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
// File file = new File(path + fileName);
|
||||||
|
// if (!file.exists())
|
||||||
|
// file.createNewFile();
|
||||||
|
//创建输出流
|
||||||
|
fos = new FileOutputStream(path + fileName,true);
|
||||||
|
File file = new File(path + fileName);
|
||||||
|
if (file.exists()){
|
||||||
|
fos.write('\r');
|
||||||
|
}
|
||||||
|
//向文件中写出数据
|
||||||
|
fos.write(content.toString().getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fos.flush();
|
||||||
|
fos.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (fos != null) {
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,14 +1,21 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.ui.news;
|
package com.arpa.hndahesudintocctmsdriver.ui.news;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.R;
|
import com.arpa.hndahesudintocctmsdriver.R;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.view.BottomTabUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.view.BottomTabUtil;
|
||||||
|
import com.dahe.mylibrary.utils.ToastUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hlh
|
* @author hlh
|
||||||
@ -27,6 +34,33 @@ public class NewActivity extends BaseAppCompatActivity {
|
|||||||
fs[0] =new NewsFragment();
|
fs[0] =new NewsFragment();
|
||||||
BottomTabUtil bt =new BottomTabUtil(this,R.id.body, fs);
|
BottomTabUtil bt =new BottomTabUtil(this,R.id.body, fs);
|
||||||
bt.selectItem(fs[0]);
|
bt.selectItem(fs[0]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
if (!Environment.isExternalStorageManager()) {
|
||||||
|
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||||
|
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
this.startActivityForResult(intent, 1024);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRefuse = false;
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == 1024 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
// 检查是否有权限
|
||||||
|
if (Environment.isExternalStorageManager()) {
|
||||||
|
isRefuse = false;
|
||||||
|
ToastUtils.showToast(this,"授权成功");
|
||||||
|
// 授权成功
|
||||||
|
} else {
|
||||||
|
isRefuse = true;
|
||||||
|
ToastUtils.showToast(this,"授权失败");
|
||||||
|
// 授权失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ public final class TimeUtil {
|
|||||||
* 注意:SimpleDateFormat不是线程安全的,线程安全需用{@code ThreadLocal<SimpleDateFormat>}
|
* 注意:SimpleDateFormat不是线程安全的,线程安全需用{@code ThreadLocal<SimpleDateFormat>}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final DateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
public static final DateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||||
private static final DateFormat DEFAULT_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZSS:SS", Locale.getDefault());
|
private static final DateFormat DEFAULT_FORMAT2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZSS:SS", Locale.getDefault());
|
||||||
private static final DateFormat DEFAULT_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
|
private static final DateFormat DEFAULT_FORMAT3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
|
||||||
public static final DateFormat DEFAULT_FORMAT4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
|
public static final DateFormat DEFAULT_FORMAT4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
|
||||||
|
Loading…
Reference in New Issue
Block a user