I have an Ionic app that correctly works in the IonicLab, both while running and debugging it.
The same code, when run or debugged on a real Android device, fails to initialize the argument in one of the then() callbacks of an Observable. Most other (I suspect all other) Observable instances around my code do work correctly.
If I were to guess the cause, I'd say that non-working-on-real-device Observable is too nested into a chain of enclosing Promises, but that's just a random guess by a random Angular newbie.
Here is what I see when I debug the app attached to the real Android device:
As you can see, the profile variable is undefined, but, as I understand how Observable.then() works, it should have a value, as it in fact does have when run in the IonicLab.
What am I missing?
Related
Im trying to develop an app that checks your device's security, and im working on a feature that checks if the pattern is visible (In the lock screen, if u have a pattern and it shows on the screen).
Some versions ago, you could check this in Settings.Secure with:
Settings.Secure.getInt(contentResolver, Settings.Secure.LOCK_PATTERN_VISIBLE)
They changed it and now it is on a class called LockPatternUtils, and the method is called isVisiblePatternEnabled.
The only way to access this class is through reflection, but when I do it, it throws InvocationTargetException caused by NullPointerException.
I tried to debug but got "source code does not match byte code", so I checked the source code in Android Code Search, and it throws NullPointerException cause inside this method, they use ServiceManager.getService("lock_settings"), and that specific part of code returns null.
It says that getService returns "a reference to the service, or null if the service doesn't exist".
The thing is that this service DOES exist, as when I execute the adb command to check a list of services that are running on the emulator, it appears.
So, here is my question: Is there anything that I'm missing?
I know this is a very old query, but I hope this helps.
Even with reflection, only system apps are allowed to get the 'lock_settings' service. This makes sense as these are secure features.
I would like to debug a system framework running on an Android device.
In particular, GpsLocationProvider sometimes stops for a while, and I would like to know what it is doing. I found the class contains a android.os.Handler that gets messages posted to it, to communicate between threads. Sometimes it takes minutes between a message is sent, and Handler.handleMessage is called. I interpret that the thread belonging to the Handler's Looper is busy.
I would like to attach a debugger, pause that thread, and see what's currently executing. Alternatively, somehow get a traceback of that thread. Is there any way to do that?
I tried creating an Android Studio project from the source tree with development/tools/idegen/idegen.sh, but I'm not sure how to proceed from there. In case it matters, the (legacy) device is running Android 6.
I've also just discovered debuggerd. I call logcat -s GpsLocationProvider to find the corresponding PID, and feed it to debuggerd, both with and without -b argument. However, this only gives be a backtrace into native code. I don't see any java code there.
If I'm not mistaken, if you have the respective Android API version in your AndroidStudio (installed through SDK Manager), you can install debug variant of your app on the device and then put breakpoints inside Android's code.
This way you can pause the execution of the component's code and see what it's doing.
I am trying to debug a Nativescript app for Android and I have noticed that it no longer prints Syntax errors with their corresponding line and col. numbers, not even console.log statements. How can I enable this feature again? The command I use to launch the app is tns run android. I am using Nativescript version 2.5.2. The VSCode plugin doesn't work either as it ignores any breakpoint I place, and also the console doesn't show any errors. What can I do?
Edit:
It appears that only console.error() statements get printed.
After tinkering a lot with different kinds of constructions and by researching more into how Nativescript relates to regular browser JS, I found out that the problem lies in the use of Promises, which in case of errors defer the execution to the catch() method, but unlike any other regular programming language, "unhandled" rejected results within promises won't raise any kind of exception; which means that, basically, for any promise you invoke in your code, you should have a chained catch() method call so you effectively catch any errors your promises might produce. This also applies to promises which involve navigation, where stuff gets a lot trickier: You might think the next view (say, view.js) will have a call stack on its own and produce an unhandled exception at code that's not even inside a promise in there, but that's not the case: An exception produced at view.js will get captured by the catch() method of the promise within which you started the navigation, and any subsequent promises must have their own catch() method calls because errors won't get bubbled up to the previous view. I can think of many other troublesome constructions but I hope the important bit stays clear: always chain a catch call on any and all promises.
I'm writing an espresso test for a login activity that sets cookies:
CookieManager.getInstance().setCookie(name, value)
But the test hangs at the above code then times out. Looking into the setCookie code I think it calls some native jni method.
I can't try setCookie(name, value, callback) because the code needs to support API level 19.
Any idea why this is happening?
Many thanks!
Update: just to add that this seems to only happen when test is run against emulator. It runs without problem against a real device.
In our Android app, we are using saveEventually() and saveInBackground() of parse sdk (version 1.8.0).
It seems to work fine mostly but sometimes all calls to saveEventually and saveInBackground fail with the callback not getting called.
when this happens, we are still able to fetch data from Parse i.e. all read queries work.
We are using local storage. The updates start working again once we clear the app data.
What could be causing this?
It's because Parse.enableLocalDatabse() is on. I had this one before - it's hard to get to this point (it took me couple of days to figure it out). So get rid of this one in Your Application class and it should work.
Oh, and get latest version 1.10.3