-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ti.Platform.displayCaps throwing error on getWindowManager() #13421
Comments
I can make a PR with m1ga@cb8e240 Could it be that the login window is closed right away (e.g. user is logged in already)? To reduce Java calls you could also just do |
@m1ga can add a null check, but that would also mean he has no choice but to return zero which isn't what you want, but natively he has no choice. This will only be an issue if there is no active UI/activities. If you're okay with an Android-only solution, then move your logic into the window's if (OS_ANDROID) {
$.win.activity.onCreate = () => {
// Do your thing here...
};
} Alternatively, move your code into a window "open" event listener. But the downside with this is you'll briefly see your views move after the 1st rendered frame. |
Yes, it's the login screen, first screen created after index.js. |
@jordanbisato you can also try the artifact here: https://github.com/tidev/titanium_mobile/actions/runs/2226558143 with the PR |
@jordanbisato did #13421 (comment) solves your problem? |
I would actually argue to close the PR, since it's rather addressing the effects of the issue than the issue itself (a lifecycle issue based on the activity not being ready). Maybe a note about the |
Hi, in my last production build, i use the callback solution of jquick, and the error didn't occour again. |
@hansemannn I would prefer both 😄 Adding this PR will just remove the crash when people use it wrong (eg. from a closing window). I've added a note how to read the values d0c358a in the apidocs. |
I'm not suuuure. The APIs do not work as expected if the null check is used, so people should know that they have to properly initialize it. But you are leading Android, so if you want to take it, we will take it! |
I have searched and made sure there are no existing issues for the issue I am filing
Description
I was looking at my crashlytics reports and found some error on displayCaps in some devices.
It mainly happens on Motorola and some Samsung Galaxy J family.
The error on Crashlytics:
I see the code and i suspect that the error is caused on this line:
https://github.com/tidev/titanium_mobile/blob/master/android/modules/platform/src/java/ti/modules/titanium/platform/DisplayCapsProxy.java#L36
Is there a chance of Activity be null? How can it can be avoided?
Thanks!
Expected Behavior
Don't throw error
Actual behavior
Throwing error
Reproducible sample
Steps to reproduce
I don't know because it happened on a production build and i get the errors on firebase crashlytics console.
But it happened on following devices:
Platform
Android
SDK version you are using
10.1.1.GA
Alloy version you are using
1.17.3
The text was updated successfully, but these errors were encountered: