2012-06-26 Mark Holland <mark@mark-holland.me.uk>
* res/values/strings.xml: Added strings for smsReceived, networkType, phoneType and calls. Replicated in values-en and values-es. * res/layout/setup.xml: Added checkboxes for simID and task reporting. * res/layout/status.xml: Added textviews for new data. * src/pandroid/agent/core.java: set simID reporting as disabled by default. Added variables for networkOperator, networkType, phoneType, signalStrength, incoming, missed and outgoing calls. * src/pandroid/agent/PandroidAgentListener.java: task, smsReceived, networkType, phoneType and calls methods and then added to XML. simID now checks whether enabled in user configuration. * src/pandroid/agent/setup.java: Added spinner for task selection. * src/pandroid/agent/SMSActivity.java: removed * src/pandroid/agent/SMSBroadcastReceiver.java: upon receiving a smsreceived intent, increments the stored number of smsReceived. * src/pandroid/agent/status.java: Added textviews for new methods mentioned above. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6708 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
39bdf296e6
commit
199fb87920
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="lib" path="libs/commons-lang3-3.0.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="lib" path="libs/commons-lang3-3.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<activity
|
||||
android:name=".PandroidAgent"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:theme="@android:style/Theme.NoTitleBar"
|
||||
>
|
||||
<intent-filter>
|
||||
|
@ -37,11 +37,7 @@
|
|||
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service
|
||||
android:name=".SMSActivity"
|
||||
android:label="@string/sms_activity_str"
|
||||
android:theme="@android:style/Theme.Dialog"
|
||||
/>
|
||||
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
@ -52,6 +48,7 @@
|
|||
<uses-permission android:name="android.permission.GET_TASKS"/>
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.sensor.light" />
|
||||
<uses-feature android:name="android.hardware.location" />
|
||||
|
|
|
@ -1,3 +1,37 @@
|
|||
2012-06-26 Mark Holland <mark@mark-holland.me.uk>
|
||||
|
||||
* res/values/strings.xml: Added strings for
|
||||
smsReceived, networkType, phoneType and calls.
|
||||
Replicated in values-en and values-es.
|
||||
|
||||
* res/layout/setup.xml: Added checkboxes for simID
|
||||
and task reporting.
|
||||
|
||||
* res/layout/status.xml: Added textviews for new data.
|
||||
|
||||
* src/pandroid/agent/core.java: set simID
|
||||
reporting as disabled by default. Added variables
|
||||
for networkOperator, networkType, phoneType,
|
||||
signalStrength, incoming, missed and outgoing calls.
|
||||
|
||||
* src/pandroid/agent/PandroidAgentListener.java: task,
|
||||
smsReceived, networkType, phoneType and calls methods
|
||||
and then added to XML. simID now checks whether
|
||||
enabled in user configuration.
|
||||
|
||||
* src/pandroid/agent/setup.java: Added spinner for task
|
||||
selection.
|
||||
|
||||
* src/pandroid/agent/SMSActivity.java: removed
|
||||
|
||||
* src/pandroid/agent/SMSBroadcastReceiver.java: upon
|
||||
receiving a smsreceived intent, increments the stored
|
||||
number of smsReceived.
|
||||
|
||||
* src/pandroid/agent/status.java: Added textviews for
|
||||
new methods mentioned above.
|
||||
|
||||
|
||||
2012-06-19 Mark Holland <mark@mark-holland.me.uk>
|
||||
|
||||
* res/layout.main.xml: removed as no longer used
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
# cache for current jar dependecy. DO NOT EDIT.
|
||||
# format is <lastModified> <length> <SHA-1> <path>
|
||||
# Encoding is UTF-8
|
Binary file not shown.
After Width: | Height: | Size: 801 B |
Binary file not shown.
After Width: | Height: | Size: 768 B |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
|
@ -95,7 +95,15 @@
|
|||
android:textSize="14dip"
|
||||
android:textColor="#bbbbbb"
|
||||
/>
|
||||
<!--<CheckBox
|
||||
<CheckBox
|
||||
android:id="@+id/checksimIDReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/simIDReport"
|
||||
android:textSize="14dip"
|
||||
android:textColor="#bbbbbb"
|
||||
/>
|
||||
<CheckBox
|
||||
android:id="@+id/checkTaskReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -132,7 +140,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/update"
|
||||
/>-->
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/update"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
android:layout_below="@id/proximity_label_str"
|
||||
/>-->
|
||||
</RelativeLayout>
|
||||
<!--<TextView
|
||||
<TextView
|
||||
android:id="@+id/task_label_str"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -145,7 +145,7 @@
|
|||
android:id="@+id/task_value_str"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>-->
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/memory_label_str"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -186,19 +186,58 @@
|
|||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/networkoperator"
|
||||
android:id="@+id/network_operator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/networkoperator"
|
||||
android:text="@string/network_operator"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/networkoperator_value"
|
||||
android:id="@+id/network_operator_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<!-- <TextView
|
||||
<TextView
|
||||
android:id="@+id/network_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/network_type"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/network_type_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/phone_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/phone_type"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/phone_type_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/signal_strength"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/signal_strength"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/signal_strength_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/sms_received"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -211,7 +250,59 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
-->
|
||||
<TextView
|
||||
android:id="@+id/sms_sent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sms_sent"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/sms_sent_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/incoming_Calls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/incoming_Calls"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/incoming_Calls_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/missed_Calls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/missed_Calls"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/missed_Calls_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/outgoing_Calls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/outgoing_Calls"
|
||||
android:textSize="14dip"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/outgoing_Calls_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
|
|
@ -58,7 +58,21 @@
|
|||
<string name="uptime_value"/>
|
||||
<string name="sms_received">Received SMS: </string>
|
||||
<string name="sms_received_value"/>
|
||||
<string name="sms_activity_str">SMS</string>
|
||||
<string name="networkoperator">Network operator:</string>
|
||||
<string name="networkoperator_value"/>
|
||||
<string name="sms_sent">Sent SMS: </string>
|
||||
<string name="sms_sent_value"/>
|
||||
<string name="network_operator">Network operator:</string>
|
||||
<string name="network_operator_value"/>
|
||||
<string name="simIDReport">Report Sim ID</string>
|
||||
<string name="network_type">Network type:</string>
|
||||
<string name="network_type_value"/>
|
||||
<string name="phone_type">Phone type:</string>
|
||||
<string name="phone_type_value"/>
|
||||
<string name="signal_strength">Signal strength:</string>
|
||||
<string name="signal_strength_value"/>
|
||||
<string name="incoming_Calls">Incoming calls:</string>
|
||||
<string name="incoming_Calls_value"/>
|
||||
<string name="missed_Calls">Missed calls:</string>
|
||||
<string name="missed_Calls_value"/>
|
||||
<string name="outgoing_Calls">outgoing calls:</string>
|
||||
<string name="outgoing_Calls_value"/>
|
||||
</resources>
|
||||
|
|
|
@ -58,5 +58,22 @@
|
|||
<string name="uptime_value"/>
|
||||
<string name="sms_received">SMS recibido: </string>
|
||||
<string name="sms_received_value"/>
|
||||
<string name="sms_activity_str">SMS</string>
|
||||
<string name="sms_sent">SMS enviado: </string>
|
||||
<string name="sms_sent_value"/>
|
||||
<string name="network_operator">Operador:</string>
|
||||
<string name="network_operator_value"/>
|
||||
<string name="simIDReport">Reporta Sim ID</string>
|
||||
<string name="network_type">Tipo red:</string>
|
||||
<string name="network_type_value"/>
|
||||
<string name="phone_type">Tipo movil:</string>
|
||||
<string name="phone_type_value"/>
|
||||
<string name="signal_strength">Potencia senyal:</string>
|
||||
<string name="signal_strength_value"/>
|
||||
<string name="incoming_Calls">Llamadas recibidas:</string>
|
||||
<string name="incoming_Calls_value"/>
|
||||
<string name="missed_Calls">Llamadas perdidas:</string>
|
||||
<string name="missed_Calls_value"/>
|
||||
<string name="outgoing_Calls">Llamadas enviadas:</string>
|
||||
<string name="outgoing_Calls_value"/>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -58,7 +58,22 @@
|
|||
<string name="uptime_value"/>
|
||||
<string name="sms_received">Received SMS: </string>
|
||||
<string name="sms_received_value"/>
|
||||
<string name="sms_activity_str">SMS</string>
|
||||
<string name="networkoperator">Network operator:</string>
|
||||
<string name="networkoperator_value"/>
|
||||
<string name="sms_sent">Sent SMS: </string>
|
||||
<string name="sms_sent_value"/>
|
||||
<string name="network_operator">Network operator:</string>
|
||||
<string name="network_operator_value"/>
|
||||
<string name="simIDReport">Report Sim ID</string>
|
||||
<string name="network_type">Network type:</string>
|
||||
<string name="network_type_value"/>
|
||||
<string name="phone_type">Phone type:</string>
|
||||
<string name="phone_type_value"/>
|
||||
<string name="signal_strength">Signal strength:</string>
|
||||
<string name="signal_strength_value"/>
|
||||
<string name="incoming_Calls">Incoming calls:</string>
|
||||
<string name="incoming_Calls_value"/>
|
||||
<string name="missed_Calls">Missed calls:</string>
|
||||
<string name="missed_Calls_value"/>
|
||||
<string name="outgoing_Calls">outgoing calls:</string>
|
||||
<string name="outgoing_Calls_value"/>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -24,8 +24,8 @@ public class Core {
|
|||
static volatile public String defaultServerPort = "41121";
|
||||
static volatile public int defaultInterval = 300;
|
||||
static volatile public String defaultAgentName = "pandroid";
|
||||
static volatile public String defaultGpsStatus = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultMemoryStatus = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultGpsStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultMemoryStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultTaskStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultTask = "";
|
||||
static volatile public String defaultTaskHumanName = "";
|
||||
|
@ -34,10 +34,18 @@ public class Core {
|
|||
static volatile public long defaultContact = 0;
|
||||
static volatile public int defaultContactError = 0;
|
||||
static volatile public String defaultSimID = "";
|
||||
static volatile public String defaultSimIDStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public long defaultUpTime = 0;
|
||||
|
||||
static volatile public int defaultSMSReceived = 0;
|
||||
static volatile public String defaultMobileOperator = "";
|
||||
static volatile public int defaultSMSSent = 0;
|
||||
static volatile public String defaultNetworkOperator = "";
|
||||
static volatile public String defaultNetworkType = "";
|
||||
static volatile public String defaultPhoneType = "";
|
||||
static volatile public String defaultSignalStrength = "";
|
||||
static volatile public int defaultIncomingCalls = 0;
|
||||
static volatile public int defaultMissedCalls = 0;
|
||||
static volatile public int defaultOutgoingCalls = 0;
|
||||
|
||||
static volatile public Context con = null;
|
||||
static volatile public AlarmManager am = null;
|
||||
|
@ -53,10 +61,20 @@ public class Core {
|
|||
static volatile public String taskStatus = defaultTaskStatus;
|
||||
static volatile public String task = defaultTask;
|
||||
static volatile public String taskHumanName = defaultTaskHumanName;
|
||||
static volatile public String simID = ""; //fix
|
||||
static volatile public long upTime = defaultUpTime; //mark device uptime including deep sleep
|
||||
static volatile public String simID = "";
|
||||
static volatile public String simIDStatus = defaultSimIDStatus;
|
||||
static volatile public long upTime = defaultUpTime;
|
||||
static volatile public int SMSReceived = defaultSMSReceived;
|
||||
static volatile public String networkOperator = defaultMobileOperator;
|
||||
static volatile public int SMSSent = defaultSMSSent;
|
||||
static volatile public String networkOperator = defaultNetworkOperator;
|
||||
static volatile public String networkType = defaultNetworkType;
|
||||
static volatile public String phoneType = defaultPhoneType;
|
||||
static volatile public String signalStrength = defaultSignalStrength;
|
||||
static volatile public int incomingCalls = defaultIncomingCalls;
|
||||
static volatile public int missedCalls = defaultMissedCalls;
|
||||
static volatile public int outgoingCalls = defaultOutgoingCalls;
|
||||
|
||||
|
||||
|
||||
static volatile public float latitude = CONST_INVALID_COORDS;
|
||||
static volatile public float longitude = CONST_INVALID_COORDS;
|
||||
|
@ -126,7 +144,16 @@ public class Core {
|
|||
contactError = agentPreferences.getInt("contactError", Core.defaultContactError);
|
||||
simID = agentPreferences.getString("simID", Core.defaultSimID);
|
||||
upTime = agentPreferences.getLong("upTime", Core.defaultUpTime);
|
||||
networkOperator = agentPreferences.getString("networkOperator", Core.defaultMobileOperator);
|
||||
SMSReceived = agentPreferences.getInt("SMSReceived", Core.defaultSMSReceived);
|
||||
SMSSent = agentPreferences.getInt("SMSSent", Core.defaultSMSSent);
|
||||
networkOperator = agentPreferences.getString("networkOperator", Core.defaultNetworkOperator);
|
||||
networkType = agentPreferences.getString("networkType", Core.defaultNetworkType);
|
||||
phoneType = agentPreferences.getString("phoneType", Core.defaultPhoneType);
|
||||
signalStrength = agentPreferences.getString("signalStrength", Core.defaultSignalStrength);
|
||||
incomingCalls = agentPreferences.getInt("incomingCalls", Core.defaultIncomingCalls);
|
||||
missedCalls = agentPreferences.getInt("missedCalls", Core.defaultMissedCalls);
|
||||
outgoingCalls = agentPreferences.getInt("outgoingCalls", Core.defaultOutgoingCalls);
|
||||
|
||||
}
|
||||
|
||||
static public void loadConf(Context context) {
|
||||
|
@ -142,7 +169,7 @@ public class Core {
|
|||
serverPort = agentPreferences.getString("serverPort", Core.defaultServerPort);
|
||||
interval = agentPreferences.getInt("interval", Core.defaultInterval);
|
||||
//fix agent name to mark
|
||||
agentName = agentPreferences.getString("agentName", Core.defaultAgentName + "_mark_v");
|
||||
agentName = agentPreferences.getString("agentName", Core.defaultAgentName);
|
||||
gpsStatus = agentPreferences.getString("gpsStatus", Core.defaultGpsStatus);
|
||||
memoryStatus = agentPreferences.getString("memoryStatus", Core.defaultMemoryStatus);
|
||||
taskStatus = agentPreferences.getString("taskStatus", Core.defaultTaskStatus);
|
||||
|
@ -153,13 +180,17 @@ public class Core {
|
|||
|
||||
static public boolean updateConf(Context context) {
|
||||
return updateConf(context, serverAddr, serverPort, interval, agentName,
|
||||
gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, upTime, networkOperator);
|
||||
gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, upTime,
|
||||
networkOperator, SMSReceived, SMSSent, networkType, phoneType, signalStrength,
|
||||
incomingCalls, missedCalls, outgoingCalls);
|
||||
}
|
||||
|
||||
static public boolean updateConf(Context context, String _serverAddr,
|
||||
String _serverPort, int _interval, String _agentName, String _gpsStatus,
|
||||
String _memoryStatus, String _taskStatus, String _task,
|
||||
String _taskHumanName, String _simID, long _upTime, String _networkOperator) {
|
||||
String _taskHumanName, String _simID, long _upTime, String _networkOperator,
|
||||
int _smsReceived, int _smsSent, String _networkType, String _phoneType, String _signalStrength,
|
||||
int _incomingCalls, int _missedCalls, int _outgoingCalls) {
|
||||
if (con == null) {
|
||||
con = context;
|
||||
}
|
||||
|
@ -181,6 +212,14 @@ public class Core {
|
|||
editor.putString("SimID", _simID);
|
||||
editor.putLong("UpTime", _upTime);
|
||||
editor.putString("networkOperator", _networkOperator);
|
||||
editor.putInt("SMSReceived", _smsReceived);
|
||||
editor.putInt("SMSSent", _smsSent);
|
||||
editor.putString("networkType", _networkType);
|
||||
editor.putString("phoneType", _phoneType);
|
||||
editor.putString("signalStrength", _signalStrength);
|
||||
editor.putInt("incomingCalls", _incomingCalls);
|
||||
editor.putInt("missedCalls", _missedCalls);
|
||||
editor.putInt("outgoingCalls", _outgoingCalls);
|
||||
|
||||
if (editor.commit()) {
|
||||
return true;
|
||||
|
|
|
@ -29,22 +29,20 @@ import org.apache.commons.lang3.StringEscapeUtils;
|
|||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.MemoryInfo;
|
||||
//import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
//import android.content.pm.PackageManager;
|
||||
//import android.hardware.Sensor;
|
||||
//import android.hardware.SensorEvent;
|
||||
//import android.hardware.SensorEventListener;
|
||||
//import android.hardware.SensorManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -52,7 +50,8 @@ import android.os.IBinder;
|
|||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.SystemClock;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -77,6 +76,13 @@ public class PandroidAgentListener extends Service {
|
|||
String defaultUpTime = "0";
|
||||
String defaultNetworkOperator = "";
|
||||
String defaultSMSReceived = "5";
|
||||
String defaultSMSSent = "4";
|
||||
String defaultNetworkType = "";
|
||||
String defaultPhoneType = "";
|
||||
String defaultSignalStrength = "0";
|
||||
String defaultIncomingCalls = "0";
|
||||
String defaultMissedCalls = "0";
|
||||
String defaultOutgoingCalls = "0";
|
||||
|
||||
boolean showLastXML = true;
|
||||
|
||||
|
@ -140,6 +146,7 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
|
||||
updateValues();
|
||||
//set has connected to true
|
||||
}
|
||||
|
||||
private String buildXML(){
|
||||
|
@ -172,19 +179,27 @@ public class PandroidAgentListener extends Service {
|
|||
String orientation = getSharedData("PANDROID_DATA", "orientation", "361", "float");
|
||||
String proximity = getSharedData("PANDROID_DATA", "proximity", "-1.0", "float");
|
||||
String batteryLevel = getSharedData("PANDROID_DATA", "batteryLevel", "-1", "integer");
|
||||
//String taskStatus = getSharedData("PANDROID_DATA", "taskStatus", "disabled", "string");
|
||||
//String taskRun = getSharedData("PANDROID_DATA", "taskRun", "false", "string");
|
||||
String taskStatus = getSharedData("PANDROID_DATA", "taskStatus", "disabled", "string");
|
||||
String taskRun = getSharedData("PANDROID_DATA", "taskRun", "false", "string");
|
||||
String taskHumanName = getSharedData("PANDROID_DATA", "taskHumanName", "", "string");
|
||||
taskHumanName = StringEscapeUtils.escapeHtml4(taskHumanName);
|
||||
|
||||
//String task = getSharedData("PANDROID_DATA", "task", "", "string");
|
||||
String task = getSharedData("PANDROID_DATA", "task", "", "string");
|
||||
String memoryStatus = getSharedData("PANDROID_DATA", "memoryStatus", defaultMemoryStatus, "string");
|
||||
String availableRamKb = getSharedData("PANDROID_DATA", "availableRamKb", "0" , "long");
|
||||
String totalRamKb = getSharedData("PANDROID_DATA", "totalRamKb", "0", "long");
|
||||
String sim_ID = getSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
|
||||
String SimID = getSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
|
||||
String upTime = getSharedData("PANDROID_DATA", "upTime", defaultUpTime, "long");
|
||||
String networkOperator = getSharedData("PANDROID_DATA", "networkOperator", defaultNetworkOperator, "string");
|
||||
//String SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", defaultSMSReceived, "integer");
|
||||
String SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", defaultSMSReceived, "integer");
|
||||
String SMSSent = getSharedData("PANDROID_DATA", "SMSSent", defaultSMSSent, "integer");
|
||||
String networkType = getSharedData("PANDROID_DATA", "networkType", defaultNetworkType, "string");
|
||||
String phoneType = getSharedData("PANDROID_DATA", "networkType", defaultNetworkType, "string");
|
||||
String signalStrength = getSharedData("PANDROID_DATA", "signalStrength", defaultSignalStrength, "string");
|
||||
String incomingCalls = getSharedData("PANDROID_DATA", "incomingCalls", defaultIncomingCalls, "integer");
|
||||
String missedCalls = getSharedData("PANDROID_DATA", "missedCalls", defaultMissedCalls, "integer");
|
||||
String outgoingCalls = getSharedData("PANDROID_DATA", "outgoingCalls", defaultOutgoingCalls, "integer");
|
||||
|
||||
|
||||
buffer += buildmoduleXML("battery_level", "The current Battery level", "generic_data", batteryLevel);
|
||||
|
||||
|
@ -196,7 +211,7 @@ public class PandroidAgentListener extends Service {
|
|||
buffer += buildmoduleXML("proximity", "The actually device proximity detector (0/1)", "generic_data", proximity);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
if (taskStatus.equals("enabled")) {
|
||||
buffer += buildmoduleXML("taskHumanName", "The task's human name.", "async_string", taskHumanName);
|
||||
buffer += buildmoduleXML("task", "The task's package name.", "async_string", task);
|
||||
|
@ -207,7 +222,7 @@ public class PandroidAgentListener extends Service {
|
|||
buffer += buildmoduleXML("taskRun", "The task is running.", "async_proc", "0");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (memoryStatus.equals("enabled")) {
|
||||
|
||||
|
@ -219,10 +234,17 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
//buffer += buildmoduleXML("last_gps_contact", "Datetime of the last geo-location contact", "generic_data", lastGpsContactDateTime);
|
||||
|
||||
buffer += buildmoduleXML("simID", "The Sim ID.", "generic_data_string", sim_ID);
|
||||
buffer += buildmoduleXML("simID", "The Sim ID.", "generic_data_string", SimID);
|
||||
buffer += buildmoduleXML("upTime","Total device uptime in seconds.", "generic_data", upTime);
|
||||
buffer += buildmoduleXML("networkOperator","Currently registered network operator", "generic_data_string", networkOperator);
|
||||
//buffer += buildmoduleXML("SMSRecieved","Number of SMS recieved", "generic_data", SMSReceived);
|
||||
buffer += buildmoduleXML("SMSRecieved","Number of SMS received", "generic_data", SMSReceived);
|
||||
buffer += buildmoduleXML("SMSSent","Number of SMS sent", "generic_data", SMSSent);
|
||||
buffer += buildmoduleXML("networkType","Current network type", "generic_data_string", networkType);
|
||||
buffer += buildmoduleXML("phoneType","Phone type", "generic_data_string", phoneType);
|
||||
buffer += buildmoduleXML("signalStrength","Signal strength", "generic_data_string", signalStrength);
|
||||
buffer += buildmoduleXML("incomingCalls","Incoming calls", "generic_data", incomingCalls);
|
||||
buffer += buildmoduleXML("missedCalls","Missed calls", "generic_data", missedCalls);
|
||||
buffer += buildmoduleXML("outgoingCalls","Outgoing calls", "generic_data", outgoingCalls);
|
||||
// End_Modules
|
||||
|
||||
buffer += "</agent_data>";
|
||||
|
@ -408,12 +430,17 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
|
||||
//sensors();
|
||||
//getTaskStatus();
|
||||
getTaskStatus();
|
||||
getMemoryStatus();
|
||||
getSimID();
|
||||
getUpTime();
|
||||
getNetworkOperator();
|
||||
//getSMSReceived();
|
||||
getSMSReceived();
|
||||
//getSMSSent();
|
||||
getNetworkType();
|
||||
getPhoneType();
|
||||
getSignalStrength();
|
||||
getCalls();
|
||||
}
|
||||
|
||||
private void getMemoryStatus() {
|
||||
|
@ -446,7 +473,7 @@ public class PandroidAgentListener extends Service {
|
|||
putSharedData("PANDROID_DATA", "totalRamKb", "" + totalRamKb, "long");
|
||||
}
|
||||
|
||||
/*private void getTaskStatus() {
|
||||
private void getTaskStatus() {
|
||||
String taskStatus = getSharedData("PANDROID_DATA", "taskStatus", defaultTaskStatus, "string");
|
||||
String task = getSharedData("PANDROID_DATA", "task", defaultTask, "string");
|
||||
String taskHumanName = getSharedData("PANDROID_DATA", "taskHumanName", defaultTaskHumanName, "string");
|
||||
|
@ -471,19 +498,23 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
putSharedData("PANDROID_DATA", "taskRun", run, "string");
|
||||
}//end gettaskstatus
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieves the simID of the device if available
|
||||
*/
|
||||
public void getSimID(){
|
||||
String simID = getSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
|
||||
|
||||
String serviceName = Context.TELEPHONY_SERVICE;
|
||||
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
|
||||
simID = telephonyManager.getSimSerialNumber();
|
||||
|
||||
if(Core.simIDStatus.equals("enabled")){
|
||||
|
||||
putSharedData("PANDROID_DATA", "simID", simID, "string");
|
||||
String simID = getSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
|
||||
|
||||
String serviceName = Context.TELEPHONY_SERVICE;
|
||||
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
|
||||
simID = telephonyManager.getSimSerialNumber();
|
||||
putSharedData("PANDROID_DATA", "simID", simID, "string");
|
||||
}
|
||||
else
|
||||
putSharedData("PANDROID_DATA", "simID", defaultSimID, "string");
|
||||
}
|
||||
/**
|
||||
* Retrieves the time in seconds since the device was switched on
|
||||
|
@ -496,10 +527,12 @@ public class PandroidAgentListener extends Service {
|
|||
//Log.v(LOG_TAG, upTime);
|
||||
putSharedData("PANDROID_DATA", "upTime", upTime, "long");
|
||||
}
|
||||
/**
|
||||
* Retrieve currently registered network operator, i.e. vodafone, movistar, etc...
|
||||
*/
|
||||
public void getNetworkOperator(){
|
||||
String networkOperator = defaultNetworkOperator;
|
||||
|
||||
|
||||
|
||||
String serviceName = Context.TELEPHONY_SERVICE;
|
||||
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
|
||||
networkOperator = telephonyManager.getNetworkOperatorName();
|
||||
|
@ -508,16 +541,238 @@ public class PandroidAgentListener extends Service {
|
|||
Log.v(LOG_TAG, networkOperator);
|
||||
putSharedData("PANDROID_DATA", "networkOperator", networkOperator, "string");
|
||||
}
|
||||
/*
|
||||
|
||||
public void getSMSReceived(){
|
||||
String SMSReceived = defaultSMSReceived;
|
||||
|
||||
SMSReceived = getSharedData("SMS_DATA", "SMSReceived", defaultSMSReceived, "integer");
|
||||
|
||||
Log.v(LOG_TAG, "SMSReceived:"+SMSReceived);
|
||||
//putSharedData("PANDROID_DATA", "upTime", upTime, "long");
|
||||
SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", defaultSMSReceived, "integer");
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public void getSMSSent(){
|
||||
|
||||
String SMSSent = defaultSMSSent;
|
||||
|
||||
SMSSent = getSharedData("PANDROID_DATA", "SMSSent", defaultSMSSent, "integer");
|
||||
|
||||
Uri allMessages = Uri.parse("content://sms/sent");
|
||||
|
||||
Cursor c = getContentResolver().query(allMessages, null, null, null, null);
|
||||
int totalMessages = 0;
|
||||
|
||||
while (c.moveToNext())
|
||||
{
|
||||
String messageBody = c.getString(c.getColumnIndex("body"));
|
||||
long messageLength = messageBody.length();
|
||||
double numberOfMessages = messageLength / 160.0;
|
||||
double numberOfMessagesRoundedUp = Math.ceil(numberOfMessages);
|
||||
|
||||
totalMessages = (int) (totalMessages + numberOfMessagesRoundedUp);
|
||||
}
|
||||
|
||||
c.close();
|
||||
|
||||
SMSSent =""+ totalMessages;
|
||||
|
||||
putSharedData("PANDROID_DATA", "SMSSent", SMSSent, "integer");
|
||||
|
||||
}
|
||||
/**
|
||||
* Retrieve the type of data network currently connected to, i.e. edge, gprs, etc...
|
||||
*/
|
||||
public void getNetworkType()
|
||||
{
|
||||
String networkType = defaultNetworkType;
|
||||
|
||||
TelephonyManager tM = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
int nT = tM.getNetworkType();
|
||||
|
||||
switch (nT)
|
||||
{
|
||||
case 0:
|
||||
networkType = "Unknown";
|
||||
break;
|
||||
case 1:
|
||||
networkType = "GPRS";
|
||||
break;
|
||||
case 2:
|
||||
networkType = "EDGE";
|
||||
break;
|
||||
case 3:
|
||||
networkType = "UMTS";
|
||||
break;
|
||||
case 4:
|
||||
networkType = "CDMA";
|
||||
break;
|
||||
case 5:
|
||||
networkType = "EVDO rev. 0";
|
||||
break;
|
||||
case 6:
|
||||
networkType = "EVDO rev. A";
|
||||
break;
|
||||
case 7:
|
||||
networkType = "1xRTT";
|
||||
break;
|
||||
case 8:
|
||||
networkType = "HSDPA";
|
||||
break;
|
||||
case 9:
|
||||
networkType = "HSUPA";
|
||||
break;
|
||||
case 10:
|
||||
networkType = "HSPA";
|
||||
break;
|
||||
case 11:
|
||||
networkType = "iDen";
|
||||
break;
|
||||
case 12:
|
||||
networkType = "EVDO rev. B";
|
||||
break;
|
||||
case 13:
|
||||
networkType = "LTE";
|
||||
break;
|
||||
case 14:
|
||||
networkType = "eHRPD";
|
||||
break;
|
||||
case 15:
|
||||
networkType = "HSPA+";
|
||||
break;
|
||||
}
|
||||
putSharedData("PANDROID_DATA", "networkType", networkType, "string");
|
||||
|
||||
}
|
||||
/**
|
||||
* Retrieve the type of mobile network currently conncected to, i.e. gms, cdma, etc...
|
||||
*/
|
||||
public void getPhoneType()
|
||||
{
|
||||
String phoneType = defaultPhoneType;
|
||||
|
||||
TelephonyManager tM = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
||||
int pT = tM.getPhoneType();
|
||||
|
||||
switch (pT)
|
||||
{
|
||||
case 0:
|
||||
phoneType = "none";
|
||||
break;
|
||||
case 1:
|
||||
phoneType = "GSM";
|
||||
break;
|
||||
case 2:
|
||||
phoneType = "CDMA";
|
||||
break;
|
||||
case 3:
|
||||
phoneType = "SIP";
|
||||
break;
|
||||
}
|
||||
putSharedData("PANDROID_DATA", "phoneType", phoneType, "string");
|
||||
}
|
||||
public void getCalls()
|
||||
{
|
||||
/*
|
||||
Uri uri = android.provider.CallLog.Calls.CONTENT_URI;
|
||||
Cursor c = getApplicationContext().getContentResolver().query(uri, null, null, null, null);
|
||||
|
||||
if(c != null && c.moveToFirst()) {
|
||||
while (c.isAfterLast() == false) {
|
||||
int _ID = c.getColumnIndex(android.provider.CallLog.Calls._ID);
|
||||
int _NUMBER = c.getColumnIndex(android.provider.CallLog.Calls.NUMBER);
|
||||
int _DATE = c.getColumnIndex(android.provider.CallLog.Calls.DATE);
|
||||
int _DURATION = c.getColumnIndex(android.provider.CallLog.Calls.DURATION);
|
||||
int _CALLTYPE = c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
|
||||
int _NAME = c.getColumnIndex(android.provider.CallLog.Calls.CACHED_NAME);
|
||||
int _NUMBERTYPE = c.getColumnIndex(android.provider.CallLog.Calls.CACHED_NUMBER_TYPE);
|
||||
int _NEW = c.getColumnIndex(android.provider.CallLog.Calls.NEW);
|
||||
|
||||
String id = c.getString(_ID);
|
||||
String number = c.getString(_NUMBER);
|
||||
String date = c.getString(_DATE);
|
||||
String duration = c.getString(_DURATION);
|
||||
String callType = c.getString(_CALLTYPE);
|
||||
String name = c.getString(_NAME);
|
||||
String numberType = c.getString(_NUMBERTYPE);
|
||||
String _new = c.getString(_NEW);
|
||||
|
||||
|
||||
|
||||
Log.v(LOG_TAG, "type: "+callType);
|
||||
|
||||
c.moveToNext();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Cursor c = getApplicationContext().getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI, null, null, null, null);
|
||||
c.moveToFirst();
|
||||
|
||||
int typeColumn = c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
|
||||
|
||||
int incoming = 0;
|
||||
int outgoing = 0;
|
||||
int missed = 0;
|
||||
|
||||
if(c.isFirst()){
|
||||
|
||||
while (c.isAfterLast() == false) {
|
||||
int callType = c.getInt(typeColumn);
|
||||
|
||||
switch(callType){
|
||||
case android.provider.CallLog.Calls.INCOMING_TYPE:
|
||||
incoming++;
|
||||
break;
|
||||
|
||||
case android.provider.CallLog.Calls.MISSED_TYPE:
|
||||
missed++;
|
||||
break;
|
||||
|
||||
case android.provider.CallLog.Calls.OUTGOING_TYPE:
|
||||
outgoing++;
|
||||
break;
|
||||
}
|
||||
c.moveToNext();
|
||||
}
|
||||
|
||||
Log.v(LOG_TAG, "incoming: "+incoming);
|
||||
putSharedData("PANDROID_DATA", "incomingCalls", ""+incoming, "integer");
|
||||
Log.v(LOG_TAG, "missed: "+missed);
|
||||
putSharedData("PANDROID_DATA", "missedCalls", ""+missed, "integer");
|
||||
Log.v(LOG_TAG, "outgoing: "+outgoing);
|
||||
putSharedData("PANDROID_DATA", "outgoingCalls", ""+outgoing, "integer");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void getSignalStrength()
|
||||
{
|
||||
TelephonyManager SignalManager = (TelephonyManager)getSystemService
|
||||
(Context.TELEPHONY_SERVICE);
|
||||
SignalManager.listen(signalListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
|
||||
|
||||
}
|
||||
PhoneStateListener signalListener=new PhoneStateListener()
|
||||
{
|
||||
|
||||
public void onSignalStrengthChanged(SignalStrength signalStrength)
|
||||
{
|
||||
Log.v(LOG_TAG, "here");
|
||||
String signalStrengthValue = defaultSignalStrength;
|
||||
if (signalStrength.isGsm()) {
|
||||
if (signalStrength.getGsmSignalStrength() != 99)
|
||||
signalStrengthValue =""+ (signalStrength.getGsmSignalStrength() * 2 - 113);
|
||||
else
|
||||
signalStrengthValue =""+ (signalStrength.getGsmSignalStrength());
|
||||
} else {
|
||||
signalStrengthValue ="" + (signalStrength.getCdmaDbm());
|
||||
}
|
||||
putSharedData("PANDROID_DATA", "signalStrength", signalStrengthValue, "integer");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private void putSharedData(String preferenceName, String tokenName, String data, String type) {
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
SharedPreferences agentPreferences = getSharedPreferences(preferenceName, mode);
|
||||
|
@ -618,22 +873,23 @@ public class PandroidAgentListener extends Service {
|
|||
///////////////////////////////////////////
|
||||
|
||||
public class MyLocationListener implements LocationListener {
|
||||
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location loc) {
|
||||
putSharedData("PANDROID_DATA", "latitude", new Double(loc.getLatitude()).toString(), "float");
|
||||
putSharedData("PANDROID_DATA", "longitude", new Double(loc.getLongitude()).toString(), "float");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package pandroid.agent;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
public class SMSActivity {
|
||||
private static final String TAG = "SMSActivity";
|
||||
|
||||
|
||||
static public void SMSReceived(Context context){
|
||||
|
||||
|
||||
int defaultSMSReceived = 0;
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
|
||||
|
||||
|
||||
SharedPreferences pref = context.getSharedPreferences("SMS_DATA", mode);
|
||||
int a = pref.getInt("SMSReceived", defaultSMSReceived);
|
||||
Log.i(TAG, "sms received: " + a);
|
||||
a++;
|
||||
Log.i(TAG, "sms received: " + a);
|
||||
|
||||
|
||||
SharedPreferences.Editor editor = pref.edit();
|
||||
editor.putInt("SMSReceived", a);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
package pandroid.agent;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
public class SMSBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
|
@ -16,14 +18,26 @@ import android.content.BroadcastReceiver;
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
Log.i(TAG, "Intent recieved: " + intent.getAction());
|
||||
|
||||
//if (intent.getAction() == "android.provider.Telephony.SMS_RECEIVED") {
|
||||
//sms recieved
|
||||
//Intent i = new Intent(context, SMSActivity.class);
|
||||
//i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// context.startActivity(i);
|
||||
// SMSActivity.SMSReceived(this);
|
||||
|
||||
// }//end if
|
||||
if (intent.getAction().equals(SMS_RECEIVED)) {
|
||||
|
||||
int defaultSMSReceived = 0;
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
|
||||
|
||||
SharedPreferences pref = context.getSharedPreferences("PANDROID_DATA", mode);
|
||||
int a = pref.getInt("SMSReceived", defaultSMSReceived);
|
||||
|
||||
a++;
|
||||
|
||||
SharedPreferences.Editor editor = pref.edit();
|
||||
editor.putInt("SMSReceived", a);
|
||||
editor.commit();
|
||||
|
||||
|
||||
}//end if
|
||||
|
||||
|
||||
|
||||
}//end onRecieve
|
||||
}//end class
|
||||
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
package pandroid.agent;
|
||||
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
//import android.app.ActivityManager;
|
||||
//import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
import android.content.Intent;
|
||||
//import android.content.pm.PackageManager;
|
||||
//import android.content.pm.PackageManager.NameNotFoundException;
|
||||
//import android.os.AsyncTask;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
//import android.widget.ArrayAdapter;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
//import android.widget.ProgressBar;
|
||||
//import android.widget.Spinner;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Setup extends Activity {
|
||||
|
||||
//private HashMap<String, String> listProcesses;
|
||||
private HashMap<String, String> listProcesses;
|
||||
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
|
@ -35,13 +35,13 @@ public class Setup extends Activity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// listProcesses = new HashMap<String, String>();
|
||||
listProcesses = new HashMap<String, String>();
|
||||
|
||||
setContentView(R.layout.setup);
|
||||
|
||||
Core.loadConf(getApplicationContext());
|
||||
loadViews();
|
||||
//loadInBackgroundProcessInExecution();
|
||||
loadInBackgroundProcessInExecution();
|
||||
setButtonEvents();
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class Setup extends Activity {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
private void loadInBackgroundProcessInExecution() {
|
||||
new GetProcessInExecutionAsyncTask().execute();
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public class Setup extends Activity {
|
|||
|
||||
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class Setup extends Activity {
|
|||
// Init form values
|
||||
EditText editText;
|
||||
CheckBox checkBox;
|
||||
//Spinner combo;
|
||||
Spinner combo;
|
||||
|
||||
editText = (EditText) findViewById(R.id.serverAddrInput);
|
||||
Core.serverAddr = editText.getText().toString();
|
||||
|
@ -219,8 +219,13 @@ public class Setup extends Activity {
|
|||
Core.memoryStatus = "enabled";
|
||||
else
|
||||
Core.memoryStatus = "disabled";
|
||||
checkBox = (CheckBox) findViewById(R.id.checksimIDReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.simIDStatus = "enabled";
|
||||
else
|
||||
Core.simIDStatus = "disabled";
|
||||
|
||||
|
||||
/*
|
||||
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
|
||||
if (checkBox.isChecked()) {
|
||||
Core.taskStatus = "enabled";
|
||||
|
@ -237,7 +242,7 @@ public class Setup extends Activity {
|
|||
Core.task = "";
|
||||
Core.taskHumanName = "";
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private void loadViews(){
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Status extends Activity {
|
|||
super.onStart();
|
||||
|
||||
h.post(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Core.loadLastValues(getApplicationContext());
|
||||
showLastValues();
|
||||
|
@ -50,6 +50,7 @@ public class Status extends Activity {
|
|||
h.postDelayed(this, 1000);
|
||||
}
|
||||
});
|
||||
//set to 1 for first contact
|
||||
}
|
||||
|
||||
//For options
|
||||
|
@ -243,7 +244,7 @@ public class Status extends Activity {
|
|||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
textView = (TextView)findViewById(R.id.task_value_str);
|
||||
textView.setText("");
|
||||
if (Core.taskStatus.equals("enabled") && Core.taskHumanName.length() != 0) {
|
||||
|
@ -256,7 +257,7 @@ public class Status extends Activity {
|
|||
}
|
||||
textView.setText(text);
|
||||
}
|
||||
*/
|
||||
|
||||
// freeMemory
|
||||
textView = (TextView)findViewById(R.id.memory_value_str);
|
||||
textView.setText("");
|
||||
|
@ -279,16 +280,46 @@ public class Status extends Activity {
|
|||
textView.setText("" + Core.upTime+" Seconds");
|
||||
}
|
||||
// mobile operator
|
||||
textView = (TextView)findViewById(R.id.networkoperator_value);
|
||||
textView = (TextView)findViewById(R.id.network_operator_value);
|
||||
textView.setText("");
|
||||
if (Core.networkOperator != null) {
|
||||
textView.setText("" + Core.networkOperator);
|
||||
}
|
||||
// SMSReceived
|
||||
/*
|
||||
textView = (TextView)findViewById(R.id.sms_received_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.getSMSReceived(getApplicationContext()));
|
||||
*/
|
||||
textView.setText("" + Core.SMSReceived);
|
||||
/*
|
||||
// SMSSent
|
||||
textView = (TextView)findViewById(R.id.sms_sent_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.SMSSent);
|
||||
*/
|
||||
// SMSReceived
|
||||
textView = (TextView)findViewById(R.id.network_type_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.networkType);
|
||||
|
||||
textView = (TextView)findViewById(R.id.phone_type_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.phoneType);
|
||||
|
||||
textView = (TextView)findViewById(R.id.signal_strength_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.signalStrength);
|
||||
|
||||
textView = (TextView)findViewById(R.id.incoming_Calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.incomingCalls);
|
||||
|
||||
textView = (TextView)findViewById(R.id.missed_Calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.missedCalls);
|
||||
|
||||
textView = (TextView)findViewById(R.id.outgoing_Calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.outgoingCalls);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue