正在查看: Loan Locker v1.5 应用的 ForeGroundGetLocationSendMassageLinkActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Loan Locker v1.5 应用的 ForeGroundGetLocationSendMassageLinkActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.user.a4keygen.activity;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.JsonObject;
import com.user.a4keygen.DeviceAdminReceiver;
import com.user.a4keygen.R;
import com.user.a4keygen.model.CommonResponseModel;
import com.user.a4keygen.network.ApiClient;
import com.user.a4keygen.network.ApiInterface;
import com.user.a4keygen.receiver.CustomReceiverSendLocationMsgLink;
import com.user.a4keygen.sharedprefrence.SharedPrefManager;
import com.user.a4keygen.webutil.WebClientService;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ForeGroundGetLocationSendMassageLinkActivity extends AppCompatActivity implements LocationListener {
public static final String CUSTOM_BROADCAST_ACTION_LOCATION = "com.grintech.emisafelockapp.CUSTOM_BROADCAST_LOCATION";
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10;
private static final long MIN_TIME_BW_UPDATES = 60000;
private static final String SMS_SENT_KEY = "sms_sent_key";
private CustomReceiverSendLocationMsgLink customReceiver;
private DevicePolicyManager dpm;
Location location;
protected LocationManager locationManager;
private ComponentName mAdminComponentName;
private Context mContext;
String userid;
boolean isGPSEnabled = false;
boolean isNetworkEnabled = false;
int locationCount = 0;
boolean canGetLocation = false;
double latitude = 0.0d;
double longitude = 0.0d;
private int lastShownNotificationId = 321;
@Override
public void onLocationChanged(Location location) {
}
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_fore_ground_get_location);
this.locationCount = 0;
this.mContext = this;
resetLocationFetchingState();
setLocationEnable();
getLocation();
}
private void genericAip() {
try {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("userId", SharedPrefManager.getInstance(getApplicationContext()).getUserId());
jsonObject.addProperty("operationType", "GC_VM");
jsonObject.addProperty("acknowledgement", "Generic api Location via message");
((ApiInterface) ApiClient.getInstance(getApplicationContext()).getClient().create(ApiInterface.class)).genericApi(jsonObject).enqueue(new Callback<CommonResponseModel>() {
public void onFailure(Call<CommonResponseModel> call, Throwable th) {
}
public void onResponse(Call<CommonResponseModel> call, Response<CommonResponseModel> response) {
if (response.isSuccessful()) {
"S".equals(((CommonResponseModel) response.body()).getStatus());
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
private void setLocationEnable() {
this.dpm = (DevicePolicyManager) getSystemService("device_policy");
this.mAdminComponentName = DeviceAdminReceiver.getComponentName(this);
if (!WebClientService.isActiveAdmin(this) || Build.VERSION.SDK_INT < 30) {
return;
}
this.dpm.setLocationEnabled(this.mAdminComponentName, true);
}
public Location getLocation() {
this.locationCount++;
try {
LocationManager locationManager = (LocationManager) this.mContext.getSystemService(FirebaseAnalytics.Param.LOCATION);
this.locationManager = locationManager;
this.isGPSEnabled = locationManager.isProviderEnabled("gps");
boolean isProviderEnabled = this.locationManager.isProviderEnabled("network");
this.isNetworkEnabled = isProviderEnabled;
boolean z = this.isGPSEnabled;
if (z || isProviderEnabled) {
this.canGetLocation = true;
if (z && Build.VERSION.SDK_INT >= 23 && ((ContextCompat.checkSelfPermission(this.mContext, "android.permission.ACCESS_FINE_LOCATION") == 0 || ContextCompat.checkSelfPermission(this.mContext, "android.permission.ACCESS_COARSE_LOCATION") == 0) && this.location == null)) {
this.locationManager.requestLocationUpdates("gps", MIN_TIME_BW_UPDATES, 10.0f, this);
LocationManager locationManager2 = this.locationManager;
if (locationManager2 != null) {
Location lastKnownLocation = locationManager2.getLastKnownLocation("gps");
this.location = lastKnownLocation;
if (lastKnownLocation != null) {
this.latitude = lastKnownLocation.getLatitude();
this.longitude = this.location.getLongitude();
}
}
}
if (this.isNetworkEnabled) {
if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(this.mContext, "android.permission.ACCESS_FINE_LOCATION") == 0 || ContextCompat.checkSelfPermission(this.mContext, "android.permission.ACCESS_COARSE_LOCATION") == 0) {
this.locationManager.requestLocationUpdates("network", MIN_TIME_BW_UPDATES, 10.0f, this);
LocationManager locationManager3 = this.locationManager;
if (locationManager3 != null) {
Location lastKnownLocation2 = locationManager3.getLastKnownLocation("network");
this.location = lastKnownLocation2;
if (lastKnownLocation2 != null) {
this.latitude = lastKnownLocation2.getLatitude();
this.longitude = this.location.getLongitude();
}
}
}
} else {
this.locationManager.requestLocationUpdates("network", MIN_TIME_BW_UPDATES, 10.0f, this);
LocationManager locationManager4 = this.locationManager;
if (locationManager4 != null) {
Location lastKnownLocation3 = locationManager4.getLastKnownLocation("network");
this.location = lastKnownLocation3;
if (lastKnownLocation3 != null) {
this.latitude = lastKnownLocation3.getLatitude();
this.longitude = this.location.getLongitude();
System.out.println("latitude = " + this.latitude);
System.out.println("longitude = " + this.longitude);
}
}
}
}
}
if (this.latitude != 0.0d && this.longitude != 0.0d) {
this.locationCount = 0;
genericAip();
registerCustomReceiver();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ForeGroundGetLocationSendMassageLinkActivity.this.sendCustomBroadcast();
}
}, 100L);
} else if (this.locationCount < 4) {
getLocation();
}
} catch (Exception e) {
e.printStackTrace();
}
return this.location;
}
public void sendCustomBroadcast() {
Intent intent = new Intent();
intent.setAction("com.grintech.emisafelockapp.CUSTOM_BROADCAST_LOCATION");
intent.putExtra("google_maps_link", createGoogleMapsLink(this.latitude, this.longitude));
sendBroadcast(intent);
}
private String createGoogleMapsLink(double d, double d2) {
return "https://www.google.com/maps?q=" + d + "," + d2;
}
protected void onDestroy() {
super.onDestroy();
unregisterCustomReceiver();
}
private void registerCustomReceiver() {
CustomReceiverSendLocationMsgLink customReceiverSendLocationMsgLink = new CustomReceiverSendLocationMsgLink();
this.customReceiver = customReceiverSendLocationMsgLink;
registerReceiver(customReceiverSendLocationMsgLink, new IntentFilter("com.grintech.emisafelockapp.CUSTOM_BROADCAST_LOCATION"));
}
private void unregisterCustomReceiver() {
CustomReceiverSendLocationMsgLink customReceiverSendLocationMsgLink = this.customReceiver;
if (customReceiverSendLocationMsgLink != null) {
unregisterReceiver(customReceiverSendLocationMsgLink);
this.customReceiver = null;
}
}
private void resetLocationFetchingState() {
SharedPrefManager.getInstance(this.mContext).putBoolean(SMS_SENT_KEY, false);
}
}