Commit 9832c508 by Chayaa852

Socket related changes

parent 84d408af
......@@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature
android:name="android.hardware.camera"
......
......@@ -19,6 +19,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.provider.MediaStore;
import android.speech.tts.TextToSpeech;
import android.speech.tts.UtteranceProgressListener;
......@@ -115,7 +116,7 @@ import static com.vsoft.vera.db.DBManager.DATABASE_NAME;
*/
public class ChatActivity extends AppCompatActivity implements OnDSListener, OnDSPermissionsListener {
private static final String TAG = "ChatActivity";
private static final String TAG = ChatActivity.class.getName();//"ChatActivity";
private static String NEW_MESSAGE = "new message";
private static String AUTHENTICATED = "authenticated";
private static String UNAUTHORIZED = "unauthorized";
......@@ -180,7 +181,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
private static final String HTTPS = "https://";
private static final String HTTP = "http://";
private LinearLayout mainLayt;
private PowerManager.WakeLock wl;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -197,6 +198,14 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
});
PowerManager pm = (PowerManager)getApplicationContext().getSystemService(
Context.POWER_SERVICE);
this.wl = pm.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK
| PowerManager.ON_AFTER_RELEASE,
TAG);
wl.acquire();
mLoggedInUserSysId = PrefManager.getSharedPref(this, PrefManager.PREFERENCE_USER_SYS_ID);
mLoggedInUsername = PrefManager.getSharedPref(this, PrefManager.PREFERENCE_USER_FIRST_NAME);
userSysId = PrefManager.getSharedPref(this, PrefManager.PREFERENCE_USER_SYS_ID);
......@@ -1334,6 +1343,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
mSocket.off(AUTHENTICATED, authenticated);
mSocket.off(UNAUTHORIZED, unAuthorized);
}
wl.release();
if(speaker != null) {
speaker.destroy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment