Can we cancel a method invoked using PhoneGap.exe - iphone

I am new to PhoneGap and I am trying to develop a small iPhone application based on PhoneGap. My question is, is there a way to cancel the execution of a method invoked by calling PhoneGap.exec() method. Something like PhoneGap.Cancel() or something..?
Thanks.

in exec only, you can send an action to cancel any action that you had previously initiated using exec.

Related

Is there a standard / built-in way to handle race conditions with CKFetchRecordZoneChangesOperation?

I'm building my first CloudKit application, and am using CKFetchRecordZoneChangesOperation on startup to get any new records changed while the current device was offline.
I am also calling CKFetchRecordZoneChangesOperation when I receive a subscription notification of changes.
It is possible the subscription notification could come in before the startup call finishes. I am currently using a lock to prevent the 2nd call from starting until the recordZoneFetchCompletionBlock handler is called, signalling that the first one is done. This works, but it also smells a bit hacky.

Is Application.onFirstStart event fired on application upgrade?

Is Application.onFirstStart event fired on application upgrade? If not, is there any way to do something only once on upgrade or on the first start after upgarde?
onFirstStart will not run on update.
You can use onStart function, inside this function you can control application.version in order to understand if application is upgraded or not.

When we use delegate and Call back in iOS?

I'm very new on iOS application development so please explain me about delegate and call back. When we use use call back and delegate?
Call backs are used to allow an API or service to provide information to your code when certain events occur (e.g. when a task has completed). This is useful in asynchronous programming, e.g. when you want your current thread to get on with something else, or to allow the user to continue using the UI. (i.e. a call back is a function or lambda you have written, which is passed as a parameter to another method)
A delegate is the 'signature' (the 'type definition' of a method, including parameters) that a method (such as a call back) must provide in order for it to be useable as callback or event handler.
Edit Just to be complete, Delegation is also a design pattern, whereby the responsibility of control or action is delegated from one object to another.
Big piece about delegates here on the dev centre:
http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html
There is a tutorial app using callback/delegate
http://brandontreb.com/objective-c-programming-tutorial-creating-a-twitter-client-part-1/

How create a custom event handler for ctcall center? iphone

I am working on an application in which i have a requirement of detect call log info.
Means when ever a call coming and going and then after attending call that will disconnect. So i have detect and send a notification when call disconnect.
For this requirement i have done so much r&d and get some results but when i go through Apple's doc for core telephony framework then there is class "CTCallCenter". This class provide a event handler which will invoke app whenever a call state change.
Now problem is that when i go through document of that class then i get som texts which is shown below
To handle such call events, define a handler block in your application and assign it to this property. You must implement the handler block to support being invoked from any context.
link of apple doc for core telephony framework
In above text write down that u have to create a event handler and assign to property then it will handle call events.
So problem is that how I create a custom event handler and how make a property and assign to my custom event handler?
Thanks in advance...
Take a look at CoreTelephonyDemo. You will find your answer in there.
The event handler is a block. You can also look at Blocks Programming Topics

What's Android Equivalent of iOS's Post Notification and Delegate function?

I find the Post notification and delegate function are very useful in iOS. Once I finish a task I can notify another piece of code to do something. I am sending out notices for others to do the work.
Post Notification is when you sending notice right away, whereas delegate sometime down the line it will send a notice.
In Android I know there's event Listener, but that's only passive listening. What about me actively sending notices? Does Android have that equivalent?
Handler which can be fired right away or with postDelay() you can fire them later
You could either use a Handler to get notified from a running Thread or the AsyncTask which does run some code and after it's finished it notifies the UI Thread.
You are probably looking for a way to thread your application? Where there are other "worker" threads that do long computations (or do buffered IO stuff). The way you would do this is by creating an AsyncTask. Within an AsyncTask, there is a "doInBackground" method that seems to be what "delegate" is in your question. "onPostExecute" will handle whatever's returned in "doInBackground". More in the AsyncTask documentation.
Another option is to simply use a Handler and use postDelay() for later executions: