Jump to content

erva

Members
  • Content Count

    45
  • Joined

  • Last visited

Everything posted by erva

  1. erva

    Date in Android call log

    Solved the problem. Code is not "optimised" but works: CallTimeDouble := StrToInt64(DATEx) / 1000; //Gives seconds CallTimeDouble := CallTimeDouble / 60; //Gives Minutes CallTimeDouble := CallTimeDouble / 60; //Gives hours CallTimeDOuble := CallTimeDouble / 24; //Gives dates CallTimeDouble := CallTimeDouble + 25569; //01.01.1970 - 30.12.1899 CallTimeDouble := CallTimeDouble + 0.125; //Added +3h to GMT, Finland Result := CACHED_NAMEx + ' ' + NUMBERx + ' ' + FormatDateTime('dd.mm.yyyy hh:mm:ss', CallTimeDouble) + ' ' + DURATIONx; ShowMessage(Result);
  2. erva

    Date in Android call log

    I asked same question in Stackoverflow: https://stackoverflow.com/questions/61332432/delphi-getting-android-call-logs-date?noredirect=1#comment108504919_61332432 There's mentioned that value is number of millisecond since January 1, 1970, 00:00:00 GMT. This gets complicated....
  3. erva

    Date in Android call log

    Yes, i get same like results in app with real data with several calls DATEx what comes from call_log.
  4. Is there way to access Android/iOS call history? In Android is permission to READ_CALL_LOG so it might be possible. Need to get calls phone number, is it incoming/outgoing and how long they lasted.
  5. Managed to get data from call log. I have added code for it in this another post
  6. erva

    Receiving incoming calls

    Android 9. And in manifest is permissions.
  7. erva

    Receiving incoming calls

    I'am having same trouble, sometimes CallStateChange works, sometimes not. I haven't figured out why. Maybe if make Android Service, it works better. haven't tried it yet.
  8. erva

    Receiving incoming calls

    I been struggling with this too. What i have learned is that in Android you need to have permission to READ_CALL_LOG to get phone number. But i still have trouble get CallStateChange to trigger. With this solution i managed to get CallStateChange trigger, but it doesn't work always. Need to try making it Android Service and see if it works better: stackoverflow.com/questions/61215767/delphi-android-read-phone-state-not-triggering This is my code to get all three permissions: constructor TForm1.Create(AOwner: TComponent); const PermissionAccessReadPhoneState = 'android.permission.READ_PHONE_STATE'; PermissionAccessMakeCall = 'android.permission.CALL_PHONE'; PermissionAccessReadCallLog = 'android.permission.READ_CALL_LOG'; begin inherited Create(AOwner); PermissionsService.RequestPermissions([PermissionAccessMakeCall, PermissionAccessReadPhoneState, PermissionAccessReadCallLog], procedure(const APermissions: TArray<string>; const AGrantResults: TArray<TpermissionStatus>) begin TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, IInterface(PhoneDialerService)); if (Length(AgrantResults) = 3) and (AgrantResults[0] = TPermissionStatus.Granted) and (AgrantResults[1] = TPermissionStatus.Granted) and (AgrantResults[2] = TPermissionStatus.Granted) then begin ShowMessage('READ_PHONE_STATE + CALL_PHONE + READ_CALL_LOG Activated!'); end; end); if Assigned(PhoneDialerService) then begin PhoneDialerService.OnCallStateChanged := MyOnCallStateChanged; end; end;
  9. Tested from Delphi Cookbook book phone dialing app. Works fine but instead of showing phone number at CallStateChanged, app shows some code like "9F62223E-Ao036-466E-A3EF-407105719798". In books picture of running app phone number shows ok. This is code to show CallStateChanged: procedure TMainForm.CallStateChanged(const ACallID: string; const AState: TCallState); begin lblCall.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); end; I'am using iPhone, in book is pic of Android phone. Edit: Tested with Android. Seems like in Android no CallStateChange is detected at all.
  10. Seems to be that Apple has prevent showing phone number. In Android you need to request permission at run time to get phone state. Managed to do that, but CallStateChange still not executing. Tested on two Android phones.
  11. Where can i find compiled macOs app? I can launch app from Delphi in mac, but can't find compiled dng file from OSX64/Debug directory like windows .exe file
  12. erva

    Can't find compiled macOS app

    Thanks, found it. Didn't thought at all that i'am looking it from wrong computer:)
  13. Is there way to read mobile network signal strength in iOS?
  14. Thanks, that helped.
  15. Ok, thanks. This leads to second question: Is there easy way to check if iPhone is connected to internet?
  16. Hi, Android TLocation.LocationChanged crashes when executing code at line where variable lstDistance is calculated. iOS works fine. I have tried Double type instead of Extended type but with no help. In iOS both types work fine. If i change lstDistance := 1;, code works fine. Code is working Taximeter where charge is counted based on distance and time:) procedure TfrmMain.senLocationLocationChanged(Sender: TObject; const OldLocation, NewLocation: TLocationCoord2D); var Latitude1: Extended; Longitude1: Extended; Latitude2: Extended; Longitude2: Extended; lstDistance: Extended; begin //MATKAN MITTAUS Latitude1 := OldLocation.Latitude; Longitude1 := OldLocation.Longitude; Latitude2 := NewLocation.Latitude; Longitude2 := NewLocation.Longitude; lstDistance := ArcCos(Sin(DegToRad(Latitude1)) * Sin(DegToRad(Latitude2)) + Cos(DegToRad(Latitude1)) * Cos(DegToRad(Latitude2)) * Cos(DegToRad(Longitude2 - Longitude1))) * 6367000; // THESE LINES I HAVE COMMENTED OUT TO MAKE SURE THEY DON*T CAUSE CRASHING // lstDistance := lstDistance * 1.01; //Calibrointi // totDistance := totDistance + lstDistance; // // //COUNT OF MEASUREMENTS // mitattuKpl := mitattuKpl + 1; // // //DISTANCE IN EUROS // matkaE := totDistance * (0.99 / 1000); // // TIME IN EUROS // aikaLopetus := Now; // kyydinKesto := aikaLopetus - aikaAloitus; // aikaE := ((24*60)*0.89)*kyydinKesto; // summaE := lahtoE + matkaE + aikaE; // // //UPDATE LABELS // lblLongitude.Text := Format('%2.6f', [NewLocation.Longitude]); // lblLatitude.Text := Format('%2.6f', [NewLocation.Latitude]); // lblMitattu.Text := Format('%2.2f', [lstDistance]); // lblMatka.Text := Format('%2.2f', [totDistance]); // lblMittauksia.Text := IntToStr(mitattuKpl); // lblLahto.Text := Format('%2.2f', [lahtoE]); // lblKmE.Text := Format('%2.2f', [matkaE]); // lblAikaE.Text := Format('%2.2f', [aikaE]); // lblSumma.Text := Format('%2.2f', [summaE]); end;
  17. erva

    Android crashes in formula

    Yes, now it's working. Thank you!
  18. Is there way to prevent iOS automatically lock screen? I'am my self using one fitness app and it stays visible when doing workout, so it should be possible.
×