Android 5.0 incoming call does not invoke Activity.onPause() call any more? - android-5.0-lollipop

I have an app that has code to handle incoming call as part of its function. It depends on the fact that incoming calls will invoke Activity.onPause(). However, on Samsung S6 with Android v5.0.2, incoming call event does not seem to call that method anymore.
Have I missed anything? If not, is there a work around?

I've tested Android 5.1, and the incoming call does not invoke onPause. But it the call is answered, then onPause is being invoked.
What I don't understand is why onStop is not being called, if the activity is not visible when the call is answered.

Related

For Flex remote object calls (BlazeDS), is there a size limitation on objects returned?

I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build. The same call works fine when running on the device (iPhone) using debug build. When running with a release build, the result handler is never called (nor is the fault handler called). Viewing the BlazeDS logs in debug mode, the call is received and send back with data. I've narrowed it down to what seems to be a data size issue.
I have targeted one specific data call that returns in the String value a string length of 44kb, which fails (release build). When I do not populate the String value (in server side Java code) on the object (just set it empty string), the result handler is called, and the object is returned, again, using the release build. This works in a debug build.
The custom object being returned in the call is a very a simple object, with getters/setters for simple types boolean, int, String, and one org.23c.dom.Document type. This same object type is used on other other RemoteObject calls (different data) and works fine (release and debug builds). I originally was returning as a Document, but, just to make sure this wasn't the problem, changed the value to be returned to a String, just to rule out XML/Dom issues in serialization.
I don't understand 1) why the release build vs. debug build behavior is different for a RemoteObject call, 2) why the calls work in debug build when sending over a somewhat large (but, not unreasonable) amount of data in a String object, but not in release build.
I have't tried to find out exactly where the failure point in size is, but, not sure that's even relevant, since 44kb isn't an unreasonable size to expect.
By turning on the Debug mode in BlazeDS, I can see the object and it's attributes being serialized and everything looks good there. The calls are received and processed appropriately in BlazeDS for both debug and release build testing.
Anyone have an idea on other things to try to debug/resolve this?
Platform testing is BlazeDS 4, Flashbuilder 4.7, Websphere 8 server, iPhone (iOS 7.1.2). Tried using multiple Flex SDK's 4.12 to the latest 4.13, with no change in behavior.
Thanks!
After a week's worth of debugging, I found the issue.
The Java type returned from the call was defined as ArrayList. Changing it to List resolved the problem.
I'm not sure why ArrayList isn't a valid return type, I've been looking at the Adobe docs, and still can't see why this isn't valid. And, why it works in Debug mode and not in Release build is even stranger. Maybe someone can shed some light on the logic here to me.

Handle specific exception that is not related to an exchange

I created a custom component for a proprietary service. If this service is down i get noticed via a call of a callback function. I am throwing a custom exception at this point.
Sending exchanges to the producer/ consumer will yield no errors or exceptions (all seems to fine).
So i need to implement an emergency stop if my custom exception is thrown. I read a bit about exception handling in camel. I think i need a context-scoped onException(MyException.class).??? but what then?
Is this working on exceptions that are called without relation to an exchange? If this is working how to handle it. I want to stop certain routes in this case.
here you can find to stop routes from a route: http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html.
If you do the call of the proprietary service in a route you do have an exchange btw.
kind regards,
soilworker
I created a little workaround: I set a boolean i the callback method is called. On each call of process i check this boolean and if true i throw an exception.
With this the exception is within normal camel exception handling and onException could be used.

win 8 app call back handler - waiting on a runasync operation C++

I have a win 8 application written in unmanaged c++/cx which has a callback handler. The call back handler posts a notification to a UI thread.
I want to wait on the UI dispatch handler's background task.
I have the following code -
dispatcher->RunAsync(Windows::UI::CoreDispatcherPriority::Normal,lambda);
In the lambda, I update a view model that is bound to my view. I want to wait on this operation and check on the view model. Is it possible in unmanaged c++ ?? It is part of the unit testing that am doing on the app.
I found code references to achieve this in C#. I am not familiar with C++/CX to get this done. I would like comments on ideas to accomplish this. Thank you so much!
regards,
Varsha

Pass function as an argument in a function javascript to NPAPI

On javascript Object i am invoking
obj.requestFileSystem(LOCAL,5*1024*1024) . This method is implemented in PlainNAPI Plugin , now i have to pass one success callback to this function as follows......
obj.requestFileSystem(LOCAL,5*1024*1024,initFS); // initFS is a function in javascript that is an argument to the success callback .
In NPAPI it is an object when the requestFileSystem is completed then initFS function in javascript should be called. How to return from NPAPI plugin to javascript and to execute initFS function.
function initFS(fs) {
alert('Inside the initFS');
alert(fs.root.getFullPath);
}
Please don't tell me what you're actually doing with this plugin, since it sounds like it's something akin to giving people access to things from a web browser that could easily be abused by someone else.
Basically a function is just an NPObject when it gets to your function inside NPRuntime; to call the function you just do a NPN_InvokeDefault on that NPObject.
Note that you must be on the main thread in order to call nearly all NPN_ functions.
EDIT: So if you have to do the callback from a different thread then your easiest solution is to use NPN_PluginThreadAsyncCall; basically you create an object to hold the data you need and call PluginThreadAsyncCall with that pointer as the void* parameter and it will get passed to the function you specify.
Make sure that A) the pointer will still be valid, and B) your function is able to free that memory after it runs. From the callback function you can call NPN_InvokeDefault safely.
Not that NPN_PluginThreadAsyncCall doesn't seem to work on Safari 5.1 anymore. If you need that support or if what I've explained doesn't make sense you might want to consider using FireBreath to build your plugin; it does all of this for you.

Flex WebService invokeAllPending never called

I been using the WebService and Operation classes of Flex Framework for a while, and after some ups and downs (more downs than ups, haha) I'm in process of refactoring all its uses with some utility classes/wrappers.
After browsing a little of the code of mx.rpc.soap.Operation I noticed that when you use the method "send" and the web service is not ready then the call is queued to an internal array (pendingInvocations:Array in line 1142). But the funny thing is that the invocations in the queue are never called again.
This is a bug or there is something I'm doing wrong?
I'm considering extending mx.rpc.soap.Operation, overriding "send" and testing if there are invocation queued, calling invokeAllPending (a mx_internal method that pops all the queued invocations) my self.
But the other problem is that that method is mx_internal, so I don't know if Adobe is gonna change it any time soon.
Any advice?
Thanks in advance
It's not a bug. Take a look at the definition for AbstractWebService; it defines a method called unEnqueueCalls (which is right up near the top of the list of awkward method names that I've seen :)). This method loops through all the operations in the webservice and invokes the pending calls for each operation by calling that invokeAllPending method you found.
unEnqueueCalls is itself called from the WebService class, in the wsdlFault and wsdlHandler methods, one of which runs when your WSDL is finished loading.
So, everything is all accounted for; you don't need to override anything.