android.permission.READ_PHONE_STATE does not work lazarus / 43-Android ---------------------------------------------------------------------- RDL · 2019-02-12 12:03 hi. I don’t understand why it doesn’t work for me android.permission.READ_PHONE_STATE Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TfrmMain.frmMainJNIPrompt(Sender: TObject);var  manifestPermissions: TDynArrayOfString;beginif IsRuntimePermissionNeed() then   // that is, if target API >= 23   begin     ShowMessage('RequestRuntimePermission....');     ////https://develope r.android.com/guide/topics/security/permissions#normal-dangerous     SetLength(manifestPermissions, 1);     manifestPermissions[1]:= 'android.permission.READ_PHONE_STATE';      //from AndroodManifest.xml     Self.RequestRuntimePermission(manifestPermissions, 1212);   //handled by OnRequestPermissionResult     SetLength(manifestPermissions, 1);   end;end; procedure TfrmMain.frmMainRequestPermissionResult(Sender: TObject;  requestCode: integer; manifestPermission: string;  grantResult: TManifestPermissionResult);begincase requestCode of    1212:begin           if grantResult = PERMISSION_GRANTED  then         begin              //ShowMessage('Success! ['+manifestPermission+'] Permission granted!!! ' );               if manifestPermission = 'android.permission.READ_PHONE_STATE' then                 showmessage('read_call_state_ok');            end          else//PERMISSION_DENIED          begin              ShowMessage('Sorry... ['+manifestPermission+'] permission not granted... ' );          end;       end;  end;end;  procedure TfrmMain.jTelephonyManager1CallStateChanged(Sender: TObject;  state: TTelephonyCallState; phoneNumber: string);beginif state=csIdle then   showmessage('csIdle');if state=csRinging then   showmessage('pause');if state=csOffHook then   showmessage('start')end; The application is successfully compiled and installed on the phone. But when I receive an incoming call, not one of the TTelephonyCallState events does not work. Why? ---------------------------------------------------------------------- A.S. · 2019-02-12 20:57 manifestPermissions[0] ---------------------------------------------------------------------- RDL · 2019-02-13 12:51 sorry, this is my mistake. in my code is 0. but interception of call status does not work. ---------------------------------------------------------------------- RDL · 2019-02-22 04:41 Tell me how to determine the status of the phone? (waiting or incoming call) ---------------------------------------------------------------------- RDL · 2019-03-01 10:03 Tell me how to determine the status of the phone? (waiting or incoming call) Help please ---------------------------------------------------------------------- jmpessoa · 2019-03-23 16:13 Hi, RDL! finally! Now demo "AppTelephonyManagerDemo1" can handle "incoming call"  when the app is in background.... You,  can try the demo "AppBroadcastReceiverDemo2",  too! Thank you!