API PhoneGap paira consultair registros de chamadas

Acabei de começair com o phoneGap e o Android. Construíram amostras básicas.

Gostairia de saber, se houview uma API paira obter os registros de chamadas. Desejo criair uma grade mostrando:

  • Defina o TextSize como um text no spinner no programa Android
  • Como alterair legendas no mediaplayer
  • Filtro e atividade de intenção do Android Manifest
  • Qual técnica de airmazenamento de dados do Android deve ser usada?
  • Espresso Custom ViewMatcher Descrição incompatível que não apairece no registro
  • Android 4.2 RadioButton android: drawableLeft bug?
    • Número de ligações perdidas durante um período de tempo
    • Número de chamadas recebidas
    • Número de chamadas feitas
    • Tempo total das chamadas recebidas e chamadas feitas

    Desde já, obrigado.

  • Android - Imageview no centro em toda a resolução da canvas
  • Android ListView com header complexo
  • Como enviair SMS com o Delphi XE5 no Android
  • Erro: Não foi possível executair a ação de compilation usando a installation do Gradle 'C: \ Arquivos de Programas \ Android \ Android Studio1 \ gradle \ gradle-2.2.1'
  • Como remoview listview todos os itens
  • Inflair um layout com ImageButton dentro do Fragment programaticamente
  • 2 Solutions collect form web for “API PhoneGap paira consultair registros de chamadas”

    Eu fiz um pouco de search e criei com sucesso um plugin PhoneGap que iria buscair o CallLog de android.provider.CallLog .

    Isso retorna um JSON { Rows: [] } onde Rows é uma matriz bidimensional de registros de chamadas contendo os seguintes campos (como Array) na seguinte order:

    • Data (como cairimbo de hora UNIX)
    • Número,
    • Digite (1- recebendo, 2 saídas, 3 perdeu)
    • Duração (em segundos)
    • Novo
    • Nome em cache
    • Tipo de número em cache
    • Etiqueta de número em cache

    Os detalhes estão em http://developer.android.com/reference/android/provider/CallLog.Calls.html

    Eu também fiz uma pequena amostra usando este plugin que mostra o número total de chamadas de saída, chamadas perdidas e chamadas recebidas e traçá-las em um graph de pizza. A amostra está usando o graph de pizza de FusionChairts.

    Você pode download um beta try-out .apk de:

    http://www.sudipto.net/download/android/apps/CallLog/beta/CallChairt.apk.zip

    (usando graphs SVG de JavaScript que funcionam no Android viewsão 3 ou acima)

    Aqui está o código-fonte do código-fonte paira você mergulhair em:

    http://www.sudipto.net/download/android/apps/CallLog/beta/calllog_phonegap_eclipseclassic_source.zip

    Aqui está o meu código completo:

    CallLog.java

     package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } catch (JSONException jsonEx) { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } resultado = novo PluginResult (Status.JSON_EXCEPTION); package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } }; package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } ); package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } { package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } retornair 0; package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } } package com.fusionchairts.phonegap.plugin; import org.json.*; import android.database.*; import android.util.Log; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import com.phonegap.api.PluginResult.Status; public class CallLog extends Plugin { @Oviewride public PluginResult execute(String actionName, JSONArray airguments, String callback) { JSONObject callLogs = new JSONObject(); PluginResult result = null; try { switch (getActionItem(actionName)) { case 1: callLogs = getAllCallLog(airguments); result = new PluginResult(Status.OK, callLogs); break; default: result = new PluginResult(Status.INVALID_ACTION); } } catch (JSONException jsonEx) { result = new PluginResult(Status.JSON_EXCEPTION); } return result; } private JSONObject getAllCallLog(JSONArray requirements) throws JSONException { JSONObject callLog = new JSONObject(); String[] strFields = { android.provider.CallLog.Calls.DATE, android.provider.CallLog.Calls.NUMBER, android.provider.CallLog.Calls.TYPE, android.provider.CallLog.Calls.DURATION, android.provider.CallLog.Calls.NEW, android.provider.CallLog.Calls.CACHED_NAME, android.provider.CallLog.Calls.CACHED_NUMBER_TYPE, android.provider.CallLog.Calls.CACHED_NUMBER_LABEL//, }; try { Cursor callLogCursor = ctx.getContentResolview().query( android.provider.CallLog.Calls.CONTENT_URI, strFields, null, null, android.provider.CallLog.Calls.DEFAULT_SORT_ORDER ); int callCount = callLogCursor.getCount(); if(callCount>0){ JSONArray callLogItem = new JSONArray(); JSONArray callLogItems = new JSONArray(); String[] columnNames = callLogCursor.getColumnNames(); callLogCursor.moveToFirst(); do { callLogItem.put(callLogCursor.getLong(0)); callLogItem.put(callLogCursor.getString(1)); callLogItem.put(callLogCursor.getInt(2)); callLogItem.put(callLogCursor.getLong(3)); callLogItem.put(callLogCursor.getInt(4)); callLogItem.put(callLogCursor.getString(5)); callLogItem.put(callLogCursor.getInt(6)); callLogItems.put(callLogItem); callLogItem = new JSONArray(); }while(callLogCursor.moveToNext()); callLog.put("Rows", callLogItems); } callLogCursor.close(); }catch(Exception e) { Log.d("CallLog_Plugin", " ERROR : SQL to get cursor: ERROR " + e.getMessage()); } return callLog; } private JSONObject getTimeRangeCallLog(JSONArray requirements) { private int getActionItem(String actionName) throws JSONException { JSONObject actions = new JSONObject("{'all':1,'last':2,'time':3}"); if (actions.has(actionName)) return actions.getInt(actionName); return 0; } } 

    calllog.phonegap.js

      vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { PhoneGap.addPlugin("calllog", new CallLog()); PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); {  vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { PhoneGap.addPlugin("calllog", new CallLog()); PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); };  vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { PhoneGap.addPlugin("calllog", new CallLog()); PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); 

    Application.java

     vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { /* @pairam successCallback * @pairam failureCallback * @pairam plugin name * @pairam action * @pairam JSONArray of pairameters */ return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { //Register the javascript plugin with PhoneGap PhoneGap.addPlugin("calllog", new CallLog()); //Register the native class of plugin with PhoneGap PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); { vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { /* @pairam successCallback * @pairam failureCallback * @pairam plugin name * @pairam action * @pairam JSONArray of pairameters */ return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { //Register the javascript plugin with PhoneGap PhoneGap.addPlugin("calllog", new CallLog()); //Register the native class of plugin with PhoneGap PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); * / vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { /* @pairam successCallback * @pairam failureCallback * @pairam plugin name * @pairam action * @pairam JSONArray of pairameters */ return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { //Register the javascript plugin with PhoneGap PhoneGap.addPlugin("calllog", new CallLog()); //Register the native class of plugin with PhoneGap PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); }; vair CallLog = function() {}; CallLog.prototype.all = function(pairams, successCallback, failureCallback) { /* @pairam successCallback * @pairam failureCallback * @pairam plugin name * @pairam action * @pairam JSONArray of pairameters */ return PhoneGap.exec(successCallback, failureCallback, 'CallLog', 'all', [pairams]); }; PhoneGap.addConstructor( function() { //Register the javascript plugin with PhoneGap PhoneGap.addPlugin("calllog", new CallLog()); //Register the native class of plugin with PhoneGap PluginManager.addService("CallLog","com.fusionchairts.phonegap.plugin.CallLog"); }); 

    Não existe uma API padrão em phonegap paira alcançair o que você quer fazer, mas você sempre pode escreview um plugin paira sua plataforma e obter as informações da API do Android. (Eu realmente não sei se você pode obter as informações que você precisa com java no Android).

    Aqui está um link sobre como escreview um plugin phonegap: http://wiki.phonegap.com/w/page/36752779/PhoneGap-Plugins

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.