This Android Phonegap plugin will notify your app whenever there is a missed call. This plugin was successfully tested with Phonegap 2.9 and Android 4.2.2 (on a Samsung Galaxy Nexus device).
<plugin name="MissedCallPlugin" value="org.apache.cordova.plugin.MissedCallPlugin"/>
<uses-permission android:name="android.permission.READ_CALL_LOG" />
To instantiate the plugin object:
var missedCallPlugin = cordova.require('cordova/plugin/missedcallplugin');
Start the missed call receiver waiting for missed calls The success callback function will be called everytime a call is missed. The callback will receive a JSON object containing the contactName and contactNumber. You can add more fields from MissedCallReceiver.java. The error callback is called if an error occurs.
Example:
missedCallPlugin.startReception (function(msg) {
alert(msg);
}, function() {
alert("Error while receiving call details");
});
Stop the missed call receiver
Example:
missedCallPlugin.stopReception (function() {
alert("Correctly stopped");
}, function() {
alert("Error while stopping the call receiver");
});
The source code is available here under MIT licence. Please send any bugs, feedback, complaints, patches to me at varunkumar[dot]n[at]gmail[dot]com.
-- Varun
Last Modified: Tue Jul 16 08:56:36 IST 2013