Thursday, October 1, 2015

using OpenURL

ausdigi

  • New member
  • *
  • Posts: 35
  • Programmer
    • RNR
using OpenURL
« on: February 04, 2015, 02:01:54 am »
I'm testing laztoapk and wanted to open a URL
Code: [Select]
OpenURL('http://web-site.com')But when I run that on the Android simulator (AVD) it seems to be replacing (URL encoding) the two slashes with %2F instead (and ending up doing a google search with my URL). I've tried escaping the slashes in various ways without success and leaving out the "http://" part results in it doing nothing. Is Lazarus doing anything or where is the problem? I am having trouble following the code because it goes through a OpenURLWidgetsetImplementation variable and I got lost.
Win7/64: Laz 1.2.6/FPC 2.6.4 32bit; CT 5.2 32&64bit; laztoapk 0.9.0.28

Leledumbo

  • Hero Member
  • *****
  • Posts: 6539
  • Programming + Glam Metal + Tae Kwon Do = Me
    Re: using OpenURL
    « Reply #1 on: February 04, 2015, 07:09:02 am »
    I am having trouble following the code because it goes through a OpenURLWidgetsetImplementation variable and I got lost.
    If you use LCL custom drawn for android, the implementation is in lcl/interfaces/customdrawn/customdrawnobject_android.inc. Just see what it does and why your URL doesn't work.

    ausdigi

    • New member
    • *
    • Posts: 35
    • Programmer
      • RNR
    Re: using OpenURL
    « Reply #2 on: February 04, 2015, 11:59:03 pm »
    thanks for that...

    TCDWidgetSet.DoOpenURLWidgetsetImplementation just splits the URL in to the "protocol" section and the rest and then passes those strings on to Lava (by the looks of things). When I run it in the emulator it seems to turn that straight in to a google search query, rather than opening the actual URL. So I don't know where the problem is and I don't think I can work it out so I'll just never put a clickable link into an Android app if I ever write a proper one.
    Win7/64: Laz 1.2.6/FPC 2.6.4 32bit; CT 5.2 32&64bit; laztoapk 0.9.0.28
    http://forum.lazarus.freepascal.org/index.php/topic,27253.0.html