Skip to content

Commit

Permalink
Merge pull request #136 from prey/connect
Browse files Browse the repository at this point in the history
Connect
  • Loading branch information
oaliaga authored Sep 12, 2018
2 parents f67ceb3 + 54d4414 commit 757eede
Show file tree
Hide file tree
Showing 43 changed files with 1,211 additions and 680 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.prey"
minSdkVersion 14
targetSdkVersion 24
versionCode 155
versionName '1.9.5'
versionCode 156
versionName '1.9.6'
multiDexEnabled true
}
buildTypes {
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prey"
android:installLocation="internalOnly"
android:versionCode="155"
android:versionName="1.9.5" >
android:versionCode="156"
android:versionName="1.9.6" >


<uses-feature android:name="android.hardware.location.network" android:required="true" />
Expand Down Expand Up @@ -67,7 +67,6 @@




<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
Expand Down Expand Up @@ -295,6 +294,9 @@

<!-- AIRPLANE -->
<action android:name="android.intent.action.AIRPLANE_MODE" />
<!-- USER_PRESENT -->
<action android:name="android.intent.action.USER_PRESENT"/>


</intent-filter>
</receiver>
Expand All @@ -303,9 +305,6 @@
<receiver android:name="com.prey.receivers.AlarmScheduledReceiver" />
<receiver android:name="com.prey.receivers.AlarmDisablePowerReceiver" />

<receiver android:name="com.prey.actions.aware.AwareAlarmReceiver" />
<service android:name="com.prey.actions.aware.AwareService" />

<receiver android:name="com.prey.receivers.PreyDisablePowerOptionsReceiver" android:enabled="true" android:exported="false">
<intent-filter android:priority="20000">
<action android:name="android.intent.action.CLOSE_SYSTEM_DIALOGS" />
Expand Down Expand Up @@ -342,7 +341,7 @@




<receiver android:name="com.prey.actions.autoconnect.AutoConnectAlarmReceiver" />


<!-- Services -->
Expand All @@ -353,14 +352,15 @@
<service android:name="com.prey.beta.services.PreyBetaRunnerService" />
<service android:name="com.prey.actions.report.ReportService" />
<service android:name="com.prey.actions.geofences.GeofenceIntentService" />
<service android:name="com.prey.actions.aware.AwareIntentService" />
<service android:name="com.prey.actions.fileretrieval.FileretrievalService" />
<service android:name="com.prey.services.PreyLockService" />
<service android:name="com.prey.services.PreySecureService" />
<service android:name="com.prey.services.PreyOverlayService" />

<service android:name="com.prey.services.PreyNotificationForeGroundService" />


<service android:name="com.prey.actions.autoconnect.AutoConnectService" />

<!-- [START firebase_service] -->
<service
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/prey/FileConfigReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static FileConfigReader getInstance(Context ctx) {
if (_instance == null)
_instance = new FileConfigReader(ctx);
return _instance;

}

public String getPreyCampaign() {
Expand Down Expand Up @@ -165,5 +164,8 @@ public int getDistanceAware() {
return Integer.parseInt(properties.getProperty("distance-aware"));
}

public int getRadiusAware() {
return Integer.parseInt(properties.getProperty("radius-aware"));
}

}
55 changes: 22 additions & 33 deletions app/src/main/java/com/prey/PreyApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@

import android.app.Application;
import android.content.Intent;
import android.location.Location;

import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.google.android.gms.location.Geofence;
import com.google.firebase.FirebaseApp;
import com.google.firebase.iid.FirebaseInstanceId;
import com.prey.actions.aware.AwareConfig;
import com.prey.actions.aware.AwareController;
import com.prey.actions.fileretrieval.FileretrievalController;
import com.prey.actions.geofences.GeofenceController;
import com.prey.actions.geofences.GeofenceIntentService;
import com.prey.actions.report.ReportScheduled;
import com.prey.events.Event;
import com.prey.events.manager.EventManagerRunner;
Expand All @@ -29,9 +25,7 @@

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class PreyApp extends Application {
Expand Down Expand Up @@ -60,27 +54,19 @@ public void onCreate() {
String sessionId = PreyUtils.randomAlphaNumeric(16);
PreyLogger.d("#######sessionId:" + sessionId);
PreyConfig.getPreyConfig(this).setSessionId(sessionId);
String PreyVersion = PreyConfig.getPreyConfig(this).getPreyVersion();
String preferencePreyVersion = PreyConfig.getPreyConfig(this).getPreferencePreyVersion();
PreyLogger.d("PreyVersion:" + PreyVersion+" preferencePreyVersion:"+preferencePreyVersion);

boolean missing=PreyConfig.getPreyConfig(this).isMissing();
if (PreyVersion.equals(preferencePreyVersion)) {
PreyConfig.getPreyConfig(this).setPreferencePreyVersion(PreyVersion);
PreyWebServices.getInstance().sendEvent(this, PreyConfig.ANDROID_VERSION_UPDATED);
}

if (deviceKey != null && deviceKey != "") {
new Thread() {
public void run() {
PreyConfig.getPreyConfig(getApplicationContext()).registerC2dm();
}
}.start();
new Thread() {
public void run() {
GeofenceController.getInstance().init(getApplicationContext());
}
}.start();
new Thread() {
public void run() {
try {
String email = PreyWebServices.getInstance().getEmail(getApplicationContext());
PreyConfig.getPreyConfig(getApplicationContext()).setEmail(email);
}catch (Exception e){}
GeofenceController.getInstance().run(getApplicationContext());
AwareController.getInstance().init(getApplicationContext());
FileretrievalController.getInstance().run(getApplicationContext());
}
}.start();
Expand All @@ -89,21 +75,19 @@ public void run() {
ReportScheduled.getInstance(this).run();
}
}
new Thread() {
public void run() {
AwareConfig.getAwareConfig(getApplicationContext()).init();
}
}.start();
new Thread() {
public void run() {
if (PreyConfig.getPreyConfig(getApplicationContext()).isSimChanged()) {
JSONObject info = new JSONObject();
try {
String lineNumber=PreyTelephonyManager.getInstance(getApplicationContext()).getLine1Number();
if(lineNumber!=null&&!"".equals(lineNumber)) {
info.put("new_phone_number", PreyTelephonyManager.getInstance(getApplicationContext()).getLine1Number());
info.put("new_phone_number", lineNumber);
}
String simSerialNumber=PreyConfig.getPreyConfig(getApplicationContext()).getSimSerialNumber();
if(simSerialNumber!=null&&!"".equals(simSerialNumber)) {
info.put("sim_serial_number", simSerialNumber);
}
info.put("sim_serial_number", PreyConfig.getPreyConfig(getApplicationContext()).getSimSerialNumber());
} catch (Exception e) {
}
Event event= new Event(Event.SIM_CHANGED, info.toString());
Expand All @@ -116,6 +100,12 @@ public void run() {
DisablePowerCheckBoxPreference.notifyReady(this);
try{this.startService(new Intent(this, PreyDisablePowerOptionsService.class));}catch (Exception e){}
}
/*
new Thread() {
public void run() {
AutoConnectScheduled.getInstance(getApplicationContext()).run();
}
}.start();*/

}
try {
Expand Down Expand Up @@ -150,10 +140,10 @@ public void onAttributionFailure(String errorMessage) {
String flyerKey= FileConfigReader.getInstance(getApplicationContext()).getFlyerKey();
AppsFlyerLib.getInstance().init(flyerKey , conversionListener , getApplicationContext());
AppsFlyerLib.getInstance().startTracking(this, flyerKey);
AppsFlyerLib.getInstance().setDebugLog(true);
AppsFlyerLib.getInstance().setDebugLog(false);
}
catch (Exception e) {
PreyLogger.e("error e:"+e.getMessage(),e);
PreyLogger.e("Error PreyApp:"+e.getMessage(),e);
}
} catch (Exception e) {
PreyLogger.e("Error PreyApp:" + e.getMessage(), e);
Expand All @@ -174,7 +164,6 @@ public static void setInstallData(Map<String, String> conversionData){
InstallConversionData += install_type + media_source + install_time + click_time + is_first_launch;
sessionCount++;
}

}

}
Loading

0 comments on commit 757eede

Please sign in to comment.