Comments (8)
Hi @utkarshGithub, sorry for taking a while to reply. Did you manage to solve the problem?
Your code appears to be fine (however, if you set the errorActivity via CaocConfig, the intent-filter is not really needed). Could you provide a minimal project so I can check if there is any other issue that causes this?
Thanks!
from customactivityoncrash.
The same issue.
Some details:
Tested on OnePlus 5 with 7.1 android and HTC One S on 4.1.
Caoc ver. 2.2.0
compileSdkVersion 26
buildToolsVersion '26.0.2'
...
targetSdkVersion 26
...
compile 'cat.ereza:customactivityoncrash:2.2.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
Config in application class:
CaocConfig.Builder.create()
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT)
.logErrorOnRestart(true)
.errorActivity(CrashActivity.class)
.apply();
CrashActivity.class is my custom activity which works absolutely 100%.
The issue takes part if I call throw new RuntimeException(); at the end of activitie's onCreate method - there will be nothing. If I call it from onDestroy/onResume etc. it will work right.
Also, if I use throw with some delay it will work!
// At the end of onCreate in first activity
new Handler().postDelayed(new Runnable() {
@Override public void run() {
}
}, 500);
It seems as if it does not have time to start. If I call any exception after some delay from initialization - it will work fine. Also, it will work fine in any onCreate methods in future activities.
from customactivityoncrash.
Hi @DominuS-RU, can you provide a minimal project with all the code so I can reproduce the issue? I'm assuming that the problem doesn't happen on the sample project, can you check?
Thanks!!
from customactivityoncrash.
@Ereza Hello!
I've updated my previous comment with some details.
I'll test sample project and will try to give you test one in some hours.
Hope, my current details will help you.
from customactivityoncrash.
Thanks, I'll take a look into it!
from customactivityoncrash.
@Ereza, I've found the mistake.
It's the config for your sample:
CaocConfig.Builder.create()
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT)
.apply();
An exception for MainActivity
throw new RuntimeException("boom");
Then, start you application and see nothing.
The main issue in .backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT), if we delete this one the library will work fine. All behavior is repeated as I've described in my first comment.
from customactivityoncrash.
Anything new about this issue?
from customactivityoncrash.
Hi, sorry for the ultralate reply.
With the examples you provided, I saw that there was an issue when the background mode is "silent" and the app is being launched. The background/foreground detection mechanism relies on started activities, and obviously a new activity that crashes in onCreate
is not started yet, so the library thinks that the app is in background and does not show the error activity.
I solved this by recording the last time an activity was created (onActivityCreated
is called before onCreate
ends). If the activity crashes while in "background" but the last activity creation was less than 500 ms ago, the app is assumed to be in foreground and the activity is shown.
This will be available in the next release of the library.
from customactivityoncrash.
Related Issues (20)
- Crash on Android 4.1.2 and 4.4
- incompatible with wrapper shell script HOT 2
- Not working with firebase Crashlytics HOT 3
- Plagiarism of your library HOT 1
- Is it possible to show a fragment instead of activity for crashes? HOT 1
- may provide a callback with the Throwable object
- Not works with FirebaseFirestore HOT 3
- errorActivity will not launch when I do something in eventListener->onLaunchErrorActivity HOT 2
- Deleted everthing on my phone HOT 2
- Is this testable? HOT 1
- Wrong build date info HOT 2
- NoWork at remi note 10x HOT 1
- call api before crash HOT 1
- crash from webrtc framework HOT 1
- Not fetching from the module crash response
- Another lib that goes well with CustomActivityOnCrash
- How to use with Sentry
- ability to pass argument to the Custom Crash Activity
- Automatic retry restart app
- App is get Crash on launch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from customactivityoncrash.