While regecting call i am getting an error : 06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null
06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start
06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent
06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID
06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null
06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start
06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent
06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID
06-05 08:56:37.965 824-824/it.bikemode.sharwin.com.bikemode E/INCOMING: +918500549640
06-05 08:56:37.970 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null
06-05 08:56:38.131 824-824/it.bikemode.sharwin.com.bikemode W/System.err: java.lang.SecurityException: Neither user 10110 nor current process has android.permission.MODIFY_PHONE_STATE.
06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming
06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004A, flags=0x0, dataLen=0x9
06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34
06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming
06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004B, flags=0x0, dataLen=0x9
06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34
06-05 08:56:39.033 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.os.Parcel.readException(Parcel.java:1425)
06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.os.Parcel.readException(Parcel.java:1379)
06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at com.android.internal.telephony.ITelephony$Stub$Proxy.silenceRinger(ITelephony.java:1983)
06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at it.bikemode.sharwin.com.bikemode.IngoingReceiver.onReceive(IngoingReceiver.java:44)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2550)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.app.ActivityThread.access$1500(ActivityThread.java:162)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.os.Looper.loop(Looper.java:194)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5371)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at java.lang.reflect.Method.invoke(Method.java:525)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode W/System.err:     at dalvik.system.NativeStart.main(Native Method)
06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID
06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start
06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111
06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID
06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start
06-05 08:56:39.052 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111
06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null
06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start
06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent
06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID
06-05 08:56:39.078 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID
06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: LOAD_URL arg1=0 arg2=0 obj=android.webkit.WebViewCore$GetUrlData@4169d870
06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore:  CORE loadUrl javascript:AFMA_updateActiveView({"units":[{"viewBox":{"bottom":533,"right":320,"left":0,"top":0},"isScreenOn":true,"isPaused":false,"adFormat":"320x50_mb","localVisibleBoxVisible":false,"activeViewJSON":{"click_string":"BjD8MvZtTV4-AK5e9oAP6sLHQBgCFkcCSrgIAABABOAGgBjk","active_experiment_ids":"","is_active_view_immediate_enabled":true,"activeview_cpm_urls":[]},"isNative":false,"hashCode":"abd2bfc2-8ada-4aca-b94a-74ff268ec3a4","afmaVersion":"afma-sdk-a-v9082034.8487000.1","windowVisibility":8,"screenDensity":1.5,"localVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isAttachedToWindow":true,"timestamp":54853252,"globalVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isVisible":true,"adBox":{"bottom":-146,"right":320,"left":0,"top":-196},"hitBox":{"bottom":50,"right":320,"left":0,"top":0},"isMraid":false,"globalVisibleBoxVisible":false,"isStopped":false}]});
06-05 08:56:39.079 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start
06-05 08:56:39.080 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111
06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming
06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004C, flags=0x0, dataLen=0x9
06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34
06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming
06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004D, flags=0x0, dataLen=0x9
06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34
06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming
06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004E, flags=0x0, dataLen=0x9
06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34





    public class IngoingReceiver extends BroadcastReceiver {
       
    
       
        int previousState = 2;
    
        public void onReceive(final Context context, Intent intent) {
            ITelephony telephonyService;
           
    
    
            TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            try {
                Class c = Class.forName(tm.getClass().getName());
                Method m = c.getDeclaredMethod("getITelephony");
                m.setAccessible(true);
                telephonyService = (ITelephony) m.invoke(tm);`enter code here`
                Bundle bundle = intent.getExtras();
                String phoneNumber = bundle.getString("incoming_number");
                Log.e("INCOMING", phoneNumber);
                if ((phoneNumber != null)) {
                    telephonyService.silenceRinger();
                    telephonyService.endCall();
                    Log.e("HANG UP", phoneNumber);
                }
    
            } catch (Exception e) {
                e.printStackTrace();
            }
    
        }
    }
    
    
    package com.android.internal.telephony;
    
    public interface ITelephony {
        boolean endCall();
        void answerRingingCall();
        void silenceRinger();
    }












