Add device identifier
Этот коммит содержится в:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.traccar.client"
|
package="org.traccar.client"
|
||||||
android:versionCode="2"
|
android:versionCode="4"
|
||||||
android:versionName="1.1">
|
android:versionName="1.3">
|
||||||
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
|
||||||
<activity android:name="TraccarActivity"
|
<activity android:name="TraccarActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -54,6 +54,23 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="10sp"
|
android:layout_height="10sp"
|
||||||
/>
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Device identifier"
|
||||||
|
/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/edit_device"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="none"
|
||||||
|
android:editable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
/>
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="10sp"
|
||||||
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.text.method.*;
|
|||||||
import android.text.util.*;
|
import android.text.util.*;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global parameters
|
* Global parameters
|
||||||
@@ -63,6 +64,7 @@ public class TraccarActivity extends Activity {
|
|||||||
private EditText editAddress;
|
private EditText editAddress;
|
||||||
private EditText editPort;
|
private EditText editPort;
|
||||||
private EditText editPeriod;
|
private EditText editPeriod;
|
||||||
|
private EditText editDevice;
|
||||||
private EditText editService;
|
private EditText editService;
|
||||||
private EditText editConnection;
|
private EditText editConnection;
|
||||||
private ToggleButton button;
|
private ToggleButton button;
|
||||||
@@ -84,17 +86,25 @@ public class TraccarActivity extends Activity {
|
|||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
// DO SOMETHING WITH IT
|
// DO SOMETHING WITH IT
|
||||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
try {
|
||||||
StrictMode.setThreadPolicy(policy);
|
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||||
|
StrictMode.setThreadPolicy(policy);
|
||||||
|
} catch(Throwable e) {
|
||||||
|
}
|
||||||
|
|
||||||
// Bind elements
|
// Bind elements
|
||||||
editAddress = (EditText) findViewById(R.id.edit_address);
|
editAddress = (EditText) findViewById(R.id.edit_address);
|
||||||
editPort = (EditText) findViewById(R.id.edit_port);
|
editPort = (EditText) findViewById(R.id.edit_port);
|
||||||
editPeriod = (EditText) findViewById(R.id.edit_period);
|
editPeriod = (EditText) findViewById(R.id.edit_period);
|
||||||
|
editDevice = (EditText) findViewById(R.id.edit_device);
|
||||||
editService = (EditText) findViewById(R.id.edit_service);
|
editService = (EditText) findViewById(R.id.edit_service);
|
||||||
editConnection = (EditText) findViewById(R.id.edit_connection);
|
editConnection = (EditText) findViewById(R.id.edit_connection);
|
||||||
button = (ToggleButton) findViewById(R.id.button);
|
button = (ToggleButton) findViewById(R.id.button);
|
||||||
|
|
||||||
|
// Set device identifier
|
||||||
|
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
editDevice.setText(telephonyManager.getDeviceId());
|
||||||
|
|
||||||
editService.setText(Traccar.STATUS_STOPPED);
|
editService.setText(Traccar.STATUS_STOPPED);
|
||||||
editConnection.setText(Traccar.STATUS_DISCONNECTED);
|
editConnection.setText(Traccar.STATUS_DISCONNECTED);
|
||||||
button.setChecked(isServiceRunning());
|
button.setChecked(isServiceRunning());
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user