2013-04-28 Mark Holland <mark@mark-holland.me.uk>
* assets/database/pandroid.zip: Removed as no longer needed * assets/libs/android-sqlite-asset-helper: Removed as no longer needed * layout/setup.xml: Disabled autocorrect on server address and agent name text edits. Changed all dip to sp. Changed order of some objects * layout/setupnosim.xml: Disabled autocorrect on server address and agent name text edits. Changed all dip to sp. Changed order of some objects * src/pandroid/agent/Core.java: Reordered lots of code to improve legibility. * src/pandroid/agent/DataBaseHandler.java: Removed as no longer needed * src/pandroid/agent/DataBaseHandler.java: Removed as no longer needed * src/pandroid/agent/HelperSharedPreferences: Removed as no longer needed * src/pandroid/agent/PandroidAgent.java: Removed all relating to SharedPreferences * src/pandroid/agent/PandroidAgentListener.java: loadConf on service start. Restored SharedPreferences getter and setter. Notification shows the whole time alarm enabled, on stop agent dissapears. On connection shows message(unavoidable at current time). * src/pandroid/agent/PandroidAgentTentacle.java: Changed socket timeout to 2000ms. * src/pandroid/agent/Setup.java: Reordered lots of code to improve legibility. * src/pandroid/agent/SMSBroadcastReceiver.java: Returned to using local SharedPreferences. * values: Added value for choosing task to report, odd suggestions. * Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8075 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9f34b2a5bd
commit
a27a539b97
|
@ -1,3 +1,51 @@
|
|||
2013-04-28 Mark Holland <mark@mark-holland.me.uk>
|
||||
|
||||
* assets/database/pandroid.zip: Removed as no longer needed
|
||||
|
||||
* assets/libs/android-sqlite-asset-helper: Removed as no longer
|
||||
needed
|
||||
|
||||
* layout/setup.xml: Disabled autocorrect on server address
|
||||
and agent name text edits. Changed all dip to sp. Changed order
|
||||
of some objects
|
||||
|
||||
* layout/setupnosim.xml: Disabled autocorrect on server address
|
||||
and agent name text edits. Changed all dip to sp. Changed order
|
||||
of some objects
|
||||
|
||||
* src/pandroid/agent/Core.java: Reordered lots of code
|
||||
to improve legibility.
|
||||
|
||||
* src/pandroid/agent/DataBaseHandler.java: Removed as
|
||||
no longer needed
|
||||
|
||||
* src/pandroid/agent/DataBaseHandler.java: Removed as
|
||||
no longer needed
|
||||
|
||||
* src/pandroid/agent/HelperSharedPreferences: Removed
|
||||
as no longer needed
|
||||
|
||||
* src/pandroid/agent/PandroidAgent.java: Removed all relating
|
||||
to SharedPreferences
|
||||
|
||||
* src/pandroid/agent/PandroidAgentListener.java: loadConf on service
|
||||
start. Restored SharedPreferences getter and setter. Notification
|
||||
shows the whole time alarm enabled, on stop agent dissapears. On
|
||||
connection shows message(unavoidable at current time).
|
||||
|
||||
* src/pandroid/agent/PandroidAgentTentacle.java: Changed socket
|
||||
timeout to 2000ms.
|
||||
|
||||
* src/pandroid/agent/Setup.java: Reordered lots of code
|
||||
to improve legibility.
|
||||
|
||||
* src/pandroid/agent/SMSBroadcastReceiver.java: Returned
|
||||
to using local SharedPreferences.
|
||||
|
||||
* values: Added value for choosing task to report, odd suggestions.
|
||||
|
||||
* Pandroid Agent v3.0_iso-8859-1.apk: Updated to latest version.
|
||||
|
||||
2013-04-27 Mark Holland <mark@mark-holland.me.uk>
|
||||
|
||||
* Pandroid Agent v3.0_iso-8859-1.apk: Restored proper default values
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -32,6 +32,14 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNotification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notificationCheck"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field1"
|
||||
|
@ -44,6 +52,7 @@
|
|||
android:id="@+id/serverAddrInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
|
@ -82,24 +91,13 @@
|
|||
android:id="@+id/agentNameInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field5"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mobileWebURL" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mobileWebURLInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field6"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bufferSize" />
|
||||
|
||||
<EditText
|
||||
|
@ -108,37 +106,32 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field6"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mobileWebURL" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mobileWebURLInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/goToWebButton"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/go_to_web" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkGpsReport"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/field7"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gpsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBatteryLevelReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/BatteryLevelReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkTaskReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/taskReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
android:text="@string/taskToReport" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -155,6 +148,30 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkTaskReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/taskReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkGpsReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gpsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBatteryLevelReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/BatteryLevelReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkMemoryReport"
|
||||
|
@ -162,8 +179,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/memoryReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkDeviceUpTimeReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uptimeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkInventoryReport"
|
||||
|
@ -171,24 +195,23 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/InventoryReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkHelloSignalReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/HelloSignalReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkSimIDReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/simIDReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkDeviceUpTimeReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uptimeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNetworkOperatorReport"
|
||||
|
@ -196,7 +219,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/NetworkOperatorReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNetworkTypeReport"
|
||||
|
@ -204,7 +227,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/NetworkTypeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkPhoneTypeReport"
|
||||
|
@ -212,7 +235,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/PhoneTypeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkSignalStrengthReport"
|
||||
|
@ -220,7 +243,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/SignalStrengthReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkReceivedSMSReport"
|
||||
|
@ -228,7 +251,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/ReceivedSMSReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkSentSMSReport"
|
||||
|
@ -236,7 +259,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/SentSMSReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkIncomingCallsReport"
|
||||
|
@ -244,7 +267,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/IncomingCallsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkMissedCallsReport"
|
||||
|
@ -252,7 +275,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/MissedCallsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkOutgoingCallsReport"
|
||||
|
@ -260,7 +283,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/OutgoingCallsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBytesReceivedReport"
|
||||
|
@ -268,7 +291,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/BytesReceivedReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBytesSentReport"
|
||||
|
@ -276,33 +299,16 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/BytesSentReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkHelloSignalReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/HelloSignalReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkRoamingReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/RoamingReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNotification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notificationCheck"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/update"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
-->
|
||||
// GNU General Public License for more details.
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/setupnosim"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -32,6 +31,14 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNotification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notificationCheck"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field1"
|
||||
|
@ -44,6 +51,7 @@
|
|||
android:id="@+id/serverAddrInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
|
@ -82,62 +90,46 @@
|
|||
android:id="@+id/agentNameInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field5"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mobileWebURL" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mobileWebURLInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field6"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bufferSize" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/bufferSize"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:singleLine="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/field6"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/mobileWebURL" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/mobileWebURLInput"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/goToWebButton"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/go_to_web" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkGpsReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gpsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBatteryLevelReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/BatteryLevelReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkTaskReport"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/field7"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/taskReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:text="@string/taskToReport" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -156,14 +148,45 @@
|
|||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkTaskReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/taskReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkGpsReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/gpsReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkBatteryLevelReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/BatteryLevelReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkMemoryReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/memoryReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkDeviceUpTimeReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uptimeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkInventoryReport"
|
||||
|
@ -171,34 +194,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/InventoryReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkDeviceUpTimeReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/uptimeReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkHelloSignalReport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/HelloSignalReport"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/checkNotification"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notificationCheck"
|
||||
android:textColor="#bbbbbb"
|
||||
android:textSize="14dip" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/update"
|
||||
|
|
|
@ -493,7 +493,7 @@
|
|||
</TableLayout>
|
||||
|
||||
|
||||
<!--
|
||||
<!-- for debugging
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -172,7 +172,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<!--
|
||||
|
||||
<!-- for debugging
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
<string name="simIDReport">"Bericht Sim ID"</string>
|
||||
<string name="gpsReport">"Bericht GPS-Daten"</string>
|
||||
<string name="memoryReport">"Bericht verfügbaren Speicher"</string>
|
||||
<string name="taskToReport">Wählen Aufgabe zu berichten:</string>
|
||||
<string name="taskReport">"Bericht Aufgabe"</string>
|
||||
<string name="uptimeReport">"Bericht Gerät up-Zeit"</string>
|
||||
<string name="NetworkOperatorReport">"Bericht Netzbetreiber"</string>
|
||||
|
@ -144,7 +145,7 @@
|
|||
|
||||
<string name="notification_title">Pandroid</string>
|
||||
<string name="notification_message">Agent ausgeführt wird</string>
|
||||
<string name="ticker_text">Connecting…</string>
|
||||
<string name="ticker_text">Verbindend…</string>
|
||||
<string name="stopAgent">Stopp Agent</string>
|
||||
<string name="restartAgent">Starten Agent</string>
|
||||
<string name="notificationCheck">anzeigen Benachrichtigung, wenn läuft?</string>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<string name="pandroid_agent_copyright">Copyright © 2011 Artica</string>
|
||||
<string name="about_desc">Pandroid Agent logo</string>
|
||||
<string name="help_str">Help</string>
|
||||
<string name="memory_avaliable_str" formatted="false">Avaliable: %iKb Total: %iKb</string>
|
||||
<string name="memory_avaliable_str" formatted="false">Available: %iKb Total: %iKb</string>
|
||||
<string name="never_str">Never.</string>
|
||||
<string name="now_str">Now.</string>
|
||||
<string name="seconds_str">seconds ago.</string>
|
||||
|
@ -60,7 +60,7 @@
|
|||
Pandroid Agent is an Android Pandora FMS agent for Pandora FMS. <p>
|
||||
Pandora FMS is a general purpose monitoring system. With the android agent you can get all sorts of information from your device,
|
||||
the gps location, how much battery is left, available memory on the device, monitoring if a process is active, the time since the device was turned on, a HELLO signal for monitoring installations of the app,
|
||||
an inventory with all the installed apps aswell as information for android phones with a sim card; the sim card ID, the number of SMS sent/received, the number of calls
|
||||
an inventory with all the installed apps as well as information for android phones with a sim card; the sim card ID, the number of SMS sent/received, the number of calls
|
||||
incoming/missed/outgoing, the network operator and type, the phone type, the mobile signal strength, the number of bytes sent/received
|
||||
over the mobile network. Complete source code is provided.<p>See more about Pandora FMS at <a href="http://pandorafms.com">http://pandoraFMS.com</a></p>
|
||||
</string>
|
||||
|
@ -114,7 +114,7 @@
|
|||
<string name="password_repeat">Repeat Password</string>
|
||||
<string name="password_choose_text">Do you want to set a password?</string>
|
||||
<string name="password_checkbox">Don\'t ask again</string>
|
||||
<string name="password_created">Password sucessfully created</string>
|
||||
<string name="password_created">Password successfully created</string>
|
||||
<string name="password_removed">No password set</string>
|
||||
<string name="set_password">Create/Change password</string>
|
||||
|
||||
|
@ -132,6 +132,7 @@
|
|||
<string name="simIDReport">Report Sim ID</string>
|
||||
<string name="gpsReport">Report GPS data</string>
|
||||
<string name="memoryReport">Report available memory</string>
|
||||
<string name="taskToReport">Choose task to report:</string>
|
||||
<string name="taskReport">Report task</string>
|
||||
<string name="uptimeReport">Report device up time</string>
|
||||
<string name="NetworkOperatorReport">Report network operator</string>
|
||||
|
|
|
@ -62,12 +62,12 @@
|
|||
GPS, cuanta batería le queda al dispositivo, memoria disponible, si un proceso está activo, El tiempoe que lleva encendido el dispositivo,
|
||||
un señal de saludo para monotrorizar instalaciones de pandroid, un inventario con información de todos los apps instalados. También
|
||||
datos de moviles, la ID del sim, número de SMS enviados/recibidos, número de llamadas entrantes/perdidas/recibidas, el nombre del operador
|
||||
y el tipo, el tipo de movil, la potencia de señal, el número de bytes enviados/recibidos por la red movil.
|
||||
y el tipo, el tipo de móvil, la potencia de señal, el número de bytes enviados/recibidos por la red móvil.
|
||||
El código fuente esta disponible.<p>Puedes informarte de esto y mas en Pandora FMS en <a href="http://pandorafms.org">http://pandorafms.org</a></p>
|
||||
</string>
|
||||
<string name="start">Iniciar</string>
|
||||
<string name="correct_start">Conexion con exito</string>
|
||||
<string name="config_saved">Configuración guardado con exito</string>
|
||||
<string name="correct_start">Conexion con éxito</string>
|
||||
<string name="config_saved">Configuración guardado con éxito</string>
|
||||
<string name="contact_stopped_str">Agente parado</string>
|
||||
<string name="seconds">Segundos</string>
|
||||
<string name="running">En marcha</string>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<string name="network_operator_value"/>
|
||||
<string name="network_type">Tipo red:</string>
|
||||
<string name="network_type_value"/>
|
||||
<string name="phone_type">Tipo movil:</string>
|
||||
<string name="phone_type">Tipo móvil:</string>
|
||||
<string name="phone_type_value"/>
|
||||
<string name="signal_strength">Potencia señal:</string>
|
||||
<string name="signal_strength_value"/>
|
||||
|
@ -119,8 +119,8 @@
|
|||
<string name="password_removed">Sin contraseña</string>
|
||||
<string name="set_password">Crear/Cambiar contraseña</string>
|
||||
|
||||
<string name="mobileWebURL">URL de servidor movil:</string>
|
||||
<string name="go_to_web">Ver sitio movil</string>
|
||||
<string name="mobileWebURL">URL de servidor móvil:</string>
|
||||
<string name="go_to_web">Ver sitio móvil</string>
|
||||
|
||||
<string name="bufferSize">Tamaño de búfer XML(KB)</string>
|
||||
|
||||
|
@ -132,11 +132,12 @@
|
|||
<string name="simIDReport">Reporta Sim ID</string>
|
||||
<string name="gpsReport">Reporta datos GPS</string>
|
||||
<string name="memoryReport">Reporta estado memoria</string>
|
||||
<string name="taskToReport">Elegir tarea a reportar:</string>
|
||||
<string name="taskReport">Reporta tarea</string>
|
||||
<string name="uptimeReport">Reporta tiempo encendido</string>
|
||||
<string name="NetworkOperatorReport">Reporta operador de red</string>
|
||||
<string name="NetworkTypeReport">Reporta tipo de red</string>
|
||||
<string name="PhoneTypeReport">Reporta tipo de movil</string>
|
||||
<string name="PhoneTypeReport">Reporta tipo de móvil</string>
|
||||
<string name="SignalStrengthReport">Reporta potencia de señal</string>
|
||||
<string name="ReceivedSMSReport">Reporta numero de SMS recibido</string>
|
||||
<string name="SentSMSReport">Reporta numero de SMS enviado</string>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="summary">"Configuration actuelle:"</string>
|
||||
<string name="starStop">"Redém."</string>
|
||||
<string name="gpsLast">"Dernière position connue"</string>
|
||||
<string name="loading">"Chargement ..."</string>
|
||||
<string name="loading">"Chargement…"</string>
|
||||
<string name="last_values">"Dernières valeurs"</string>
|
||||
<string name="latitude">"Latitude"</string>
|
||||
<string name="longitude">"Longitude"</string>
|
||||
|
@ -117,7 +117,7 @@
|
|||
|
||||
<string name="bufferSize">taille du buffer XML(KB)</string>
|
||||
|
||||
<string name="enter">"Entrer..."</string>
|
||||
<string name="enter">"Entrer…"</string>
|
||||
<string name="back">"arrière"</string>
|
||||
<string name="yes">"oui"</string>
|
||||
<string name="no">"no"</string>
|
||||
|
@ -125,6 +125,7 @@
|
|||
<string name="simIDReport">"Rapport Sim ID"</string>
|
||||
<string name="gpsReport">"Rapport de données GPS"</string>
|
||||
<string name="memoryReport">"Signaler mémoire disponible"</string>
|
||||
<string name="taskToReport">Choisissez tâche de rendre compte:</string>
|
||||
<string name="taskReport">"Tâche de rapport"</string>
|
||||
<string name="uptimeReport">"Signaler appareil le temps"</string>
|
||||
<string name="NetworkOperatorReport">"Signaler opérateur de réseau"</string>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="summary">"La configurazione attuale:"</string>
|
||||
<string name="starStop">"Riavviare"</string>
|
||||
<string name="gpsLast">"Ultima posizione nota"</string>
|
||||
<string name="loading">"Caricamento..."</string>
|
||||
<string name="loading">"Caricamento…"</string>
|
||||
<string name="last_values">"Ultimi valori"</string>
|
||||
<string name="latitude">"Latitudine"</string>
|
||||
<string name="longitude">"Longitudine"</string>
|
||||
|
@ -125,6 +125,7 @@
|
|||
<string name="simIDReport">"Report Sim ID"</string>
|
||||
<string name="gpsReport">"Report dati GPS"</string>
|
||||
<string name="memoryReport">"Report memoria disponibile"</string>
|
||||
<string name="taskToReport">Scegli compito di segnalare:</string>
|
||||
<string name="taskReport">"Relazione della task"</string>
|
||||
<string name="uptimeReport">"Report dispositivo Tempo"</string>
|
||||
<string name="NetworkOperatorReport">"Protocollo operativo di rete"</string>
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
<string name="simIDReport">"SIM番号をレポート"</string>
|
||||
<string name="gpsReport">"GPSデータをレポート"</string>
|
||||
<string name="memoryReport">"利用可能メモリをレポート"</string>
|
||||
<string name="taskToReport">報告するには、タスクを選択してください:</string>
|
||||
<string name="taskReport">"タスクをレポート"</string>
|
||||
<string name="uptimeReport">"起動時間をレポート"</string>
|
||||
<string name="NetworkOperatorReport">"ネットワークオペレータをレポート"</string>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="summary">"Configuração atual:"</string>
|
||||
<string name="starStop">"Reiniciar"</string>
|
||||
<string name="gpsLast">"Última posição conhecida"</string>
|
||||
<string name="loading">"A carregar..."</string>
|
||||
<string name="loading">"A carregar…"</string>
|
||||
<string name="last_values">"Os últimos valores"</string>
|
||||
<string name="latitude">"Latitude"</string>
|
||||
<string name="longitude">"Longitude"</string>
|
||||
|
@ -125,6 +125,7 @@
|
|||
<string name="simIDReport">"Relatório Sim ID"</string>
|
||||
<string name="gpsReport">"Relatório de dados GPS"</string>
|
||||
<string name="memoryReport">"Relatório memória disponível"</string>
|
||||
<string name="taskToReport">Escolha tarefa de relatar:</string>
|
||||
<string name="taskReport">"Tarefa de relatório"</string>
|
||||
<string name="uptimeReport">"Relatório dispositivo o tempo"</string>
|
||||
<string name="NetworkOperatorReport">"Relatório operador de rede"</string>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="summary">"配置:"</string>
|
||||
<string name="starStop">"重新启动(Restart)"</string>
|
||||
<string name="gpsLast">"最后已知的位置"</string>
|
||||
<string name="loading">"载入中..."</string>
|
||||
<string name="loading">"载入中…"</string>
|
||||
<string name="last_values">"最后一个值"</string>
|
||||
<string name="latitude">"纬度"</string>
|
||||
<string name="longitude">"经度"</string>
|
||||
|
@ -124,6 +124,7 @@
|
|||
<string name="simIDReport">"报告SIM卡ID"</string>
|
||||
<string name="gpsReport">"报告GPS数据"</string>
|
||||
<string name="memoryReport">"报告可用内存"</string>
|
||||
<string name="taskToReport">選擇任務報告:</string>
|
||||
<string name="taskReport">"报告任务"</string>
|
||||
<string name="uptimeReport">"报告设备的正常运行时间"</string>
|
||||
<string name="NetworkOperatorReport">"报告网络运营商"</string>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<string name="pandroid_agent_copyright">Copyright © 2011 Artica</string>
|
||||
<string name="about_desc">Pandroid Agent logo</string>
|
||||
<string name="help_str">Help</string>
|
||||
<string name="memory_avaliable_str" formatted="false">Avaliable: %iKb Total: %iKb</string>
|
||||
<string name="memory_avaliable_str" formatted="false">Available: %iKb Total: %iKb</string>
|
||||
<string name="never_str">Never.</string>
|
||||
<string name="now_str">Now.</string>
|
||||
<string name="seconds_str">seconds ago.</string>
|
||||
|
@ -60,7 +60,7 @@
|
|||
Pandroid Agent is an Android Pandora FMS agent for Pandora FMS. <p>
|
||||
Pandora FMS is a general purpose monitoring system. With the android agent you can get all sorts of information from your device,
|
||||
the gps location, how much battery is left, available memory on the device, monitoring if a process is active, the time since the device
|
||||
was turned on, a HELLO signal for monitoring installations of the app, an inventory with all the installed apps aswell as information
|
||||
was turned on, a HELLO signal for monitoring installations of the app, an inventory with all the installed apps as well as information
|
||||
for android phones with a sim card; the sim card ID, the number of SMS sent/received, the number of calls incoming/missed/outgoing,
|
||||
the network operator and type, the phone type, the mobile signal strength, the number of bytes sent/received over the mobile network.
|
||||
Complete source code is provided.<p>See more about Pandora FMS at <a href="http://pandorafms.com">http://pandoraFMS.com</a></p>
|
||||
|
@ -116,7 +116,7 @@
|
|||
<string name="password_repeat">Repeat Password</string>
|
||||
<string name="password_choose_text">Do you want to set a password?</string>
|
||||
<string name="password_checkbox">Don\'t ask again</string>
|
||||
<string name="password_created">Password sucessfully created</string>
|
||||
<string name="password_created">Password successfully created</string>
|
||||
<string name="password_removed">No password set</string>
|
||||
<string name="set_password">Create/Change password</string>
|
||||
|
||||
|
@ -133,6 +133,7 @@
|
|||
<string name="simIDReport">Report Sim ID</string>
|
||||
<string name="gpsReport">Report GPS data</string>
|
||||
<string name="memoryReport">Report available memory</string>
|
||||
<string name="taskToReport">Choose task to report:</string>
|
||||
<string name="taskReport">Report task</string>
|
||||
<string name="uptimeReport">Report device up time</string>
|
||||
<string name="NetworkOperatorReport">Report network operator</string>
|
||||
|
|
|
@ -46,14 +46,24 @@ public class Core {
|
|||
static volatile public String defaultServerPort = "41121";
|
||||
static volatile public int defaultInterval = 300;
|
||||
static volatile public String defaultAgentName = "pandroid";
|
||||
static volatile public long defaultBufferSize = 256;
|
||||
static volatile public String defaultmobileWebURL = "firefly.artica.es/pandora_demo/mobile";
|
||||
static volatile public String defaultTaskStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultGpsStatus = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultBatteryLevelReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultMemoryStatus = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultTaskStatus = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultSimIDReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultPasswordCheck = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultDeviceUpTimeReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultInventoryReport = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultHelloSignalReport = "enabled"; // "disabled" or "enabled"
|
||||
//TODO
|
||||
static volatile public String defaultNotificationCheck = "enabled"; // "disabled" or "enabled"
|
||||
|
||||
static volatile public boolean defaultHasSim = false;
|
||||
|
||||
//hasSim values
|
||||
|
||||
static volatile public String defaultSimIDReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultNetworkOperatorReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultNetworkTypeReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultPhoneTypeReport = "enabled"; // "disabled" or "enabled"
|
||||
|
@ -65,11 +75,8 @@ public class Core {
|
|||
static volatile public String defaultOutgoingCallsReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultBytesReceivedReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultBytesSentReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultHelloSignalReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultRoamingReport = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultInventoryReport = "disabled"; // "disabled" or "enabled"
|
||||
static volatile public String defaultNotificationCheck = "enabled"; // "disabled" or "enabled"
|
||||
static volatile public boolean defaultHasSim = false;
|
||||
|
||||
|
||||
// //
|
||||
// DEFAULT MODULE VALUES //
|
||||
|
@ -82,21 +89,23 @@ public class Core {
|
|||
static volatile public long defaultContact = 0;
|
||||
static volatile public int defaultContactError = 0;
|
||||
static volatile public long defaultUpTime = 0;
|
||||
static volatile public int defaultHelloSignal = 2;
|
||||
|
||||
|
||||
//hasSim values
|
||||
static volatile public String defaultSimID = "";
|
||||
static volatile public int defaultSMSReceived = 0;
|
||||
static volatile public int defaultSMSSent = 0;
|
||||
static volatile public String defaultNetworkOperator = "";
|
||||
static volatile public String defaultNetworkType = "";
|
||||
static volatile public String defaultPhoneType = "";
|
||||
static volatile public int defaultSignalStrength = 0;
|
||||
static volatile public int defaultSMSReceived = 0;
|
||||
static volatile public int defaultSMSSent = 0;
|
||||
static volatile public int defaultIncomingCalls = 0;
|
||||
static volatile public int defaultMissedCalls = 0;
|
||||
static volatile public int defaultOutgoingCalls = 0;
|
||||
static volatile public long defaultReceiveBytes = 0;
|
||||
static volatile public long defaultTransmitBytes = 0;
|
||||
static volatile public int defaultHelloSignal = 2;
|
||||
static volatile public int defaultRoaming = 0;
|
||||
static volatile public long defaultBufferSize = 256;
|
||||
|
||||
|
||||
static volatile public String defaultPassword = "";
|
||||
|
@ -114,15 +123,26 @@ public class Core {
|
|||
static volatile public String serverPort = defaultServerPort;
|
||||
static volatile public int interval = defaultInterval;
|
||||
static volatile public String agentName = defaultAgentName;
|
||||
static volatile public long bufferSize = defaultBufferSize;
|
||||
static volatile public String mobileWebURL = defaultmobileWebURL;
|
||||
static volatile public String gpsStatus = defaultGpsStatus;
|
||||
static volatile public String memoryStatus = defaultMemoryStatus;
|
||||
static volatile public String taskStatus = defaultTaskStatus;
|
||||
static volatile public String task = defaultTask;
|
||||
static volatile public String taskHumanName = defaultTaskHumanName;
|
||||
static volatile public String simIDReport = defaultSimIDReport;
|
||||
static volatile public String gpsStatus = defaultGpsStatus;
|
||||
static volatile public String BatteryLevelReport = defaultHelloSignalReport;
|
||||
static volatile public String memoryStatus = defaultMemoryStatus;
|
||||
static volatile public String passwordCheck = defaultPasswordCheck;
|
||||
static volatile public String DeviceUpTimeReport = defaultDeviceUpTimeReport;
|
||||
static volatile public String InventoryReport = defaultRoamingReport;
|
||||
static volatile public String HelloSignalReport = defaultHelloSignalReport;
|
||||
static volatile public String RoamingReport = defaultRoamingReport;
|
||||
//TODO
|
||||
static volatile public String NotificationCheck = defaultNotificationCheck;
|
||||
|
||||
//hasSim values
|
||||
|
||||
static volatile public boolean hasSim = defaultHasSim;
|
||||
static volatile public String simIDReport = defaultSimIDReport;
|
||||
static volatile public String NetworkOperatorReport = defaultNetworkOperatorReport;
|
||||
static volatile public String NetworkTypeReport = defaultNetworkTypeReport;
|
||||
static volatile public String PhoneTypeReport = defaultPhoneTypeReport;
|
||||
|
@ -134,13 +154,6 @@ public class Core {
|
|||
static volatile public String OutgoingCallsReport = defaultOutgoingCallsReport;
|
||||
static volatile public String BytesReceivedReport = defaultBytesReceivedReport;
|
||||
static volatile public String BytesSentReport = defaultBytesSentReport;
|
||||
static volatile public String HelloSignalReport = defaultHelloSignalReport;
|
||||
static volatile public String BatteryLevelReport = defaultHelloSignalReport;
|
||||
static volatile public String RoamingReport = defaultRoamingReport;
|
||||
static volatile public String InventoryReport = defaultRoamingReport;
|
||||
static volatile public String NotificationCheck = defaultNotificationCheck;
|
||||
|
||||
static volatile public boolean hasSim = defaultHasSim;
|
||||
|
||||
static volatile public String password = defaultPassword;
|
||||
|
||||
|
@ -156,8 +169,17 @@ public class Core {
|
|||
static volatile public String taskRun = defaultTaskRun;
|
||||
static volatile public long availableRamKb = defaultRam;
|
||||
static volatile public long totalRamKb = defaultRam;
|
||||
static volatile public String simID = defaultSimID;
|
||||
static volatile public long upTime = defaultUpTime;
|
||||
static volatile public int helloSignal = defaultHelloSignal;
|
||||
static volatile public int roaming = defaultRoaming;
|
||||
|
||||
|
||||
static volatile public long lastContact = CONST_INVALID_CONTACT;
|
||||
static volatile public int contactError = CONST_CONTACT_ERROR;
|
||||
static volatile public String simID = defaultSimID;
|
||||
|
||||
//hasSim values
|
||||
|
||||
static volatile public int SMSReceived = defaultSMSReceived;
|
||||
static volatile public int SMSSent = defaultSMSSent;
|
||||
static volatile public String networkOperator = defaultNetworkOperator;
|
||||
|
@ -169,17 +191,6 @@ public class Core {
|
|||
static volatile public int outgoingCalls = defaultOutgoingCalls;
|
||||
static volatile public long receiveBytes = defaultReceiveBytes;
|
||||
static volatile public long transmitBytes = defaultTransmitBytes;
|
||||
static volatile public int helloSignal = defaultHelloSignal;
|
||||
static volatile public int roaming = defaultRoaming;
|
||||
static volatile public long bufferSize = defaultBufferSize;
|
||||
|
||||
static volatile public long lastContact = CONST_INVALID_CONTACT;
|
||||
static volatile public int contactError = CONST_CONTACT_ERROR;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Core() {
|
||||
|
||||
|
@ -192,6 +203,7 @@ public class Core {
|
|||
loadConf(con);
|
||||
|
||||
Intent intentReceiver = new Intent(con, EventReceiver.class);
|
||||
|
||||
sender = PendingIntent.getBroadcast(con, 0, intentReceiver, 0);
|
||||
|
||||
am = (AlarmManager)con.getSystemService(Context.ALARM_SERVICE);
|
||||
|
@ -221,12 +233,13 @@ public class Core {
|
|||
SharedPreferences agentPreferences = con.getSharedPreferences(
|
||||
con.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
|
||||
latitude = agentPreferences.getFloat("latitude", CONST_INVALID_COORDS);
|
||||
|
||||
lastContact = agentPreferences.getLong("lastContact", defaultContact);
|
||||
latitude = agentPreferences.getFloat("latitude", CONST_INVALID_COORDS);
|
||||
longitude = agentPreferences.getFloat("longitude", CONST_INVALID_COORDS);
|
||||
batteryLevel = agentPreferences.getInt("batteryLevel", CONST_INVALID_BATTERY_LEVEL);
|
||||
orientation = agentPreferences.getFloat("orientation", CONST_INVALID_ORIENTATION);
|
||||
proximity = agentPreferences.getFloat("proximity", CONST_INVALID_PROXIMITY);
|
||||
// orientation = agentPreferences.getFloat("orientation", CONST_INVALID_ORIENTATION);
|
||||
// proximity = agentPreferences.getFloat("proximity", CONST_INVALID_PROXIMITY);
|
||||
taskStatus = agentPreferences.getString("taskStatus", defaultTaskStatus);
|
||||
task = agentPreferences.getString("task", defaultTask);
|
||||
taskHumanName = agentPreferences.getString("taskHumanName", defaultTaskHumanName);
|
||||
|
@ -234,22 +247,26 @@ public class Core {
|
|||
memoryStatus = agentPreferences.getString("memoryStatus", defaultMemoryStatus);
|
||||
availableRamKb = agentPreferences.getLong("availableRamKb", defaultRam);
|
||||
totalRamKb = agentPreferences.getLong("totalRamKb", defaultRam);
|
||||
lastContact = agentPreferences.getLong("lastContact", defaultContact);
|
||||
contactError = agentPreferences.getInt("contactError", defaultContactError);
|
||||
simID = agentPreferences.getString("simID", defaultSimID);
|
||||
upTime = agentPreferences.getLong("upTime", Core.defaultUpTime);
|
||||
SMSReceived = agentPreferences.getInt("SMSReceived", defaultSMSReceived);
|
||||
SMSSent = agentPreferences.getInt("SMSSent", defaultSMSSent);
|
||||
helloSignal = agentPreferences.getInt("helloSignal", defaultHelloSignal);
|
||||
contactError = agentPreferences.getInt("contactError", defaultContactError);
|
||||
|
||||
|
||||
|
||||
//hasSim values
|
||||
|
||||
simID = agentPreferences.getString("simID", defaultSimID);
|
||||
networkOperator = agentPreferences.getString("networkOperator", defaultNetworkOperator);
|
||||
networkType = agentPreferences.getString("networkType", defaultNetworkType);
|
||||
phoneType = agentPreferences.getString("phoneType", defaultPhoneType);
|
||||
signalStrength = agentPreferences.getInt("signalStrength", defaultSignalStrength);
|
||||
SMSReceived = agentPreferences.getInt("SMSReceived", defaultSMSReceived);
|
||||
SMSSent = agentPreferences.getInt("SMSSent", defaultSMSSent);
|
||||
incomingCalls = agentPreferences.getInt("incomingCalls", defaultIncomingCalls);
|
||||
missedCalls = agentPreferences.getInt("missedCalls", defaultMissedCalls);
|
||||
outgoingCalls = agentPreferences.getInt("outgoingCalls", defaultOutgoingCalls);
|
||||
receiveBytes = agentPreferences.getLong("receiveBytes", defaultReceiveBytes);
|
||||
transmitBytes = agentPreferences.getLong("transmitBytes", defaultTransmitBytes);
|
||||
helloSignal = agentPreferences.getInt("helloSignal", defaultHelloSignal);
|
||||
roaming = agentPreferences.getInt("roaming", defaultRoaming);
|
||||
|
||||
}// end loadLastValues
|
||||
|
@ -267,18 +284,27 @@ public class Core {
|
|||
serverPort = agentPreferences.getString("serverPort", defaultServerPort);
|
||||
interval = agentPreferences.getInt("interval", defaultInterval);
|
||||
agentName = agentPreferences.getString("agentName", defaultAgentName+"_"+Installation.id(context));
|
||||
bufferSize = agentPreferences.getLong("bufferSize", defaultBufferSize);
|
||||
mobileWebURL = agentPreferences.getString("mobileWebURL", defaultmobileWebURL);
|
||||
gpsStatus = agentPreferences.getString("gpsStatus", defaultGpsStatus);
|
||||
memoryStatus = agentPreferences.getString("memoryStatus", defaultMemoryStatus);
|
||||
taskStatus = agentPreferences.getString("taskStatus", defaultTaskStatus);
|
||||
task = agentPreferences.getString("task", defaultTask);
|
||||
taskHumanName = agentPreferences.getString("taskHumanName", defaultTaskHumanName);
|
||||
taskRun = agentPreferences.getString("taskRun", defaultTaskRun);
|
||||
password = agentPreferences.getString("password", defaultPassword);
|
||||
passwordCheck = agentPreferences.getString("passwordCheck", defaultPasswordCheck);
|
||||
simIDReport = agentPreferences.getString("simIDReport", defaultSimIDReport);
|
||||
gpsStatus = agentPreferences.getString("gpsStatus", defaultGpsStatus);
|
||||
BatteryLevelReport = agentPreferences.getString("BatteryLevelReport", defaultBatteryLevelReport);
|
||||
memoryStatus = agentPreferences.getString("memoryStatus", defaultMemoryStatus);
|
||||
DeviceUpTimeReport = agentPreferences.getString("DeviceUpTimeReport", defaultDeviceUpTimeReport);
|
||||
NetworkOperatorReport = agentPreferences.getString("NetworkOperatorReport", defaultNetworkOperatorReport);
|
||||
InventoryReport = agentPreferences.getString("InventoryReport", defaultInventoryReport);
|
||||
HelloSignalReport = agentPreferences.getString("HelloSignalReport", defaultHelloSignalReport);
|
||||
password = agentPreferences.getString("password", defaultPassword);
|
||||
passwordCheck = agentPreferences.getString("passwordCheck", defaultPasswordCheck);
|
||||
//TODO
|
||||
NotificationCheck = agentPreferences.getString("NotificationCheck", defaultNotificationCheck);
|
||||
hasSim = agentPreferences.getBoolean("hasSim", defaultHasSim);
|
||||
//hasSim values
|
||||
|
||||
simIDReport = agentPreferences.getString("simIDReport", defaultSimIDReport);
|
||||
NetworkOperatorReport = agentPreferences.getString("NetworkOperatorReport", defaultNetworkOperatorReport);
|
||||
NetworkTypeReport = agentPreferences.getString("NetworkTypeReport", defaultNetworkTypeReport);
|
||||
PhoneTypeReport = agentPreferences.getString("PhoneTypeReport", defaultPhoneTypeReport);
|
||||
SignalStrengthReport = agentPreferences.getString("SignalStrengthReport", defaultSignalStrengthReport);
|
||||
|
@ -289,37 +315,37 @@ public class Core {
|
|||
OutgoingCallsReport = agentPreferences.getString("OutgoingCallsReport", defaultOutgoingCallsReport);
|
||||
BytesReceivedReport = agentPreferences.getString("BytesReceivedReport", defaultBytesReceivedReport);
|
||||
BytesSentReport = agentPreferences.getString("BytesSentReport", defaultBytesSentReport);
|
||||
HelloSignalReport = agentPreferences.getString("HelloSignalReport", defaultHelloSignalReport);
|
||||
BatteryLevelReport = agentPreferences.getString("BatteryLevelReport", defaultBatteryLevelReport);
|
||||
RoamingReport = agentPreferences.getString("RoamingReport", defaultRoamingReport);
|
||||
InventoryReport = agentPreferences.getString("InventoryReport", defaultInventoryReport);
|
||||
NotificationCheck = agentPreferences.getString("NotificationCheck", defaultNotificationCheck);
|
||||
|
||||
|
||||
|
||||
}// end loadConf
|
||||
|
||||
static synchronized public boolean updateConf(Context context) {
|
||||
return updateConf(context, serverAddr, serverPort, interval, agentName,
|
||||
gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, simIDReport, upTime,
|
||||
networkOperator, SMSReceived, SMSSent, networkType, phoneType, signalStrength,
|
||||
incomingCalls, missedCalls, outgoingCalls, receiveBytes, transmitBytes, password, helloSignal,
|
||||
passwordCheck, DeviceUpTimeReport, NetworkOperatorReport, NetworkTypeReport, PhoneTypeReport,
|
||||
SignalStrengthReport, ReceivedSMSReport, SentSMSReport, IncomingCallsReport, MissedCallsReport,
|
||||
OutgoingCallsReport, BytesReceivedReport, BytesSentReport, HelloSignalReport, BatteryLevelReport,
|
||||
RoamingReport, roaming, mobileWebURL, InventoryReport ,NotificationCheck, bufferSize
|
||||
return updateConf(context, serverAddr, serverPort, interval, agentName, bufferSize, mobileWebURL,
|
||||
taskStatus, task, taskHumanName, gpsStatus, BatteryLevelReport, memoryStatus, upTime, DeviceUpTimeReport,
|
||||
InventoryReport, helloSignal, HelloSignalReport, password, passwordCheck, hasSim, simID, simIDReport,
|
||||
networkOperator, NetworkOperatorReport, networkType, NetworkTypeReport, phoneType, PhoneTypeReport,
|
||||
signalStrength, SignalStrengthReport, SMSReceived, ReceivedSMSReport, SMSSent, SentSMSReport,
|
||||
incomingCalls, IncomingCallsReport, missedCalls, MissedCallsReport, outgoingCalls, OutgoingCallsReport,
|
||||
receiveBytes, BytesReceivedReport, transmitBytes, BytesSentReport, RoamingReport, roaming,
|
||||
//TODO
|
||||
NotificationCheck
|
||||
);
|
||||
|
||||
}// end updateConf
|
||||
|
||||
static synchronized 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, String _simIDReport, long _upTime, String _networkOperator,
|
||||
int _smsReceived, int _smsSent, String _networkType, String _phoneType, int _signalStrength,
|
||||
int _incomingCalls, int _missedCalls, int _outgoingCalls, long _receiveBytes, long _transmitBytes,
|
||||
String _password, int _helloSignal, String _passwordCheck, String _DeviceUpTimeReport, String _NetworkOperatorReport,
|
||||
String _NetworkTypeReport, String _PhoneTypeReport, String _SignalStrengthReport, String _ReceivedSMSReport,
|
||||
String _SentSMSReport, String _IncomingCallsReport, String _MissedCallsReport, String _OutgoingCallsReport, String _BytesReceivedReport,
|
||||
String _BytesSentReport, String _HelloSignalReport, String _BatteryLevelReport, String _RoamingReport, int _roaming, String _mobileWebURL,
|
||||
String _InventoryReport, String _NotificationCheck, long _bufferSize) {
|
||||
String _serverPort, int _interval, String _agentName, long _bufferSize, String _mobileWebURL,
|
||||
String _taskStatus, String _task, String _taskHumanName, String _gpsStatus, String _BatteryLevelReport,
|
||||
String _memoryStatus, long _upTime, String _DeviceUpTimeReport, String _InventoryReport, int _helloSignal,
|
||||
String _HelloSignalReport, String _password, String _passwordCheck, boolean _hasSim, String _simID, String _simIDReport,
|
||||
String _networkOperator, String _NetworkOperatorReport, String _networkType, String _NetworkTypeReport, String _phoneType,
|
||||
String _PhoneTypeReport, int _signalStrength, String _SignalStrengthReport, int _smsReceived, String _ReceivedSMSReport,
|
||||
int _smsSent, String _SentSMSReport, int _incomingCalls, String _IncomingCallsReport, int _missedCalls, String _MissedCallsReport,
|
||||
int _outgoingCalls, String _OutgoingCallsReport, long _receiveBytes, String _BytesReceivedReport, long _transmitBytes,
|
||||
String _BytesSentReport, String _RoamingReport, int _roaming,
|
||||
String _NotificationCheck ) {
|
||||
|
||||
if (con == null) {
|
||||
con = context;
|
||||
|
@ -334,48 +360,54 @@ public class Core {
|
|||
editor.putString("serverPort", _serverPort);
|
||||
editor.putInt("interval", _interval);
|
||||
editor.putString("agentName", _agentName);
|
||||
editor.putString("gpsStatus", _gpsStatus);
|
||||
editor.putString("memoryStatus", _memoryStatus);
|
||||
editor.putLong("bufferSize", _bufferSize);
|
||||
editor.putString("mobileWebURL", _mobileWebURL);
|
||||
editor.putString("taskStatus", _taskStatus);
|
||||
editor.putString("task", _task);
|
||||
editor.putString("taskHumanName", _taskHumanName);
|
||||
editor.putString("simID", _simID);
|
||||
editor.putString("simIDReport", _simIDReport);
|
||||
editor.putString("gpsStatus", _gpsStatus);
|
||||
editor.putString("BatteryLevelReport", _BatteryLevelReport);
|
||||
editor.putString("memoryStatus", _memoryStatus);
|
||||
//TODO
|
||||
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.putInt("signalStrength", _signalStrength);
|
||||
editor.putInt("incomingCalls", _incomingCalls);
|
||||
editor.putInt("missedCalls", _missedCalls);
|
||||
editor.putInt("outgoingCalls", _outgoingCalls);
|
||||
editor.putLong("receiveBytes", _receiveBytes);
|
||||
editor.putLong("transmitBytes", _transmitBytes);
|
||||
editor.putString("DeviceUpTimeReport", _DeviceUpTimeReport);
|
||||
editor.putString("InventoryReport", _InventoryReport);
|
||||
editor.putInt("helloSignal", _helloSignal);
|
||||
editor.putString("HelloSignalReport", _HelloSignalReport);
|
||||
editor.putString("password", _password);
|
||||
editor.putString("passwordCheck", _passwordCheck);
|
||||
editor.putInt("helloSignal", _helloSignal);
|
||||
editor.putInt("roaming", _roaming);
|
||||
editor.putString("DeviceUpTimeReport", _DeviceUpTimeReport);
|
||||
editor.putBoolean("hasSim", _hasSim);
|
||||
|
||||
//hasSim values
|
||||
editor.putString("simID", _simID);
|
||||
editor.putString("simIDReport", _simIDReport);
|
||||
editor.putString("networkOperator", _networkOperator);
|
||||
editor.putString("NetworkOperatorReport", _NetworkOperatorReport);
|
||||
editor.putString("networkType", _networkType);
|
||||
editor.putString("NetworkTypeReport", _NetworkTypeReport);
|
||||
editor.putString("phoneType", _phoneType);
|
||||
editor.putString("PhoneTypeReport", _PhoneTypeReport);
|
||||
editor.putInt("signalStrength", _signalStrength);
|
||||
editor.putString("SignalStrengthReport", _SignalStrengthReport);
|
||||
editor.putInt("SMSReceived", _smsReceived);
|
||||
editor.putString("ReceivedSMSReport", _ReceivedSMSReport);
|
||||
editor.putInt("SMSSent", _smsSent);
|
||||
editor.putString("SentSMSReport", _SentSMSReport);
|
||||
editor.putInt("incomingCalls", _incomingCalls);
|
||||
editor.putString("IncomingCallsReport", _IncomingCallsReport);
|
||||
editor.putInt("missedCalls", _missedCalls);
|
||||
editor.putString("MissedCallsReport", _MissedCallsReport);
|
||||
editor.putInt("outgoingCalls", _outgoingCalls);
|
||||
editor.putString("OutgoingCallsReport", _OutgoingCallsReport);
|
||||
editor.putLong("receiveBytes", _receiveBytes);
|
||||
editor.putString("BytesReceivedReport", _BytesReceivedReport);
|
||||
editor.putLong("transmitBytes", _transmitBytes);
|
||||
editor.putString("BytesSentReport", _BytesSentReport);
|
||||
editor.putString("HelloSignalReport", _HelloSignalReport);
|
||||
editor.putString("BatteryLevelReport", _BatteryLevelReport);
|
||||
editor.putString("RoamingReport", _RoamingReport);
|
||||
editor.putString("InventoryReport", _InventoryReport);
|
||||
editor.putInt("roaming", _roaming);
|
||||
//TODO
|
||||
editor.putString("NotificationCheck", _NotificationCheck);
|
||||
editor.putString("mobileWebURL", _mobileWebURL);
|
||||
editor.putLong("bufferSize", _bufferSize);
|
||||
|
||||
|
||||
if (editor.commit()) {
|
||||
return true;
|
||||
|
@ -385,8 +417,8 @@ public class Core {
|
|||
|
||||
|
||||
public synchronized static void putSharedData(String preferenceName, String tokenName, String data, String type) {
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
SharedPreferences agentPreferences = con.getSharedPreferences(
|
||||
|
||||
SharedPreferences agentPreferences = con.getSharedPreferences(
|
||||
con.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = agentPreferences.edit();
|
||||
|
@ -412,8 +444,8 @@ public class Core {
|
|||
}
|
||||
|
||||
public synchronized static String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
SharedPreferences agentPreferences = con.getSharedPreferences(
|
||||
|
||||
SharedPreferences agentPreferences = con.getSharedPreferences(
|
||||
con.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
|
||||
|
@ -440,168 +472,4 @@ public class Core {
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
// //database//
|
||||
//
|
||||
// static synchronized public void loadLastValuesDatabase(Context context) {
|
||||
// if (con == null) {
|
||||
// con = context;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// latitude = Float.parseFloat(getDatabaseValue(con, "latitude"));
|
||||
// longitude = Float.parseFloat(getDatabaseValue(con, "longitude"));
|
||||
// batteryLevel = Integer.parseInt(getDatabaseValue(con, "batteryLevel"));
|
||||
// orientation = Float.parseFloat(getDatabaseValue(con, "orientation"));
|
||||
// proximity = Float.parseFloat(getDatabaseValue(con, "proximity"));
|
||||
// taskStatus = getDatabaseValue(con, "taskStatus");
|
||||
// task = getDatabaseValue(con, "task");
|
||||
// taskHumanName = getDatabaseValue(con, "taskHumanName");
|
||||
// taskRun = getDatabaseValue(con, "taskRun");
|
||||
// memoryStatus = getDatabaseValue(con, "memoryStatus");
|
||||
// availableRamKb = Long.parseLong(getDatabaseValue(con, "availableRamKb"));
|
||||
// totalRamKb = Long.parseLong(getDatabaseValue(con, "totalRamKb"));
|
||||
// lastContact = Long.parseLong(getDatabaseValue(con, "lastContact"));
|
||||
// contactError = Integer.parseInt(getDatabaseValue(con, "contactError"));
|
||||
// simID = getDatabaseValue(con, "simID");
|
||||
// upTime = Long.parseLong(getDatabaseValue(con, "upTime"));
|
||||
// SMSReceived = Integer.parseInt(getDatabaseValue(con, "SMSReceived"));
|
||||
// SMSSent = Integer.parseInt(getDatabaseValue(con, "SMSSent"));
|
||||
// networkOperator = getDatabaseValue(con, "networkOperator");
|
||||
// networkType = getDatabaseValue(con, "networkType");
|
||||
// phoneType = getDatabaseValue(con, "phoneType");
|
||||
// signalStrength = Integer.parseInt(getDatabaseValue(con, "signalStrength"));
|
||||
// incomingCalls = Integer.parseInt(getDatabaseValue(con, "incomingCalls"));
|
||||
// missedCalls = Integer.parseInt(getDatabaseValue(con, "missedCalls"));
|
||||
// outgoingCalls = Integer.parseInt(getDatabaseValue(con, "outgoingCalls"));
|
||||
// receiveBytes = Long.parseLong(getDatabaseValue(con, "receiveBytes"));
|
||||
// transmitBytes = Long.parseLong(getDatabaseValue(con, "transmitBytes"));
|
||||
// helloSignal = Integer.parseInt(getDatabaseValue(con, "helloSignal"));
|
||||
// roaming = Integer.parseInt(getDatabaseValue(con, "roaming"));
|
||||
//
|
||||
// }// end loadLastValues
|
||||
//
|
||||
// static synchronized public void loadConfDatabase(Context context) {
|
||||
// if (con == null) {
|
||||
// con = context;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// serverAddr = getDatabaseValue(con, "serverAddr");
|
||||
// serverPort = getDatabaseValue(con, "serverPort");
|
||||
// interval = Integer.parseInt(getDatabaseValue(con, "interval"));
|
||||
// agentName = getDatabaseValue(con, "agentName");
|
||||
// mobileWebURL = getDatabaseValue(con, "mobileWebURL");
|
||||
// gpsStatus = getDatabaseValue(con, "gpsStatus");
|
||||
// memoryStatus = getDatabaseValue(con, "memoryStatus");
|
||||
// taskStatus = getDatabaseValue(con, "taskStatus");
|
||||
// task = getDatabaseValue(con, "task");
|
||||
// taskHumanName = getDatabaseValue(con, "taskHumanName");
|
||||
// taskRun = getDatabaseValue(con, "taskRun");
|
||||
// password = getDatabaseValue(con, "password");
|
||||
// passwordCheck = getDatabaseValue(con, "passwordCheck");
|
||||
// simIDReport = getDatabaseValue(con, "simIDReport");
|
||||
// DeviceUpTimeReport = getDatabaseValue(con, "DeviceUpTimeReport");
|
||||
// NetworkOperatorReport = getDatabaseValue(con, "NetworkOperatorReport");
|
||||
// NetworkTypeReport = getDatabaseValue(con, "NetworkTypeReport");
|
||||
// PhoneTypeReport = getDatabaseValue(con, "PhoneTypeReport");
|
||||
// SignalStrengthReport = getDatabaseValue(con, "SignalStrengthReport");
|
||||
// ReceivedSMSReport = getDatabaseValue(con, "ReceivedSMSReport");
|
||||
// SentSMSReport = getDatabaseValue(con, "SentSMSReport");
|
||||
// IncomingCallsReport = getDatabaseValue(con, "IncomingCallsReport");
|
||||
// MissedCallsReport = getDatabaseValue(con, "MissedCallsReport");
|
||||
// OutgoingCallsReport = getDatabaseValue(con, "OutgoingCallsReport");
|
||||
// BytesReceivedReport = getDatabaseValue(con, "BytesReceivedReport");
|
||||
// BytesSentReport = getDatabaseValue(con, "BytesSentReport");
|
||||
// HelloSignalReport = getDatabaseValue(con, "HelloSignalReport");
|
||||
// BatteryLevelReport = getDatabaseValue(con, "BatteryLevelReport");
|
||||
// RoamingReport = getDatabaseValue(con, "RoamingReport");
|
||||
// InventoryReport = getDatabaseValue(con, "InventoryReport");
|
||||
// NotificationCheck = getDatabaseValue(con, "NotificationCheck");
|
||||
// }// end loadConf
|
||||
//
|
||||
// static synchronized public boolean updateDatabase(Context context) {
|
||||
// return updateDatabase(context, serverAddr, serverPort, interval, agentName,
|
||||
// gpsStatus, memoryStatus, taskStatus, task, taskHumanName, simID, simIDReport, upTime,
|
||||
// networkOperator, SMSReceived, SMSSent, networkType, phoneType, signalStrength,
|
||||
// incomingCalls, missedCalls, outgoingCalls, receiveBytes, transmitBytes, password, helloSignal,
|
||||
// passwordCheck, DeviceUpTimeReport, NetworkOperatorReport, NetworkTypeReport, PhoneTypeReport,
|
||||
// SignalStrengthReport, ReceivedSMSReport, SentSMSReport, IncomingCallsReport, MissedCallsReport,
|
||||
// OutgoingCallsReport, BytesReceivedReport, BytesSentReport, HelloSignalReport, BatteryLevelReport,
|
||||
// RoamingReport, roaming, mobileWebURL, InventoryReport , NotificationCheck
|
||||
// );
|
||||
//
|
||||
// }// end updateConf
|
||||
//
|
||||
// static synchronized public boolean updateDatabase(Context context, String _serverAddr,
|
||||
// String _serverPort, int _interval, String _agentName, String _gpsStatus,
|
||||
// String _memoryStatus, String _taskStatus, String _task,
|
||||
// String _taskHumanName, String _simID, String _simIDReport, long _upTime, String _networkOperator,
|
||||
// int _smsReceived, int _smsSent, String _networkType, String _phoneType, int _signalStrength,
|
||||
// int _incomingCalls, int _missedCalls, int _outgoingCalls, long _receiveBytes, long _transmitBytes,
|
||||
// String _password, int _helloSignal, String _passwordCheck, String _DeviceUpTimeReport, String _NetworkOperatorReport,
|
||||
// String _NetworkTypeReport, String _PhoneTypeReport, String _SignalStrengthReport, String _ReceivedSMSReport,
|
||||
// String _SentSMSReport, String _IncomingCallsReport, String _MissedCallsReport, String _OutgoingCallsReport, String _BytesReceivedReport,
|
||||
// String _BytesSentReport, String _HelloSignalReport, String _BatteryLevelReport, String _RoamingReport, int _roaming, String _mobileWebURL,
|
||||
// String _InventoryReport, String _NotificationCheck) {
|
||||
//
|
||||
// if (con == null) {
|
||||
// con = context;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// updateDatabaseValue(con,"serverAddr", _serverAddr);
|
||||
// updateDatabaseValue(con,"serverPort", _serverPort);
|
||||
// updateDatabaseValue(con,"interval", ""+_interval);
|
||||
// updateDatabaseValue(con,"agentName", _agentName);
|
||||
// updateDatabaseValue(con,"gpsStatus", _gpsStatus);
|
||||
// updateDatabaseValue(con,"memoryStatus", _memoryStatus);
|
||||
// updateDatabaseValue(con,"taskStatus", _taskStatus);
|
||||
// updateDatabaseValue(con,"task", _task);
|
||||
// updateDatabaseValue(con,"taskHumanName", _taskHumanName);
|
||||
// updateDatabaseValue(con,"simID", _simID);
|
||||
// updateDatabaseValue(con,"simIDReport", _simIDReport);
|
||||
// updateDatabaseValue(con,"upTime", ""+_upTime);
|
||||
// updateDatabaseValue(con,"networkOperator", _networkOperator);
|
||||
// updateDatabaseValue(con,"SMSReceived", ""+_smsReceived);
|
||||
// updateDatabaseValue(con,"SMSSent", ""+_smsSent);
|
||||
// updateDatabaseValue(con,"networkType", _networkType);
|
||||
// updateDatabaseValue(con,"phoneType", _phoneType);
|
||||
// updateDatabaseValue(con,"signalStrength", ""+_signalStrength);
|
||||
// updateDatabaseValue(con,"incomingCalls", ""+_incomingCalls);
|
||||
// updateDatabaseValue(con,"missedCalls", ""+_missedCalls);
|
||||
// updateDatabaseValue(con,"outgoingCalls", ""+_outgoingCalls);
|
||||
// updateDatabaseValue(con,"receiveBytes", ""+_receiveBytes);
|
||||
// updateDatabaseValue(con,"transmitBytes", ""+_transmitBytes);
|
||||
// updateDatabaseValue(con,"password", _password);
|
||||
// updateDatabaseValue(con,"passwordCheck", _passwordCheck);
|
||||
// updateDatabaseValue(con,"helloSignal", ""+_helloSignal);
|
||||
// updateDatabaseValue(con,"roaming", ""+_roaming);
|
||||
// updateDatabaseValue(con,"DeviceUpTimeReport", _DeviceUpTimeReport);
|
||||
// updateDatabaseValue(con,"NetworkOperatorReport", _NetworkOperatorReport);
|
||||
// updateDatabaseValue(con,"NetworkTypeReport", _NetworkTypeReport);
|
||||
// updateDatabaseValue(con,"PhoneTypeReport", _PhoneTypeReport);
|
||||
// updateDatabaseValue(con,"SignalStrengthReport", _SignalStrengthReport);
|
||||
// updateDatabaseValue(con,"ReceivedSMSReport", _ReceivedSMSReport);
|
||||
// updateDatabaseValue(con,"SentSMSReport", _SentSMSReport);
|
||||
// updateDatabaseValue(con,"IncomingCallsReport", _IncomingCallsReport);
|
||||
// updateDatabaseValue(con,"MissedCallsReport", _MissedCallsReport);
|
||||
// updateDatabaseValue(con,"OutgoingCallsReport", _OutgoingCallsReport);
|
||||
// updateDatabaseValue(con,"BytesReceivedReport", _BytesReceivedReport);
|
||||
// updateDatabaseValue(con,"BytesSentReport", _BytesSentReport);
|
||||
// updateDatabaseValue(con,"HelloSignalReport", _HelloSignalReport);
|
||||
// updateDatabaseValue(con,"BatteryLevelReport", _BatteryLevelReport);
|
||||
// updateDatabaseValue(con,"RoamingReport", _RoamingReport);
|
||||
// updateDatabaseValue(con,"InventoryReport", _InventoryReport);
|
||||
// updateDatabaseValue(con,"NotificationCheck", _NotificationCheck);
|
||||
// updateDatabaseValue(con,"mobileWebURL", _mobileWebURL);
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// }// end updateConf
|
||||
//
|
||||
|
||||
}
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
package pandroid.agent;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import com.readystatesoftware.sqliteasset.SQLiteAssetHelper;
|
||||
|
||||
public class DataBaseHandler extends SQLiteAssetHelper {
|
||||
|
||||
private static final String DATABASE_NAME = "pandroid";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
// Contacts table name
|
||||
private static final String TABLE_NAME = "PANDROID_DATA";
|
||||
|
||||
// Contacts Table Columns names
|
||||
private static final String KEY_ID = "_ID";
|
||||
private static final String KEY_NAME = "NAME";
|
||||
private static final String KEY_VALUE = "VALUE";
|
||||
|
||||
public DataBaseHandler(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
|
||||
// you can use an alternate constructor to specify a database location
|
||||
// (such as a folder on the sd card)
|
||||
// you must ensure that this folder is available and you have permission
|
||||
// to write to it
|
||||
//super(context, DATABASE_NAME, context.getExternalFilesDir(null).getAbsolutePath(), null, DATABASE_VERSION);
|
||||
|
||||
}
|
||||
|
||||
// Update single value
|
||||
public int updateValue(DataHandler dh){
|
||||
int i = 0;
|
||||
|
||||
try {
|
||||
SQLiteDatabase db = this.getWritableDatabase();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(KEY_NAME, dh.get_name());
|
||||
values.put(KEY_VALUE, dh.get_value());
|
||||
|
||||
// updating row
|
||||
i = db.update(TABLE_NAME, values, KEY_ID + " = ?",
|
||||
new String[] { String.valueOf(dh.get_id())});
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// Getting single contact
|
||||
DataHandler getValue(String value) {
|
||||
DataHandler dh = null;
|
||||
try {
|
||||
SQLiteDatabase db = this.getReadableDatabase();
|
||||
|
||||
|
||||
Cursor cursor = db.query(TABLE_NAME, new String[] { KEY_ID,
|
||||
KEY_NAME, KEY_VALUE }, KEY_NAME + "=?",
|
||||
new String[] { value }, null, null, null, null);
|
||||
if (cursor != null){
|
||||
cursor.moveToFirst();
|
||||
|
||||
|
||||
dh = new DataHandler(
|
||||
cursor.getString(1), cursor.getString(2));
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package pandroid.agent;
|
||||
|
||||
public class DataHandler {
|
||||
int _id;
|
||||
String _name;
|
||||
String _value;
|
||||
|
||||
public DataHandler(){
|
||||
|
||||
}
|
||||
|
||||
public DataHandler(String name, String value){
|
||||
this._name = name;
|
||||
this._value = value;
|
||||
}
|
||||
|
||||
public DataHandler(int id, String name, String value){
|
||||
this._id = id;
|
||||
this._name = name;
|
||||
this._value = value;
|
||||
}
|
||||
|
||||
public int get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public void set_id(int _id) {
|
||||
this._id = _id;
|
||||
}
|
||||
|
||||
public String get_name() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public void set_name(String _name) {
|
||||
this._name = _name;
|
||||
}
|
||||
|
||||
public String get_value() {
|
||||
return _value;
|
||||
}
|
||||
|
||||
public void set_value(String _value) {
|
||||
this._value = _value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
package pandroid.agent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class HelperSharedPreferences {
|
||||
|
||||
|
||||
public static class SharedPreferencesKeys{
|
||||
public static final String key1="key1";
|
||||
public static final String key2="key2";
|
||||
}
|
||||
|
||||
// public static void putSharedPreferencesInt(Context context, String key, int value){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Editor edit=preferences.edit();
|
||||
// edit.putInt(key, value);
|
||||
// edit.commit();
|
||||
// }
|
||||
//
|
||||
// public static void putSharedPreferencesBoolean(Context context, String key, boolean val){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Editor edit=preferences.edit();
|
||||
// edit.putBoolean(key, val);
|
||||
// edit.commit();
|
||||
// }
|
||||
//
|
||||
// public static void putSharedPreferencesString(Context context, String key, String val){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Editor edit=preferences.edit();
|
||||
// edit.putString(key, val);
|
||||
// edit.commit();
|
||||
// }
|
||||
//
|
||||
// public static void putSharedPreferencesFloat(Context context, String key, float val){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Editor edit=preferences.edit();
|
||||
// edit.putFloat(key, val);
|
||||
// edit.commit();
|
||||
// }
|
||||
//
|
||||
// public static void putSharedPreferencesLong(Context context, String key, long val){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// Editor edit=preferences.edit();
|
||||
// edit.putLong(key, val);
|
||||
// edit.commit();
|
||||
// }
|
||||
//
|
||||
// public static int getSharedPreferencesInt(Context context, String key, int _default){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// return preferences.getInt(key, _default);
|
||||
// }
|
||||
//
|
||||
// public static long getSharedPreferencesLong(Context context, String key, long _default){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// return preferences.getLong(key, _default);
|
||||
// }
|
||||
//
|
||||
// public static float getSharedPreferencesFloat(Context context, String key, float _default){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// return preferences.getFloat(key, _default);
|
||||
// }
|
||||
//
|
||||
// public static String getSharedPreferencesString(Context context, String key, String _default){
|
||||
// SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
|
||||
// return preferences.getString(key, _default);
|
||||
// }
|
||||
|
||||
public synchronized static void putSharedPreferencesInt(Context context, String name, int value){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
int id = getDataHandler(context, name).get_id();
|
||||
|
||||
DataHandler dh = new DataHandler(id, name, ""+value);
|
||||
|
||||
db.updateValue(dh);
|
||||
}
|
||||
|
||||
public synchronized static void putSharedPreferencesLong(Context context, String name, long value){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
int id = getDataHandler(context, name).get_id();
|
||||
|
||||
DataHandler dh = new DataHandler(id, name, ""+value);
|
||||
|
||||
db.updateValue(dh);
|
||||
}
|
||||
|
||||
public synchronized static void putSharedPreferencesFloat(Context context, String name, float value){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
int id = getDataHandler(context, name).get_id();
|
||||
|
||||
DataHandler dh = new DataHandler(id, name, ""+value);
|
||||
|
||||
db.updateValue(dh);
|
||||
}
|
||||
|
||||
public synchronized static void putSharedPreferencesString(Context context, String name, String value){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
int id = getDataHandler(context, name).get_id();
|
||||
|
||||
DataHandler dh = new DataHandler(id, name, value);
|
||||
|
||||
db.updateValue(dh);
|
||||
}
|
||||
|
||||
public synchronized static int getSharedPreferencesInt(Context context, String name, int i){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
return Integer.parseInt(db.getValue(name).get_value());
|
||||
}
|
||||
|
||||
public synchronized static long getSharedPreferencesLong(Context context, String name, long l){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
return Long.parseLong(db.getValue(name).get_value());
|
||||
}
|
||||
|
||||
public synchronized static float getSharedPreferencesFloat(Context context, String name, float f){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
return Float.parseFloat(db.getValue(name).get_value());
|
||||
}
|
||||
|
||||
public synchronized static String getSharedPreferencesString(Context context, String name, String s){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
return db.getValue(name).get_value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Returns the DataHandler object of the given row "name"
|
||||
public static synchronized DataHandler getDataHandler(Context context, String name){
|
||||
DataBaseHandler db = new DataBaseHandler(context);
|
||||
|
||||
return db.getValue(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -26,10 +26,6 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.widget.TabHost;
|
||||
//import android.app.Dialog;
|
||||
//import android.util.Log;
|
||||
//import android.view.WindowManager.LayoutParams;
|
||||
|
||||
|
||||
|
||||
public class PandroidAgent extends TabActivity {
|
||||
|
@ -38,26 +34,11 @@ public class PandroidAgent extends TabActivity {
|
|||
int defaultInterval = 300;
|
||||
TabHost tabHost;
|
||||
|
||||
static SharedPreferences agentPreferences;
|
||||
static Editor editor;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//database//
|
||||
|
||||
|
||||
agentPreferences = this.getSharedPreferences(
|
||||
this.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
|
||||
editor = agentPreferences.edit();
|
||||
|
||||
//Core.loadConfDatabase(this);
|
||||
//Core.loadLastValuesDatabase(this);
|
||||
//Core.updateConf(this);
|
||||
|
||||
/*
|
||||
final Dialog dialog = new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
||||
|
@ -130,6 +111,7 @@ public class PandroidAgent extends TabActivity {
|
|||
//Core.updateDatabase(this);
|
||||
|
||||
}
|
||||
|
||||
//Sets hello signal to 1(first connect since pandroid was closed)
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
@ -143,16 +125,5 @@ public class PandroidAgent extends TabActivity {
|
|||
public void switchTab(int tab){
|
||||
tabHost.setCurrentTab(tab);
|
||||
}
|
||||
|
||||
public static SharedPreferences getSharedPrefs() {
|
||||
// TODO Auto-generated method stub
|
||||
return agentPreferences;
|
||||
}
|
||||
|
||||
public static Editor getEditor() {
|
||||
// TODO Auto-generated method stub
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -26,6 +26,7 @@ import java.util.concurrent.ExecutionException;
|
|||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManager.MemoryInfo;
|
||||
import android.app.ActivityManager.RunningAppProcessInfo;
|
||||
|
@ -36,6 +37,8 @@ import android.app.Service;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
|
@ -62,7 +65,6 @@ import android.widget.Toast;
|
|||
|
||||
public class PandroidAgentListener extends Service {
|
||||
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
Handler h = new Handler();
|
||||
String lastGpsContactDateTime = "";
|
||||
|
@ -71,63 +73,69 @@ public class PandroidAgentListener extends Service {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
|
||||
try {
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
} catch (Exception e) {
|
||||
Log.e("notification", e.toString());
|
||||
}
|
||||
|
||||
if(Core.NotificationCheck == "enabled"){
|
||||
|
||||
Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
|
||||
System.currentTimeMillis());
|
||||
Intent notificationIntent = new Intent(this,PandroidAgent.class);
|
||||
notificationIntent.setAction("android.intent.action.MAIN");
|
||||
notificationIntent.addCategory("android.intent.category.LAUNCHER");
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, Notification.FLAG_NO_CLEAR);
|
||||
notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
|
||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
notificationManager.notify(1, notification);
|
||||
}
|
||||
else{
|
||||
CancelNotification(getApplicationContext(),1);
|
||||
}
|
||||
// try {
|
||||
// notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// } catch (Exception e) {
|
||||
// Log.e("notification", e.toString());
|
||||
// }
|
||||
//
|
||||
// if(Core.NotificationCheck == "enabled"){
|
||||
//
|
||||
// Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
|
||||
// System.currentTimeMillis());
|
||||
// Intent notificationIntent = new Intent(this,PandroidAgent.class);
|
||||
// notificationIntent.setAction("android.intent.action.MAIN");
|
||||
// notificationIntent.addCategory("android.intent.category.LAUNCHER");
|
||||
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, Notification.FLAG_NO_CLEAR);
|
||||
// notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
|
||||
// notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
// notificationManager.notify(1, notification);
|
||||
// }
|
||||
// else{
|
||||
// CancelNotification(getApplicationContext(),42);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakeLock");
|
||||
wakeLock.acquire();
|
||||
Core.loadConf(this);
|
||||
updateValues();
|
||||
contact();
|
||||
|
||||
try {
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
|
||||
System.currentTimeMillis());
|
||||
Intent notificationIntent = new Intent(this,PandroidAgent.class);
|
||||
notificationIntent.setAction("android.intent.action.MAIN");
|
||||
notificationIntent.addCategory("android.intent.category.LAUNCHER");
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, Notification.FLAG_NO_CLEAR);
|
||||
notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
|
||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
|
||||
|
||||
if(Core.NotificationCheck == "enabled"){
|
||||
CancelNotification(getApplicationContext(),42);
|
||||
notificationManager.notify(42, notification);
|
||||
}
|
||||
else{
|
||||
CancelNotification(getApplicationContext(),42);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e("notification", e.toString());
|
||||
}
|
||||
|
||||
Notification notification = new Notification(R.drawable.icon, getText(R.string.ticker_text),
|
||||
System.currentTimeMillis());
|
||||
Intent notificationIntent = new Intent(this,PandroidAgent.class);
|
||||
notificationIntent.setAction("android.intent.action.MAIN");
|
||||
notificationIntent.addCategory("android.intent.category.LAUNCHER");
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, Notification.FLAG_NO_CLEAR);
|
||||
notification.setLatestEventInfo(this, getText(R.string.notification_title), getText(R.string.notification_message), pendingIntent);
|
||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
|
||||
if(Core.NotificationCheck == "enabled"){
|
||||
notificationManager.notify(1, notification);
|
||||
finally{
|
||||
wakeLock.release();
|
||||
}
|
||||
else{
|
||||
CancelNotification(getApplicationContext(),1);
|
||||
}
|
||||
|
||||
startForeground(42,notification);
|
||||
|
||||
wakeLock.release();
|
||||
stopSelf(startId);
|
||||
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
@ -142,14 +150,14 @@ public class PandroidAgentListener extends Service {
|
|||
// private void contact(){
|
||||
// Date date = new Date();
|
||||
//
|
||||
// Core.putSharedData("PANDROID_DATA", "contactError", "0", "integer");
|
||||
// Core.putSharedData("PANDROID_DATA", "lastContact", Long.toString(date.getTime() / 1000), "long");
|
||||
// putSharedData("PANDROID_DATA", "contactError", "0", "integer");
|
||||
// putSharedData("PANDROID_DATA", "lastContact", Long.toString(date.getTime() / 1000), "long");
|
||||
//
|
||||
// // Keep lastXML sended if is not empty (empty means error sending it)
|
||||
// String lastXML = buildXML();
|
||||
//
|
||||
//
|
||||
// String agentName = Core.getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
// String agentName = getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
//
|
||||
// String destFileName = agentName + "." + System.currentTimeMillis() + ".data";
|
||||
//
|
||||
|
@ -157,7 +165,7 @@ public class PandroidAgentListener extends Service {
|
|||
//
|
||||
// String[] tentacleData = {
|
||||
// "-a",
|
||||
// Core.getSharedData("PANDROID_DATA", "serverAddr", "", "string"),
|
||||
// getSharedData("PANDROID_DATA", "serverAddr", "", "string"),
|
||||
// "-p",
|
||||
// Core.defaultServerPort,
|
||||
// "-v",
|
||||
|
@ -171,13 +179,13 @@ public class PandroidAgentListener extends Service {
|
|||
// file.delete();
|
||||
//
|
||||
// if(tentacleRet == 0) {
|
||||
// Core.putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
// putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
// if (Core.helloSignal >= 1)
|
||||
// Core.helloSignal = 0;
|
||||
// Core.updateConf(getApplicationContext());
|
||||
// }
|
||||
// else {
|
||||
// Core.putSharedData("PANDROID_DATA", "contactError", "1", "integer");
|
||||
// putSharedData("PANDROID_DATA", "contactError", "1", "integer");
|
||||
// }
|
||||
//
|
||||
// updateValues();
|
||||
|
@ -199,7 +207,7 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
Date date = new Date();
|
||||
|
||||
Core.putSharedData("PANDROID_DATA", "lastContact", Long.toString(date.getTime() / 1000), "long");
|
||||
putSharedData("PANDROID_DATA", "lastContact", Long.toString(date.getTime() / 1000), "long");
|
||||
Boolean xmlBuilt = true;
|
||||
String xml = "";
|
||||
|
||||
|
@ -213,9 +221,8 @@ public class PandroidAgentListener extends Service {
|
|||
xmlBuilt = false;
|
||||
}
|
||||
|
||||
new contactTask().execute(xml);
|
||||
|
||||
|
||||
new contactTask().execute(xml);
|
||||
updateValues();
|
||||
|
||||
}//end contact
|
||||
|
@ -233,14 +240,10 @@ public class PandroidAgentListener extends Service {
|
|||
protected Integer doInBackground(String... lastXML) {
|
||||
|
||||
|
||||
//Check for files
|
||||
|
||||
String[] buffer = getApplicationContext().fileList();
|
||||
// for(int i = 0; i<buffer.length; i++){
|
||||
// Log.d("buffer", buffer[i]);
|
||||
// }
|
||||
Integer tentacleRet = null;
|
||||
//files in buffer
|
||||
|
||||
|
||||
boolean contact = true;
|
||||
int i = 1;
|
||||
while(getApplicationContext().fileList().length > 1 && contact) {
|
||||
|
@ -249,7 +252,7 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
String[] tentacleData = {
|
||||
"-a",
|
||||
Core.getSharedData("PANDROID_DATA", "serverAddr", "", "string"),
|
||||
getSharedData("PANDROID_DATA", "serverAddr", "", "string"),
|
||||
"-p",
|
||||
Core.defaultServerPort,
|
||||
"-v",
|
||||
|
@ -260,7 +263,7 @@ public class PandroidAgentListener extends Service {
|
|||
tentacleRet = new tentacle_client().tentacle_client(tentacleData);
|
||||
|
||||
if(tentacleRet == 0) {
|
||||
Core.putSharedData("PANDROID_DATA", "contactError", "0", "integer");
|
||||
putSharedData("PANDROID_DATA", "contactError", "0", "integer");
|
||||
// Deleting the file after send it
|
||||
// move to only delete if sent successfully
|
||||
File file = new File("/data/data/pandroid.agent/files/" + destFileName);
|
||||
|
@ -272,7 +275,7 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
if(tentacleRet == -1){
|
||||
//file not deleted
|
||||
Core.putSharedData("PANDROID_DATA", "contactError", "1", "integer");
|
||||
putSharedData("PANDROID_DATA", "contactError", "1", "integer");
|
||||
contact = false;
|
||||
}
|
||||
i++;
|
||||
|
@ -294,7 +297,7 @@ public class PandroidAgentListener extends Service {
|
|||
String lastXML = buildXML();
|
||||
|
||||
String destFileName = "";
|
||||
String agentName = Core.getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
String agentName = getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
destFileName = agentName + "." + System.currentTimeMillis() + ".data";
|
||||
|
||||
|
||||
|
@ -310,58 +313,32 @@ public class PandroidAgentListener extends Service {
|
|||
//Check if size of buffer is less than a value
|
||||
if((bufferSize/1024) < Core.bufferSize){
|
||||
writeFile(destFileName, lastXML);
|
||||
Core.putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
}else{
|
||||
//buffer full
|
||||
}
|
||||
Core.putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
putSharedData("PANDROID_DATA", "lastXML", lastXML, "string");
|
||||
|
||||
return lastXML;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// From unfinished task of buffering unsent xml files when no connection available //
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
public boolean saveArray(String[] array, String arrayName, Context mContext) {
|
||||
SharedPreferences prefs = mContext.getSharedPreferences("PANDROID_DATA", 0);
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putInt(arrayName +"_size", array.length);
|
||||
for(int i=0;i<array.length;i++)
|
||||
editor.putString(arrayName + "_" + i, array[i]);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
public String[] loadArray(String arrayName, Context mContext) {
|
||||
SharedPreferences prefs = mContext.getSharedPreferences("PANDROID_DATA", 0);
|
||||
int size = prefs.getInt(arrayName + "_size", 0);
|
||||
String array[] = new String[size];
|
||||
for(int i=0;i<size;i++)
|
||||
array[i] = prefs.getString(arrayName + "_" + i, null);
|
||||
return array;
|
||||
}
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
private String buildXML(){
|
||||
private String buildXML(){
|
||||
String buffer = "";
|
||||
String gpsData = "";
|
||||
buffer += "<?xml version='1.0' encoding='iso-8859-1'?>\n";
|
||||
|
||||
String latitude = Core.getSharedData("PANDROID_DATA", "latitude", "181", "float");
|
||||
String longitude = Core.getSharedData("PANDROID_DATA", "longitude", "181", "float");
|
||||
String latitude = getSharedData("PANDROID_DATA", "latitude", "181", "float");
|
||||
String longitude = getSharedData("PANDROID_DATA", "longitude", "181", "float");
|
||||
|
||||
if(!latitude.equals("181.0") && !longitude.equals("181.0")) {
|
||||
gpsData = " latitude='" + latitude + "' longitude='" + longitude + "'";
|
||||
}
|
||||
|
||||
String agentName = Core.getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
String interval = Core.getSharedData("PANDROID_DATA", "interval", Integer.toString(Core.defaultInterval), "integer");
|
||||
String interval = getSharedData("PANDROID_DATA", "interval", Integer.toString(Core.defaultInterval), "integer");
|
||||
String agentName = getSharedData("PANDROID_DATA", "agentName", Core.defaultAgentName, "string");
|
||||
|
||||
|
||||
buffer += "<agent_data " +
|
||||
"description='' group='' os_name='android' os_version='"+Build.VERSION.RELEASE+"' " +
|
||||
|
@ -373,51 +350,51 @@ public class PandroidAgentListener extends Service {
|
|||
// MODULES //
|
||||
// //
|
||||
|
||||
String orientation = Core.getSharedData("PANDROID_DATA", "orientation", "361", "float");
|
||||
String proximity = Core.getSharedData("PANDROID_DATA", "proximity", "-1.0", "float");
|
||||
String batteryLevel = Core.getSharedData("PANDROID_DATA", "batteryLevel", "-1", "integer");
|
||||
String taskStatus = Core.getSharedData("PANDROID_DATA", "taskStatus", "disabled", "string");
|
||||
String taskRun = Core.getSharedData("PANDROID_DATA", "taskRun", "false", "string");
|
||||
String taskHumanName = Core.getSharedData("PANDROID_DATA", "taskHumanName", "", "string");
|
||||
// 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 taskHumanName = getSharedData("PANDROID_DATA", "taskHumanName", "", "string");
|
||||
taskHumanName = StringEscapeUtils.escapeHtml4(taskHumanName);
|
||||
String task = getSharedData("PANDROID_DATA", "task", "", "string");
|
||||
String memoryStatus = getSharedData("PANDROID_DATA", "memoryStatus", Core.defaultMemoryStatus, "string");
|
||||
String availableRamKb = getSharedData("PANDROID_DATA", "availableRamKb", "0" , "long");
|
||||
String totalRamKb = getSharedData("PANDROID_DATA", "totalRamKb", "0", "long");
|
||||
String upTime = getSharedData("PANDROID_DATA", "upTime", ""+Core.defaultUpTime, "long");
|
||||
String helloSignal = getSharedData("PANDROID_DATA", "helloSignal", ""+Core.defaultHelloSignal, "integer");
|
||||
|
||||
String task = Core.getSharedData("PANDROID_DATA", "task", "", "string");
|
||||
String memoryStatus = Core.getSharedData("PANDROID_DATA", "memoryStatus", Core.defaultMemoryStatus, "string");
|
||||
String availableRamKb = Core.getSharedData("PANDROID_DATA", "availableRamKb", "0" , "long");
|
||||
String totalRamKb = Core.getSharedData("PANDROID_DATA", "totalRamKb", "0", "long");
|
||||
String SimID = Core.getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
|
||||
String upTime = Core.getSharedData("PANDROID_DATA", "upTime", ""+Core.defaultUpTime, "long");
|
||||
String networkOperator = Core.getSharedData("PANDROID_DATA", "networkOperator", Core.defaultNetworkOperator, "string");
|
||||
String SMSReceived = Core.getSharedData("PANDROID_DATA", "SMSReceived", ""+Core.defaultSMSReceived, "integer");
|
||||
String SMSSent = Core.getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
|
||||
String networkType = Core.getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
|
||||
String phoneType = Core.getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
|
||||
String signalStrength = Core.getSharedData("PANDROID_DATA", "signalStrength", ""+Core.defaultSignalStrength, "integer");
|
||||
String incomingCalls = Core.getSharedData("PANDROID_DATA", "incomingCalls", ""+Core.defaultIncomingCalls, "integer");
|
||||
String missedCalls = Core.getSharedData("PANDROID_DATA", "missedCalls", ""+Core.defaultMissedCalls, "integer");
|
||||
String outgoingCalls = Core.getSharedData("PANDROID_DATA", "outgoingCalls", ""+Core.defaultOutgoingCalls, "integer");
|
||||
String receiveBytes = Core.getSharedData("PANDROID_DATA", "receiveBytes", ""+Core.defaultReceiveBytes, "long");
|
||||
String transmitBytes = Core.getSharedData("PANDROID_DATA", "transmitBytes", ""+Core.defaultTransmitBytes, "long");
|
||||
String helloSignal = Core.getSharedData("PANDROID_DATA", "helloSignal", ""+Core.defaultHelloSignal, "integer");
|
||||
String roaming = Core.getSharedData("PANDROID_DATA", "roaming", ""+Core.defaultRoaming, "integer");
|
||||
String SimID = getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
|
||||
String networkOperator = getSharedData("PANDROID_DATA", "networkOperator", Core.defaultNetworkOperator, "string");
|
||||
String networkType = getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
|
||||
String phoneType = getSharedData("PANDROID_DATA", "networkType", Core.defaultNetworkType, "string");
|
||||
String signalStrength = getSharedData("PANDROID_DATA", "signalStrength", ""+Core.defaultSignalStrength, "integer");
|
||||
String SMSReceived = getSharedData("PANDROID_DATA", "SMSReceived", ""+Core.defaultSMSReceived, "integer");
|
||||
String SMSSent = getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
|
||||
String incomingCalls = getSharedData("PANDROID_DATA", "incomingCalls", ""+Core.defaultIncomingCalls, "integer");
|
||||
String missedCalls = getSharedData("PANDROID_DATA", "missedCalls", ""+Core.defaultMissedCalls, "integer");
|
||||
String outgoingCalls = getSharedData("PANDROID_DATA", "outgoingCalls", ""+Core.defaultOutgoingCalls, "integer");
|
||||
String receiveBytes = getSharedData("PANDROID_DATA", "receiveBytes", ""+Core.defaultReceiveBytes, "long");
|
||||
String transmitBytes = getSharedData("PANDROID_DATA", "transmitBytes", ""+Core.defaultTransmitBytes, "long");
|
||||
String roaming = getSharedData("PANDROID_DATA", "roaming", ""+Core.defaultRoaming, "integer");
|
||||
|
||||
String simIDReport = Core.getSharedData("PANDROID_DATA", "simIDReport", Core.defaultSimIDReport, "string");
|
||||
String DeviceUpTimeReport = Core.getSharedData("PANDROID_DATA", "DeviceUpTimeReport", Core.defaultDeviceUpTimeReport, "string");
|
||||
String NetworkOperatorReport = Core.getSharedData("PANDROID_DATA", "NetworkOperatorReport", Core.defaultNetworkOperatorReport, "string");
|
||||
String NetworkTypeReport = Core.getSharedData("PANDROID_DATA", "NetworkTypeReport", Core.defaultNetworkTypeReport, "string");
|
||||
String PhoneTypeReport = Core.getSharedData("PANDROID_DATA", "PhoneTypeReport", Core.defaultPhoneTypeReport, "string");
|
||||
String SignalStrengthReport = Core.getSharedData("PANDROID_DATA", "SignalStrengthReport", Core.defaultSignalStrengthReport, "string");
|
||||
String ReceivedSMSReport = Core.getSharedData("PANDROID_DATA", "ReceivedSMSReport", Core.defaultReceivedSMSReport, "string");
|
||||
String SentSMSReport = Core.getSharedData("PANDROID_DATA", "SentSMSReport", Core.defaultSentSMSReport, "string");
|
||||
String IncomingCallsReport = Core.getSharedData("PANDROID_DATA", "IncomingCallsReport", Core.defaultIncomingCallsReport, "string");
|
||||
String MissedCallsReport = Core.getSharedData("PANDROID_DATA", "MissedCallsReport", Core.defaultMissedCallsReport, "string");
|
||||
String OutgoingCallsReport = Core.getSharedData("PANDROID_DATA", "OutgoingCallsReport", Core.defaultOutgoingCallsReport, "string");
|
||||
String BytesReceivedReport = Core.getSharedData("PANDROID_DATA", "BytesReceivedReport", Core.defaultBytesReceivedReport, "string");
|
||||
String BytesSentReport = Core.getSharedData("PANDROID_DATA", "BytesSentReport", Core.defaultBytesSentReport, "string");
|
||||
String HelloSignalReport = Core.getSharedData("PANDROID_DATA", "HelloSignalReport", Core.defaultHelloSignalReport, "string");
|
||||
String BatteryLevelReport = Core.getSharedData("PANDROID_DATA", "BatteryLevelReport", Core.defaultBatteryLevelReport, "string");
|
||||
String RoamingReport = Core.getSharedData("PANDROID_DATA", "RoamingReport", Core.defaultRoamingReport, "string");
|
||||
String InventoryReport = Core.getSharedData("PANDROID_DATA", "InventoryReport", Core.defaultInventoryReport, "string");
|
||||
String simIDReport = getSharedData("PANDROID_DATA", "simIDReport", Core.defaultSimIDReport, "string");
|
||||
String DeviceUpTimeReport = getSharedData("PANDROID_DATA", "DeviceUpTimeReport", Core.defaultDeviceUpTimeReport, "string");
|
||||
String NetworkOperatorReport = getSharedData("PANDROID_DATA", "NetworkOperatorReport", Core.defaultNetworkOperatorReport, "string");
|
||||
String NetworkTypeReport = getSharedData("PANDROID_DATA", "NetworkTypeReport", Core.defaultNetworkTypeReport, "string");
|
||||
String PhoneTypeReport = getSharedData("PANDROID_DATA", "PhoneTypeReport", Core.defaultPhoneTypeReport, "string");
|
||||
String SignalStrengthReport = getSharedData("PANDROID_DATA", "SignalStrengthReport", Core.defaultSignalStrengthReport, "string");
|
||||
String ReceivedSMSReport = getSharedData("PANDROID_DATA", "ReceivedSMSReport", Core.defaultReceivedSMSReport, "string");
|
||||
String SentSMSReport = getSharedData("PANDROID_DATA", "SentSMSReport", Core.defaultSentSMSReport, "string");
|
||||
String IncomingCallsReport = getSharedData("PANDROID_DATA", "IncomingCallsReport", Core.defaultIncomingCallsReport, "string");
|
||||
String MissedCallsReport = getSharedData("PANDROID_DATA", "MissedCallsReport", Core.defaultMissedCallsReport, "string");
|
||||
String OutgoingCallsReport = getSharedData("PANDROID_DATA", "OutgoingCallsReport", Core.defaultOutgoingCallsReport, "string");
|
||||
String BytesReceivedReport = getSharedData("PANDROID_DATA", "BytesReceivedReport", Core.defaultBytesReceivedReport, "string");
|
||||
String BytesSentReport = getSharedData("PANDROID_DATA", "BytesSentReport", Core.defaultBytesSentReport, "string");
|
||||
String HelloSignalReport = getSharedData("PANDROID_DATA", "HelloSignalReport", Core.defaultHelloSignalReport, "string");
|
||||
String BatteryLevelReport = getSharedData("PANDROID_DATA", "BatteryLevelReport", Core.defaultBatteryLevelReport, "string");
|
||||
String RoamingReport = getSharedData("PANDROID_DATA", "RoamingReport", Core.defaultRoamingReport, "string");
|
||||
String InventoryReport = getSharedData("PANDROID_DATA", "InventoryReport", Core.defaultInventoryReport, "string");
|
||||
|
||||
if(InventoryReport.equals("enabled"))
|
||||
{
|
||||
|
@ -427,13 +404,13 @@ public class PandroidAgentListener extends Service {
|
|||
if (BatteryLevelReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("battery_level", "The current Battery level", "generic_data", batteryLevel);
|
||||
|
||||
if(!orientation.equals("361.0")) {
|
||||
buffer += buildmoduleXML("orientation", "The actually device orientation (in degrees)", "generic_data", orientation);
|
||||
}
|
||||
|
||||
if(!proximity.equals("-1.0")) {
|
||||
buffer += buildmoduleXML("proximity", "The actually device proximity detector (0/1)", "generic_data", proximity);
|
||||
}
|
||||
// if(!orientation.equals("361.0")) {
|
||||
// buffer += buildmoduleXML("orientation", "The actually device orientation (in degrees)", "generic_data", orientation);
|
||||
// }
|
||||
//
|
||||
// if(!proximity.equals("-1.0")) {
|
||||
// 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);
|
||||
|
@ -458,6 +435,9 @@ public class PandroidAgentListener extends Service {
|
|||
if (DeviceUpTimeReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("upTime","Total device uptime in seconds.", "generic_data", upTime);
|
||||
|
||||
if (HelloSignalReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("helloSignal","Hello Signal", "generic_data", helloSignal);
|
||||
|
||||
if (Core.hasSim){
|
||||
if (simIDReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("simID", "The Sim ID.", "generic_data_string", SimID);
|
||||
|
@ -486,18 +466,8 @@ public class PandroidAgentListener extends Service {
|
|||
if (RoamingReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("roaming","Device is roaming", "generic_data", roaming);
|
||||
}// end if sim card
|
||||
if (HelloSignalReport.equals("enabled"))
|
||||
buffer += buildmoduleXML("helloSignal","Hello Signal", "generic_data", helloSignal);
|
||||
|
||||
|
||||
//UTF-8 TEST//
|
||||
|
||||
//String iso_8859_1String = "ÀÁÈÉÌÍÙÚÜàáèéìíòóùúü";
|
||||
|
||||
//buffer += buildmoduleXML("iso-8859-1Test","Testing iso-8859-1 Values", "generic_data_string", iso_8859_1String);
|
||||
|
||||
|
||||
// End_Modules
|
||||
|
||||
buffer += "</agent_data>";
|
||||
|
||||
|
@ -572,7 +542,7 @@ public class PandroidAgentListener extends Service {
|
|||
module_xml += "]]></data>\n";
|
||||
}
|
||||
|
||||
/* Close the datalist and module_inventory */
|
||||
/* Close the data list and module_inventory */
|
||||
module_xml += "\t\t\t</datalist>\n\t\t</inventory_module>\n";
|
||||
/* Close inventory */
|
||||
module_xml += "\t</inventory>\n";
|
||||
|
@ -602,8 +572,8 @@ public class PandroidAgentListener extends Service {
|
|||
//if(latitude != loc.getLatitude() || longitude != loc.getLongitude()) {
|
||||
lastGpsContactDateTime = getHumanDateTime(-1);
|
||||
//}
|
||||
Core.putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
||||
Core.putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
||||
putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
||||
putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
||||
}
|
||||
else {
|
||||
Criteria criteria = new Criteria();
|
||||
|
@ -623,9 +593,9 @@ public class PandroidAgentListener extends Service {
|
|||
lm.requestLocationUpdates(bestProvider, Core.defaultInterval, 1000,
|
||||
new LocationListener() {
|
||||
public void onLocationChanged(Location location) {
|
||||
Core.putSharedData("PANDROID_DATA", "latitude",
|
||||
putSharedData("PANDROID_DATA", "latitude",
|
||||
Double.valueOf(location.getLatitude()).toString(), "float");
|
||||
Core.putSharedData("PANDROID_DATA", "longitude",
|
||||
putSharedData("PANDROID_DATA", "longitude",
|
||||
Double.valueOf(location.getLongitude()).toString(), "float");
|
||||
}
|
||||
public void onStatusChanged(String s, int i, Bundle bundle) {
|
||||
|
@ -635,7 +605,7 @@ public class PandroidAgentListener extends Service {
|
|||
// try switching to a different provider
|
||||
}
|
||||
public void onProviderDisabled(String s) {
|
||||
Core.putSharedData("PANDROID_DATA", "enabled_location_provider",
|
||||
putSharedData("PANDROID_DATA", "enabled_location_provider",
|
||||
"disabled", "string");
|
||||
}
|
||||
});
|
||||
|
@ -650,7 +620,7 @@ public class PandroidAgentListener extends Service {
|
|||
int scale = batteryIntent.getIntExtra("scale", -1);
|
||||
//double level = -1;
|
||||
if (rawlevel >= 0 && scale > 0) {
|
||||
Core.putSharedData("PANDROID_DATA", "batteryLevel", Integer.valueOf((rawlevel * 100) / scale).toString(), "integer");
|
||||
putSharedData("PANDROID_DATA", "batteryLevel", Integer.valueOf((rawlevel * 100) / scale).toString(), "integer");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,7 +629,7 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
SensorEventListener orientationLevelReceiver = new SensorEventListener() {
|
||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||
Core.putSharedData("PANDROID_DATA", "orientation", Float.toString(sensorEvent.values[0]), "float");
|
||||
putSharedData("PANDROID_DATA", "orientation", Float.toString(sensorEvent.values[0]), "float");
|
||||
}
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
}
|
||||
|
@ -667,7 +637,7 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
SensorEventListener proximityLevelReceiver = new SensorEventListener() {
|
||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||
Core.putSharedData("PANDROID_DATA", "proximity", Float.toString(sensorEvent.values[0]), "float");
|
||||
putSharedData("PANDROID_DATA", "proximity", Float.toString(sensorEvent.values[0]), "float");
|
||||
}
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
}
|
||||
|
@ -717,7 +687,7 @@ public class PandroidAgentListener extends Service {
|
|||
private void updateValues() {
|
||||
|
||||
batteryLevel();
|
||||
String gpsStatus = Core.getSharedData("PANDROID_DATA", "gpsStatus", Core.defaultGpsStatus, "string");
|
||||
String gpsStatus = getSharedData("PANDROID_DATA", "gpsStatus", Core.defaultGpsStatus, "string");
|
||||
|
||||
if(gpsStatus.equals("enabled")) {
|
||||
Log.d("PANDROID AGENT", "ENABLED");
|
||||
|
@ -725,8 +695,8 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
else {
|
||||
Log.d("PANDROID AGENT", "DISABLED");
|
||||
Core.putSharedData("PANDROID_DATA", "latitude", "181.0", "float");
|
||||
Core.putSharedData("PANDROID_DATA", "longitude", "181.0", "float");
|
||||
putSharedData("PANDROID_DATA", "latitude", "181.0", "float");
|
||||
putSharedData("PANDROID_DATA", "longitude", "181.0", "float");
|
||||
}
|
||||
|
||||
//sensors();
|
||||
|
@ -749,7 +719,7 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
|
||||
private void getMemoryStatus() {
|
||||
String memoryStatus = Core.getSharedData("PANDROID_DATA", "memoryStatus", Core.defaultMemoryStatus, "string");
|
||||
String memoryStatus = getSharedData("PANDROID_DATA", "memoryStatus", Core.defaultMemoryStatus, "string");
|
||||
long availableRamKb = 0;
|
||||
long totalRamKb = 0;
|
||||
|
||||
|
@ -775,14 +745,14 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
Core.putSharedData("PANDROID_DATA", "availableRamKb", "" + availableRamKb, "long");
|
||||
Core.putSharedData("PANDROID_DATA", "totalRamKb", "" + totalRamKb, "long");
|
||||
putSharedData("PANDROID_DATA", "availableRamKb", "" + availableRamKb, "long");
|
||||
putSharedData("PANDROID_DATA", "totalRamKb", "" + totalRamKb, "long");
|
||||
}// end getMemoryStatus
|
||||
|
||||
private void getTaskStatus() {
|
||||
String taskStatus = Core.getSharedData("PANDROID_DATA", "taskStatus", Core.defaultTaskStatus, "string");
|
||||
String task = Core.getSharedData("PANDROID_DATA", "task", Core.defaultTask, "string");
|
||||
String taskHumanName = Core.getSharedData("PANDROID_DATA", "taskHumanName", Core.defaultTaskHumanName, "string");
|
||||
String taskStatus = getSharedData("PANDROID_DATA", "taskStatus", Core.defaultTaskStatus, "string");
|
||||
String task = getSharedData("PANDROID_DATA", "task", Core.defaultTask, "string");
|
||||
String taskHumanName = getSharedData("PANDROID_DATA", "taskHumanName", Core.defaultTaskHumanName, "string");
|
||||
String run = "false";
|
||||
|
||||
if (taskStatus.equals("enabled")) {
|
||||
|
@ -802,7 +772,7 @@ public class PandroidAgentListener extends Service {
|
|||
}
|
||||
}
|
||||
}
|
||||
Core.putSharedData("PANDROID_DATA", "taskRun", run, "string");
|
||||
putSharedData("PANDROID_DATA", "taskRun", run, "string");
|
||||
}//end getTaskStatus
|
||||
|
||||
/**
|
||||
|
@ -810,12 +780,12 @@ public class PandroidAgentListener extends Service {
|
|||
*/
|
||||
private void getSimID(){
|
||||
|
||||
String simID = Core.getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
|
||||
String simID = getSharedData("PANDROID_DATA", "simID", Core.defaultSimID, "string");
|
||||
|
||||
String serviceName = Context.TELEPHONY_SERVICE;
|
||||
TelephonyManager telephonyManager = (TelephonyManager) getApplicationContext().getSystemService(serviceName);
|
||||
simID = telephonyManager.getSimSerialNumber();
|
||||
Core.putSharedData("PANDROID_DATA", "simID", simID, "string");
|
||||
putSharedData("PANDROID_DATA", "simID", simID, "string");
|
||||
}
|
||||
/**
|
||||
* Retrieves the time in seconds since the device was switched on
|
||||
|
@ -824,7 +794,7 @@ public class PandroidAgentListener extends Service {
|
|||
long upTime = Core.defaultUpTime;
|
||||
upTime = SystemClock.elapsedRealtime()/1000;
|
||||
if(upTime != 0)
|
||||
Core.putSharedData("PANDROID_DATA", "upTime", ""+upTime, "long");
|
||||
putSharedData("PANDROID_DATA", "upTime", ""+upTime, "long");
|
||||
}
|
||||
/**
|
||||
* Retrieve currently registered network operator, i.e. vodafone, movistar, etc...
|
||||
|
@ -836,7 +806,7 @@ public class PandroidAgentListener extends Service {
|
|||
networkOperator = telephonyManager.getNetworkOperatorName();
|
||||
|
||||
if(networkOperator != null)
|
||||
Core.putSharedData("PANDROID_DATA", "networkOperator", networkOperator, "string");
|
||||
putSharedData("PANDROID_DATA", "networkOperator", networkOperator, "string");
|
||||
}
|
||||
/**
|
||||
* Retrieves the number of sent sms messages using the android messaging app only
|
||||
|
@ -844,7 +814,7 @@ public class PandroidAgentListener extends Service {
|
|||
private void getSMSSent(){
|
||||
|
||||
String SMSSent = ""+Core.defaultSMSSent;
|
||||
SMSSent = Core.getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
|
||||
SMSSent = getSharedData("PANDROID_DATA", "SMSSent", ""+Core.defaultSMSSent, "integer");
|
||||
Uri allMessages = Uri.parse("content://sms/sent");
|
||||
Cursor c = getContentResolver().query(allMessages, null, null, null, null);
|
||||
int totalMessages = 0;
|
||||
|
@ -863,7 +833,7 @@ public class PandroidAgentListener extends Service {
|
|||
SMSSent =""+ totalMessages;
|
||||
|
||||
if(SMSSent != null)
|
||||
Core.putSharedData("PANDROID_DATA", "SMSSent", SMSSent, "integer");
|
||||
putSharedData("PANDROID_DATA", "SMSSent", SMSSent, "integer");
|
||||
|
||||
}// end getSMSSent
|
||||
/**
|
||||
|
@ -927,7 +897,7 @@ public class PandroidAgentListener extends Service {
|
|||
break;
|
||||
}
|
||||
if(networkType != null)
|
||||
Core.putSharedData("PANDROID_DATA", "networkType", networkType, "string");
|
||||
putSharedData("PANDROID_DATA", "networkType", networkType, "string");
|
||||
|
||||
}// end getNetworkType
|
||||
|
||||
|
@ -956,7 +926,7 @@ public class PandroidAgentListener extends Service {
|
|||
break;
|
||||
}
|
||||
if(phoneType != null)
|
||||
Core.putSharedData("PANDROID_DATA", "phoneType", phoneType, "string");
|
||||
putSharedData("PANDROID_DATA", "phoneType", phoneType, "string");
|
||||
}// end getPhoneType
|
||||
|
||||
/**
|
||||
|
@ -990,9 +960,9 @@ public class PandroidAgentListener extends Service {
|
|||
c.moveToNext();
|
||||
}
|
||||
|
||||
Core.putSharedData("PANDROID_DATA", "incomingCalls", ""+incoming, "integer");
|
||||
Core.putSharedData("PANDROID_DATA", "missedCalls", ""+missed, "integer");
|
||||
Core.putSharedData("PANDROID_DATA", "outgoingCalls", ""+outgoing, "integer");
|
||||
putSharedData("PANDROID_DATA", "incomingCalls", ""+incoming, "integer");
|
||||
putSharedData("PANDROID_DATA", "missedCalls", ""+missed, "integer");
|
||||
putSharedData("PANDROID_DATA", "outgoingCalls", ""+outgoing, "integer");
|
||||
}
|
||||
|
||||
c.close();
|
||||
|
@ -1023,7 +993,7 @@ public class PandroidAgentListener extends Service {
|
|||
else{
|
||||
signalStrengthValue ="" + (signalStrength.getCdmaDbm());
|
||||
}
|
||||
Core.putSharedData("PANDROID_DATA", "signalStrength", signalStrengthValue, "integer");
|
||||
putSharedData("PANDROID_DATA", "signalStrength", signalStrengthValue, "integer");
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
@ -1037,8 +1007,8 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
if (receiveBytes != TrafficStats.UNSUPPORTED && transmitBytes != TrafficStats.UNSUPPORTED)
|
||||
{
|
||||
Core.putSharedData("PANDROID_DATA", "receiveBytes", ""+receiveBytes, "long" );
|
||||
Core.putSharedData("PANDROID_DATA", "transmitBytes", ""+transmitBytes, "long" );
|
||||
putSharedData("PANDROID_DATA", "receiveBytes", ""+receiveBytes, "long" );
|
||||
putSharedData("PANDROID_DATA", "transmitBytes", ""+transmitBytes, "long" );
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -1050,13 +1020,72 @@ public class PandroidAgentListener extends Service {
|
|||
boolean roaming = telephone.isNetworkRoaming();
|
||||
|
||||
if(roaming)
|
||||
Core.putSharedData("PANDROID_DATA", "roaming", "1", "integer" );
|
||||
putSharedData("PANDROID_DATA", "roaming", "1", "integer" );
|
||||
else
|
||||
Core.putSharedData("PANDROID_DATA", "roaming", "0", "integer" );
|
||||
putSharedData("PANDROID_DATA", "roaming", "0", "integer" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void putSharedData(String preferenceName, String tokenName, String data, String type) {
|
||||
|
||||
SharedPreferences agentPreferences = this.getSharedPreferences(
|
||||
this.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
|
||||
Editor editor = agentPreferences.edit();
|
||||
|
||||
if(type == "boolean") {
|
||||
editor.putBoolean(tokenName, Boolean.parseBoolean(data));
|
||||
editor.commit();
|
||||
}
|
||||
else if(type == "float") {
|
||||
editor.putFloat(tokenName, Float.parseFloat(data));
|
||||
editor.commit();
|
||||
}
|
||||
else if(type == "integer") {
|
||||
editor.putInt(tokenName, Integer.parseInt(data));
|
||||
editor.commit();
|
||||
}
|
||||
else if(type == "long") {
|
||||
editor.putLong(tokenName, Long.parseLong(data));
|
||||
editor.commit();
|
||||
}
|
||||
else if(type == "string") {
|
||||
editor.putString(tokenName, data);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
private String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {
|
||||
|
||||
SharedPreferences agentPreferences = this.getSharedPreferences(
|
||||
this.getString(R.string.const_string_preferences),
|
||||
Activity.MODE_PRIVATE);
|
||||
|
||||
if(type == "boolean") {
|
||||
boolean a = agentPreferences.getBoolean(tokenName, Boolean.parseBoolean(defaultValue));
|
||||
return Boolean.valueOf(a).toString();
|
||||
}
|
||||
else if(type == "float") {
|
||||
float a = agentPreferences.getFloat(tokenName, Float.parseFloat(defaultValue));
|
||||
return Float.valueOf(a).toString();
|
||||
}
|
||||
else if(type == "integer") {
|
||||
int a = agentPreferences.getInt(tokenName, Integer.parseInt(defaultValue));
|
||||
return Integer.valueOf(a).toString();
|
||||
}
|
||||
else if(type == "long") {
|
||||
long a = agentPreferences.getLong(tokenName, Long.parseLong(defaultValue));
|
||||
return Long.valueOf(a).toString();
|
||||
}
|
||||
else if(type == "string") {
|
||||
return agentPreferences.getString(tokenName, defaultValue);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getHumanDateTime(long unixtime){
|
||||
Calendar dateTime = Calendar.getInstance();
|
||||
|
@ -1100,6 +1129,7 @@ public class PandroidAgentListener extends Service {
|
|||
return humanDateTime;
|
||||
}
|
||||
|
||||
//TODO
|
||||
public static void CancelNotification(Context ctx, int notifyId) {
|
||||
String ns = Context.NOTIFICATION_SERVICE;
|
||||
NotificationManager nMgr = (NotificationManager) ctx.getSystemService(ns);
|
||||
|
@ -1116,8 +1146,8 @@ public class PandroidAgentListener extends Service {
|
|||
|
||||
@Override
|
||||
public void onLocationChanged(Location loc) {
|
||||
Core.putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
||||
Core.putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
||||
putSharedData("PANDROID_DATA", "latitude", Double.valueOf(loc.getLatitude()).toString(), "float");
|
||||
putSharedData("PANDROID_DATA", "longitude", Double.valueOf(loc.getLongitude()).toString(), "float");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,8 +74,10 @@ class tentacle_client {
|
|||
|
||||
Socket socketCliente = new Socket();
|
||||
|
||||
// TODO Maybe change socket to higher timeout value
|
||||
|
||||
try {
|
||||
socketCliente.connect(new InetSocketAddress(address, port), 1000);
|
||||
socketCliente.connect(new InetSocketAddress(address, port), 2000);
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
getError("Host don't exists");
|
||||
|
|
|
@ -36,7 +36,7 @@ import android.util.Log;
|
|||
int defaultSMSReceived = 0;
|
||||
int mode = Activity.MODE_PRIVATE;
|
||||
|
||||
SharedPreferences pref = PandroidAgent.getSharedPrefs();
|
||||
SharedPreferences pref = context.getSharedPreferences("PANDROID_DATA", mode);
|
||||
int sms = pref.getInt("SMSReceived", defaultSMSReceived);
|
||||
|
||||
sms++;
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.net.Uri;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -163,7 +164,7 @@ public class Setup extends Activity {
|
|||
stopAgent.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
Core.stopAgentListener();
|
||||
CancelNotification(getApplicationContext(),1);
|
||||
CancelNotification(getApplicationContext(),42);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -174,8 +175,6 @@ public class Setup extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}// end setButtonEvents
|
||||
|
||||
private void loadInBackgroundProcessInExecution() {
|
||||
|
@ -233,7 +232,7 @@ public class Setup extends Activity {
|
|||
if (position == -1) {
|
||||
listProcesses.put(Core.task, text);
|
||||
|
||||
//The asociative array is reordened, and need to extract the sub arrays again.
|
||||
//The associative array is reordered, and need to extract the sub arrays again.
|
||||
listProcess = new ArrayList<String>(listProcesses.keySet());
|
||||
listProcessHuman = new ArrayList<String>(listProcesses.values());
|
||||
|
||||
|
@ -271,48 +270,45 @@ public class Setup extends Activity {
|
|||
}// end onPostExecute
|
||||
|
||||
private void getDataFromView() {
|
||||
// Init form values
|
||||
// Declare view objects
|
||||
EditText editText;
|
||||
CheckBox checkBox;
|
||||
Spinner combo;
|
||||
|
||||
// notification
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNotification);
|
||||
if (checkBox.isChecked())
|
||||
Core.NotificationCheck = "enabled";
|
||||
else
|
||||
Core.NotificationCheck = "disabled";
|
||||
Log.d("notif", ""+Core.NotificationCheck);
|
||||
|
||||
// serverAddress
|
||||
editText = (EditText) findViewById(R.id.serverAddrInput);
|
||||
Core.serverAddr = editText.getText().toString();
|
||||
|
||||
// serverPort
|
||||
editText = (EditText) findViewById(R.id.serverPortInput);
|
||||
Core.serverPort = editText.getText().toString();
|
||||
|
||||
// interval
|
||||
editText = (EditText) findViewById(R.id.intervalInput);
|
||||
Core.interval = Integer.valueOf(editText.getText().toString()).intValue();
|
||||
|
||||
// agentName
|
||||
editText = (EditText) findViewById(R.id.agentNameInput);
|
||||
Core.agentName = editText.getText().toString();
|
||||
|
||||
// bufferSize
|
||||
editText = (EditText) findViewById(R.id.bufferSize);
|
||||
Core.bufferSize = Long.valueOf(editText.getText().toString()).longValue();
|
||||
|
||||
// mobileWebURL
|
||||
editText = (EditText) findViewById(R.id.mobileWebURLInput);
|
||||
Core.mobileWebURL = editText.getText().toString();
|
||||
|
||||
editText = (EditText) findViewById(R.id.bufferSize);
|
||||
Core.bufferSize = Long.valueOf(editText.getText().toString()).longValue();
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkGpsReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.gpsStatus = "enabled";
|
||||
else
|
||||
Core.gpsStatus = "disabled";
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBatteryLevelReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.BatteryLevelReport = "enabled";
|
||||
else
|
||||
Core.BatteryLevelReport = "disabled";
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkMemoryReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.memoryStatus = "enabled";
|
||||
else
|
||||
Core.memoryStatus = "disabled";
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
|
||||
// taskReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
|
||||
if (checkBox.isChecked()) {
|
||||
Core.taskStatus = "enabled";
|
||||
|
||||
|
@ -328,87 +324,137 @@ public class Setup extends Activity {
|
|||
Core.task = "";
|
||||
Core.taskHumanName = "";
|
||||
}
|
||||
|
||||
// gpsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkGpsReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.gpsStatus = "enabled";
|
||||
else
|
||||
Core.gpsStatus = "disabled";
|
||||
|
||||
// batteryLevelReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBatteryLevelReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.BatteryLevelReport = "enabled";
|
||||
else
|
||||
Core.BatteryLevelReport = "disabled";
|
||||
|
||||
// memoryReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkMemoryReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.memoryStatus = "enabled";
|
||||
else
|
||||
Core.memoryStatus = "disabled";
|
||||
|
||||
// upTimeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkDeviceUpTimeReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.DeviceUpTimeReport = "enabled";
|
||||
else
|
||||
Core.DeviceUpTimeReport = "disabled";
|
||||
|
||||
|
||||
// inventory Report
|
||||
checkBox = (CheckBox) findViewById(R.id.checkInventoryReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.InventoryReport = "enabled";
|
||||
else
|
||||
Core.InventoryReport = "disabled";
|
||||
|
||||
// helloSignalReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkHelloSignalReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.HelloSignalReport = "enabled";
|
||||
else
|
||||
Core.HelloSignalReport = "disabled";
|
||||
|
||||
// Only retrieve these values if a sim card is present
|
||||
if (Core.hasSim) {
|
||||
|
||||
// simIDReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.simIDReport = "enabled";
|
||||
else
|
||||
Core.simIDReport = "disabled";
|
||||
|
||||
// networkOperatorReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNetworkOperatorReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.NetworkOperatorReport = "enabled";
|
||||
else
|
||||
Core.NetworkOperatorReport = "disabled";
|
||||
|
||||
// networkTypeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNetworkTypeReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.NetworkTypeReport = "enabled";
|
||||
else
|
||||
Core.NetworkTypeReport = "disabled";
|
||||
|
||||
// phoneTypeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkPhoneTypeReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.PhoneTypeReport = "enabled";
|
||||
else
|
||||
Core.PhoneTypeReport = "disabled";
|
||||
|
||||
// signalStrengthReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSignalStrengthReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.SignalStrengthReport = "enabled";
|
||||
else
|
||||
Core.SignalStrengthReport = "disabled";
|
||||
|
||||
|
||||
// receivedSMSReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkReceivedSMSReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.ReceivedSMSReport = "enabled";
|
||||
else
|
||||
Core.ReceivedSMSReport = "disabled";
|
||||
|
||||
// sentSMSReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSentSMSReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.SentSMSReport = "enabled";
|
||||
else
|
||||
Core.SentSMSReport = "disabled";
|
||||
|
||||
// incomingCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkIncomingCallsReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.IncomingCallsReport = "enabled";
|
||||
else
|
||||
Core.IncomingCallsReport = "disabled";
|
||||
|
||||
// missedCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkMissedCallsReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.MissedCallsReport = "enabled";
|
||||
else
|
||||
Core.MissedCallsReport = "disabled";
|
||||
|
||||
// outgoingCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkOutgoingCallsReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.OutgoingCallsReport = "enabled";
|
||||
else
|
||||
Core.OutgoingCallsReport = "disabled";
|
||||
|
||||
// bytesReceivedReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBytesReceivedReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.BytesReceivedReport = "enabled";
|
||||
else
|
||||
Core.BytesReceivedReport = "disabled";
|
||||
|
||||
// bytesSentReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBytesSentReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.BytesSentReport = "enabled";
|
||||
else
|
||||
Core.BytesSentReport = "disabled";
|
||||
|
||||
// roamingReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkRoamingReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.RoamingReport = "enabled";
|
||||
|
@ -416,120 +462,130 @@ public class Setup extends Activity {
|
|||
Core.RoamingReport = "disabled";
|
||||
}// end if sim card
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkInventoryReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.InventoryReport = "enabled";
|
||||
else
|
||||
Core.InventoryReport = "disabled";
|
||||
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkHelloSignalReport);
|
||||
if (checkBox.isChecked())
|
||||
Core.HelloSignalReport = "enabled";
|
||||
else
|
||||
Core.HelloSignalReport = "disabled";
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNotification);
|
||||
if (checkBox.isChecked())
|
||||
Core.NotificationCheck = "enabled";
|
||||
else
|
||||
Core.NotificationCheck = "disabled";
|
||||
|
||||
|
||||
// update saved values with new ones retrieved from view
|
||||
Core.updateConf(getApplicationContext());
|
||||
}
|
||||
|
||||
private void loadViews(){
|
||||
// Init form values
|
||||
// Declare view objects
|
||||
EditText editText;
|
||||
CheckBox checkBox;
|
||||
|
||||
// notification
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNotification);
|
||||
checkBox.setChecked(Core.NotificationCheck.equals("enabled"));
|
||||
|
||||
// serverAddress
|
||||
editText = (EditText) findViewById(R.id.serverAddrInput);
|
||||
editText.setText(Core.serverAddr);
|
||||
|
||||
// serverPort
|
||||
editText = (EditText) findViewById(R.id.serverPortInput);
|
||||
editText.setText(Core.serverPort);
|
||||
|
||||
// interval
|
||||
editText = (EditText) findViewById(R.id.intervalInput);
|
||||
editText.setText(Integer.toString(Core.interval));
|
||||
|
||||
// agentName
|
||||
editText = (EditText) findViewById(R.id.agentNameInput);
|
||||
editText.setText(Core.agentName);
|
||||
|
||||
// bufferSize
|
||||
editText = (EditText) findViewById(R.id.bufferSize);
|
||||
editText.setText(Long.toString(Core.bufferSize));
|
||||
|
||||
// mobileWebURL
|
||||
editText = (EditText) findViewById(R.id.mobileWebURLInput);
|
||||
editText.setText(Core.mobileWebURL);
|
||||
|
||||
editText = (EditText) findViewById(R.id.bufferSize);
|
||||
editText.setText(Long.toString(Core.bufferSize));
|
||||
|
||||
// taskReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
|
||||
checkBox.setChecked(Core.taskStatus.equals("enabled"));
|
||||
|
||||
// gpsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkGpsReport);
|
||||
checkBox.setChecked(Core.gpsStatus.equals("enabled"));
|
||||
|
||||
// batteryLevelReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBatteryLevelReport);
|
||||
checkBox.setChecked(Core.BatteryLevelReport.equals("enabled"));
|
||||
|
||||
// memoryReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkMemoryReport);
|
||||
checkBox.setChecked(Core.memoryStatus.equals("enabled"));
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkTaskReport);
|
||||
checkBox.setChecked(Core.taskStatus.equals("enabled"));
|
||||
|
||||
// upTimeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkDeviceUpTimeReport);
|
||||
checkBox.setChecked(Core.DeviceUpTimeReport.equals("enabled"));
|
||||
|
||||
|
||||
// inventoryReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkInventoryReport);
|
||||
checkBox.setChecked(Core.InventoryReport.equals("enabled"));
|
||||
|
||||
// helloSignalReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkHelloSignalReport);
|
||||
checkBox.setChecked(Core.HelloSignalReport.equals("enabled"));
|
||||
|
||||
// Only retrieve these values if a sim card is present
|
||||
if (Core.hasSim) {
|
||||
|
||||
// simIDReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSimIDReport);
|
||||
checkBox.setChecked(Core.simIDReport.equals("enabled"));
|
||||
|
||||
// networkOperatorReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNetworkOperatorReport);
|
||||
checkBox.setChecked(Core.NetworkOperatorReport.equals("enabled"));
|
||||
|
||||
// networkTypeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNetworkTypeReport);
|
||||
checkBox.setChecked(Core.NetworkTypeReport.equals("enabled"));
|
||||
|
||||
// phoneTypeReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkPhoneTypeReport);
|
||||
checkBox.setChecked(Core.PhoneTypeReport.equals("enabled"));
|
||||
|
||||
// signalStrengthReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSignalStrengthReport);
|
||||
checkBox.setChecked(Core.SignalStrengthReport.equals("enabled"));
|
||||
|
||||
// receivedSMSReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkReceivedSMSReport);
|
||||
checkBox.setChecked(Core.ReceivedSMSReport.equals("enabled"));
|
||||
|
||||
// sentSMSReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkSentSMSReport);
|
||||
checkBox.setChecked(Core.SentSMSReport.equals("enabled"));
|
||||
|
||||
// incomingCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkIncomingCallsReport);
|
||||
checkBox.setChecked(Core.IncomingCallsReport.equals("enabled"));
|
||||
|
||||
// missedCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkMissedCallsReport);
|
||||
checkBox.setChecked(Core.MissedCallsReport.equals("enabled"));
|
||||
|
||||
// outgoingCallsReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkOutgoingCallsReport);
|
||||
checkBox.setChecked(Core.OutgoingCallsReport.equals("enabled"));
|
||||
|
||||
// bytesReceivedReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBytesReceivedReport);
|
||||
checkBox.setChecked(Core.BytesReceivedReport.equals("enabled"));
|
||||
|
||||
// bytesSentReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkBytesSentReport);
|
||||
checkBox.setChecked(Core.BytesSentReport.equals("enabled"));
|
||||
|
||||
// roamingReport
|
||||
checkBox = (CheckBox) findViewById(R.id.checkRoamingReport);
|
||||
checkBox.setChecked(Core.RoamingReport.equals("enabled"));
|
||||
}//end if sim card
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkInventoryReport);
|
||||
checkBox.setChecked(Core.InventoryReport.equals("enabled"));
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkHelloSignalReport);
|
||||
checkBox.setChecked(Core.HelloSignalReport.equals("enabled"));
|
||||
|
||||
checkBox = (CheckBox) findViewById(R.id.checkNotification);
|
||||
checkBox.setChecked(Core.NotificationCheck.equals("enabled"));
|
||||
|
||||
}
|
||||
|
||||
// For displaying a dialog in order to set/change password
|
||||
public void passwordChoose() {
|
||||
final Dialog dialog = new Dialog(this);
|
||||
dialog.setContentView(R.layout.password_choose);
|
||||
|
@ -565,6 +621,7 @@ public class Setup extends Activity {
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
// For displaying a dialog in order to create a password
|
||||
public void createPass() {
|
||||
|
||||
final Dialog dialog = new Dialog(this);
|
||||
|
@ -592,6 +649,7 @@ public class Setup extends Activity {
|
|||
{
|
||||
Core.password = Core.defaultPassword;
|
||||
Core.updateConf(getApplicationContext());
|
||||
//TODO
|
||||
InputMethodManager im = (InputMethodManager)getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
|
||||
im.hideSoftInputFromWindow(text.getWindowToken(), 0);
|
||||
dialog.dismiss();
|
||||
|
@ -614,7 +672,7 @@ public class Setup extends Activity {
|
|||
{
|
||||
Core.password = createpass_password;
|
||||
Core.updateConf(getApplicationContext());
|
||||
//Core.restartAgentListener(getApplicationContext());
|
||||
//TODO
|
||||
InputMethodManager im = (InputMethodManager)getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
|
||||
im.hideSoftInputFromWindow(text.getWindowToken(), 0);
|
||||
|
||||
|
@ -649,6 +707,7 @@ public class Setup extends Activity {
|
|||
|
||||
}// end createPass
|
||||
|
||||
// For displaying a dialog in order to enter the password
|
||||
public void enterPass() {
|
||||
|
||||
final Dialog dialog = new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
||||
|
@ -673,6 +732,7 @@ public class Setup extends Activity {
|
|||
{
|
||||
if(password.equals(Core.password))
|
||||
{
|
||||
//TODO
|
||||
InputMethodManager im = (InputMethodManager)getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
|
||||
im.hideSoftInputFromWindow(text.getWindowToken(), 0);
|
||||
dialog.dismiss();
|
||||
|
@ -728,6 +788,7 @@ public class Setup extends Activity {
|
|||
|
||||
}// end enterPass
|
||||
|
||||
|
||||
/**
|
||||
* Allows this activity to switch the parent tab
|
||||
* @param indexTabToSwitchTo
|
||||
|
@ -738,7 +799,7 @@ public class Setup extends Activity {
|
|||
ParentActivity.switchTab(indexTabToSwitchTo);
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
public static void CancelNotification(Context ctx, int notifyId) {
|
||||
String ns = Context.NOTIFICATION_SERVICE;
|
||||
NotificationManager nMgr = (NotificationManager) ctx.getSystemService(ns);
|
||||
|
|
|
@ -18,18 +18,15 @@ import java.util.Date;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
//import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
//import android.view.View;
|
||||
//import android.view.View.OnClickListener;
|
||||
//import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class Status extends Activity {
|
||||
Handler h = new Handler();
|
||||
|
||||
|
@ -42,11 +39,26 @@ public class Status extends Activity {
|
|||
setContentView(R.layout.status);
|
||||
else
|
||||
setContentView(R.layout.statusnosim);
|
||||
|
||||
Core.loadLastValues(getApplicationContext());
|
||||
showLastValues();
|
||||
updateLastContactInfo();
|
||||
//setButtonEvents();
|
||||
}
|
||||
//TODO maybe remove duplicate from onCreate
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
||||
if(Core.hasSim)
|
||||
setContentView(R.layout.status);
|
||||
else
|
||||
setContentView(R.layout.statusnosim);
|
||||
|
||||
Core.loadLastValues(getApplicationContext());
|
||||
showLastValues();
|
||||
updateLastContactInfo();
|
||||
}
|
||||
|
||||
public void onStart(){
|
||||
super.onStart();
|
||||
|
@ -55,7 +67,9 @@ public class Status extends Activity {
|
|||
h.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Core.loadLastValues(getApplicationContext());
|
||||
|
||||
showLastValues();
|
||||
|
||||
updateLastContactInfo();
|
||||
|
@ -63,7 +77,6 @@ public class Status extends Activity {
|
|||
h.postDelayed(this, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//For options
|
||||
|
@ -90,24 +103,7 @@ public class Status extends Activity {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
private void updateLastXML() {
|
||||
|
||||
TextView xml = (TextView) this.findViewById(R.id.xml);
|
||||
SharedPreferences agentPreferences = PandroidAgent.getSharedPrefs();
|
||||
|
||||
String lastXML = agentPreferences.getString("lastXML", "[no data]");
|
||||
xml.setText("Last XML builded: \n\n" + lastXML);
|
||||
|
||||
}
|
||||
private void hideLastXML(){
|
||||
TextView xml = (TextView) this.findViewById(R.id.xml);
|
||||
xml.setText("");
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
private void updateLastContactInfo() {
|
||||
private void updateLastContactInfo() {
|
||||
long lastContact = Core.lastContact;
|
||||
int contactError = Core.contactError;
|
||||
boolean alarmEnabled = Core.alarmEnabled;
|
||||
|
@ -132,7 +128,6 @@ public class Status extends Activity {
|
|||
|
||||
String stringAgo = "";
|
||||
|
||||
//Check connection first
|
||||
if(!alarmEnabled){
|
||||
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
|
||||
lastContactInfo.setTextColor(Color.parseColor("#FF0000"));
|
||||
|
@ -151,6 +146,7 @@ public class Status extends Activity {
|
|||
else if(timeAgo == 0) {
|
||||
stringAgo = getString(R.string.now_str);
|
||||
}
|
||||
//TODO
|
||||
else if(contactError == 0) {
|
||||
stringAgo = timeAgo + " " + getString(R.string.seconds_str);
|
||||
lastContactInfo = (TextView) this.findViewById(R.id.lastContactInfo_label_str);
|
||||
|
@ -160,6 +156,154 @@ public class Status extends Activity {
|
|||
|
||||
}//end updateLastContactInfo
|
||||
|
||||
//Set layout values to current
|
||||
private void showLastValues() {
|
||||
|
||||
// latitude
|
||||
TextView textView = (TextView)findViewById(R.id.latitude_value_str);
|
||||
textView.setText("");
|
||||
if (Core.latitude != Core.CONST_INVALID_COORDS) {
|
||||
textView.setText("" + Core.latitude);
|
||||
}
|
||||
// longitude
|
||||
textView = (TextView)findViewById(R.id.longitude_value_str);
|
||||
textView.setText("");
|
||||
if (Core.longitude != Core.CONST_INVALID_COORDS) {
|
||||
textView.setText("" + Core.longitude);
|
||||
}
|
||||
// battery level
|
||||
textView = (TextView)findViewById(R.id.battery_value_str);
|
||||
textView.setText("");
|
||||
if (Core.batteryLevel != Core.CONST_INVALID_BATTERY_LEVEL) {
|
||||
textView.setText("" + Core.batteryLevel);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
textView = (TextView)findViewById(R.id.orientation_value_str);
|
||||
textView.setText("");
|
||||
|
||||
if (Core.orientation != Core.CONST_INVALID_ORIENTATION) {
|
||||
textView.setText("" + Core.orientation);
|
||||
}
|
||||
|
||||
textView = (TextView)findViewById(R.id.proximity_value_str);
|
||||
textView.setText("");
|
||||
if (Core.proximity != Core.CONST_INVALID_PROXIMITY) {
|
||||
textView.setText("" + Core.proximity);
|
||||
}
|
||||
*/
|
||||
|
||||
// task
|
||||
textView = (TextView)findViewById(R.id.task_value_str);
|
||||
textView.setText("");
|
||||
if (Core.taskStatus.equals("enabled") && Core.taskHumanName.length() != 0) {
|
||||
String text = Core.taskHumanName + " ( " + Core.task + " ): ";
|
||||
if (Core.taskRun.equals("true")) {
|
||||
text = text + getString(R.string.running);
|
||||
}
|
||||
else {
|
||||
text = text + getString(R.string.stopped);
|
||||
}
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
// freeMemory
|
||||
textView = (TextView)findViewById(R.id.memory_value_str);
|
||||
textView.setText("");
|
||||
if (Core.memoryStatus.equals("enabled")) {
|
||||
String textMemory = getString(R.string.memory_avaliable_str);
|
||||
textMemory = textMemory.replaceFirst("%i", "" + Core.availableRamKb);
|
||||
textMemory = textMemory.replaceFirst("%i", "" + Core.totalRamKb);
|
||||
textView.setText(textMemory);
|
||||
}
|
||||
// upTime
|
||||
textView = (TextView)findViewById(R.id.uptime_value);
|
||||
textView.setText("");
|
||||
if (Core.upTime != 0) {
|
||||
textView.setText("" + Core.upTime+" "+ getString(R.string.seconds));
|
||||
}
|
||||
|
||||
//Only set values if sim present
|
||||
//if no sim these views aren't present as different layout is loaded
|
||||
if (Core.hasSim) {
|
||||
// simID
|
||||
textView = (TextView)findViewById(R.id.sim_id_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.simID);
|
||||
|
||||
// networkOperator
|
||||
textView = (TextView)findViewById(R.id.network_operator_value);
|
||||
textView.setText("");
|
||||
if (Core.networkOperator != null) {
|
||||
textView.setText("" + Core.networkOperator);
|
||||
}
|
||||
|
||||
// networkType
|
||||
textView = (TextView)findViewById(R.id.network_type_value);
|
||||
textView.setText("");
|
||||
if (Core.networkType != null) {
|
||||
textView.setText("" + Core.networkType);
|
||||
}
|
||||
|
||||
// phoneType
|
||||
textView = (TextView)findViewById(R.id.phone_type_value);
|
||||
textView.setText("");
|
||||
if(Core.phoneType != null)
|
||||
textView.setText("" + Core.phoneType);
|
||||
|
||||
// signalStrength
|
||||
textView = (TextView)findViewById(R.id.signal_strength_value);
|
||||
textView.setText("");
|
||||
if(Core.signalStrength != 0)
|
||||
textView.setText("" + Core.signalStrength+"dB");
|
||||
|
||||
// SMSReceived
|
||||
textView = (TextView)findViewById(R.id.sms_received_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.SMSReceived);
|
||||
|
||||
// SMSSent
|
||||
textView = (TextView)findViewById(R.id.sms_sent_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.SMSSent);
|
||||
|
||||
// incomingCalls
|
||||
textView = (TextView)findViewById(R.id.incoming_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.incomingCalls);
|
||||
|
||||
// missedCalls
|
||||
textView = (TextView)findViewById(R.id.missed_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.missedCalls);
|
||||
|
||||
// outgoingCalls
|
||||
textView = (TextView)findViewById(R.id.outgoing_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.outgoingCalls);
|
||||
|
||||
// receiveBytes
|
||||
textView = (TextView)findViewById(R.id.receive_bytes_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.receiveBytes);
|
||||
|
||||
// transmiteBytes
|
||||
textView = (TextView)findViewById(R.id.transmit_bytes_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.transmitBytes);
|
||||
|
||||
// roaming
|
||||
textView = (TextView)findViewById(R.id.roaming_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.roaming);
|
||||
|
||||
}//end simID if
|
||||
|
||||
}
|
||||
|
||||
//For debugging
|
||||
|
||||
/* For debugging
|
||||
private void setButtonEvents() {
|
||||
// Set update button events
|
||||
|
@ -194,143 +338,22 @@ public class Status extends Activity {
|
|||
});
|
||||
|
||||
}//end button events
|
||||
*/
|
||||
|
||||
private void showLastValues() {
|
||||
|
||||
|
||||
|
||||
private void updateLastXML() {
|
||||
|
||||
// latitude
|
||||
TextView textView = (TextView)findViewById(R.id.latitude_value_str);
|
||||
textView.setText("");
|
||||
if (Core.latitude != Core.CONST_INVALID_COORDS) {
|
||||
textView.setText("" + Core.latitude);
|
||||
}
|
||||
// longitude
|
||||
textView = (TextView)findViewById(R.id.longitude_value_str);
|
||||
textView.setText("");
|
||||
if (Core.longitude != Core.CONST_INVALID_COORDS) {
|
||||
textView.setText("" + Core.longitude);
|
||||
}
|
||||
//Battery level
|
||||
textView = (TextView)findViewById(R.id.battery_value_str);
|
||||
textView.setText("");
|
||||
if (Core.batteryLevel != Core.CONST_INVALID_BATTERY_LEVEL) {
|
||||
textView.setText("" + Core.batteryLevel);
|
||||
}
|
||||
TextView xml = (TextView) this.findViewById(R.id.xml);
|
||||
SharedPreferences agentPreferences = PandroidAgent.getSharedPrefs();
|
||||
|
||||
|
||||
/*
|
||||
textView = (TextView)findViewById(R.id.orientation_value_str);
|
||||
textView.setText("");
|
||||
|
||||
if (Core.orientation != Core.CONST_INVALID_ORIENTATION) {
|
||||
textView.setText("" + Core.orientation);
|
||||
}
|
||||
|
||||
textView = (TextView)findViewById(R.id.proximity_value_str);
|
||||
textView.setText("");
|
||||
if (Core.proximity != Core.CONST_INVALID_PROXIMITY) {
|
||||
textView.setText("" + Core.proximity);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
textView = (TextView)findViewById(R.id.task_value_str);
|
||||
textView.setText("");
|
||||
if (Core.taskStatus.equals("enabled") && Core.taskHumanName.length() != 0) {
|
||||
String text = Core.taskHumanName + " ( " + Core.task + " ): ";
|
||||
if (Core.taskRun.equals("true")) {
|
||||
text = text + getString(R.string.running);
|
||||
}
|
||||
else {
|
||||
text = text + getString(R.string.stopped);
|
||||
}
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
// freeMemory
|
||||
textView = (TextView)findViewById(R.id.memory_value_str);
|
||||
textView.setText("");
|
||||
if (Core.memoryStatus.equals("enabled")) {
|
||||
String textMemory = getString(R.string.memory_avaliable_str);
|
||||
textMemory = textMemory.replaceFirst("%i", "" + Core.availableRamKb);
|
||||
textMemory = textMemory.replaceFirst("%i", "" + Core.totalRamKb);
|
||||
textView.setText(textMemory);
|
||||
}
|
||||
// upTime
|
||||
textView = (TextView)findViewById(R.id.uptime_value);
|
||||
textView.setText("");
|
||||
if (Core.upTime != 0) {
|
||||
textView.setText("" + Core.upTime+" "+ getString(R.string.seconds));
|
||||
}
|
||||
// simID
|
||||
|
||||
if (Core.hasSim) {
|
||||
textView = (TextView)findViewById(R.id.sim_id_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.simID);
|
||||
|
||||
// mobile operator
|
||||
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.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);
|
||||
|
||||
// phoneType
|
||||
textView = (TextView)findViewById(R.id.phone_type_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.phoneType);
|
||||
|
||||
// signalStrength
|
||||
textView = (TextView)findViewById(R.id.signal_strength_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.signalStrength+"dB");
|
||||
|
||||
//incomingCalls
|
||||
textView = (TextView)findViewById(R.id.incoming_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.incomingCalls);
|
||||
|
||||
//missedCalls
|
||||
textView = (TextView)findViewById(R.id.missed_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.missedCalls);
|
||||
|
||||
// outgoingCalls
|
||||
textView = (TextView)findViewById(R.id.outgoing_calls_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.outgoingCalls);
|
||||
|
||||
// receiveBytes
|
||||
textView = (TextView)findViewById(R.id.receive_bytes_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.receiveBytes);
|
||||
|
||||
// transmiteBytes
|
||||
textView = (TextView)findViewById(R.id.transmit_bytes_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.transmitBytes);
|
||||
|
||||
// roaming
|
||||
textView = (TextView)findViewById(R.id.roaming_value);
|
||||
textView.setText("");
|
||||
textView.setText("" + Core.roaming);
|
||||
|
||||
}//end simID if
|
||||
String lastXML = agentPreferences.getString("lastXML", "[no data]");
|
||||
xml.setText("Last XML builded: \n\n" + lastXML);
|
||||
|
||||
}
|
||||
private void hideLastXML(){
|
||||
TextView xml = (TextView) this.findViewById(R.id.xml);
|
||||
xml.setText("");
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue