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