Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
70d0952f
Commit
70d0952f
authored
Feb 22, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enables StrictMode with log penalty
parent
7694ff8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
RocketChatApplication.java
.../main/java/chat/rocket/android/RocketChatApplication.java
+19
-0
No files found.
app/src/main/java/chat/rocket/android/RocketChatApplication.java
View file @
70d0952f
package
chat
.
rocket
.
android
;
package
chat
.
rocket
.
android
;
import
android.os.StrictMode
;
import
android.support.multidex.MultiDexApplication
;
import
android.support.multidex.MultiDexApplication
;
import
com.facebook.stetho.Stetho
;
import
com.facebook.stetho.Stetho
;
import
com.uphyca.stetho_realm.RealmInspectorModulesProvider
;
import
com.uphyca.stetho_realm.RealmInspectorModulesProvider
;
...
@@ -19,6 +20,10 @@ import chat.rocket.persistence.realm.RocketChatPersistenceRealm;
...
@@ -19,6 +20,10 @@ import chat.rocket.persistence.realm.RocketChatPersistenceRealm;
public
class
RocketChatApplication
extends
MultiDexApplication
{
public
class
RocketChatApplication
extends
MultiDexApplication
{
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
if
(
BuildConfig
.
DEBUG
)
{
enableStrictMode
();
}
super
.
onCreate
();
super
.
onCreate
();
RocketChatPersistenceRealm
.
init
(
this
);
RocketChatPersistenceRealm
.
init
(
this
);
...
@@ -39,4 +44,18 @@ public class RocketChatApplication extends MultiDexApplication {
...
@@ -39,4 +44,18 @@ public class RocketChatApplication extends MultiDexApplication {
RocketChatWidgets
.
initialize
(
this
,
OkHttpHelper
.
getClientForDownloadFile
(
this
));
RocketChatWidgets
.
initialize
(
this
,
OkHttpHelper
.
getClientForDownloadFile
(
this
));
}
}
private
void
enableStrictMode
()
{
StrictMode
.
setThreadPolicy
(
new
StrictMode
.
ThreadPolicy
.
Builder
()
.
detectDiskReads
()
.
detectDiskWrites
()
.
detectNetwork
()
// or .detectAll() for all detectable problems
.
penaltyLog
()
.
build
());
StrictMode
.
setVmPolicy
(
new
StrictMode
.
VmPolicy
.
Builder
()
.
detectLeakedSqlLiteObjects
()
.
detectLeakedClosableObjects
()
.
penaltyLog
()
.
build
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment