Android Question whatsapp:// err_unknown_URL_SCHEMA

marcel

Active Member
Licensed User
Longtime User
Hi,

I have a webview component on my app. But when there is a link (as content) in the webview like:

whatsapp://chat?code=xxxxxxxxxxxxxxx

whatsapp should be opening when pressing the link but instead it says:

ERR_UNKNOWN_URL_SCHEME.

When I do this directly on the Android Chrome browser. It works.

What do I need to do to fix this?
 

marcel

Active Member
Licensed User
Longtime User
Thanks. One step further. Now find a way to pass this trough:

B4X:
<a href='whatsapp://chat?code=KZLLLrFcFSFHa36yWmJ6IP'>Start Chat</a>

Cannot find anything with a chat?code... only text
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Try it:
B4X:
Sub WebView_OverrideUrl (Url As String) As Boolean
    If Url.StartsWith("whatsapp://") Then
        ' code for WhatsApp
        Return True
    Else
        Return False
    End If
End Sub

And see this library by @MarcoRome
 
Last edited:
Upvote 0

marcel

Active Member
Licensed User
Longtime User
Hi, Thanks but that part I understand. I am only not sure how to start whatsapp with chat instead of text.

I have now:
B4X:
 Sub  WebView1_OverrideUrl (Url As String) As Boolean
    If Url.StartsWith("whatsapp://") Then
         Dim i As Intent
        i.Initialize(i.ACTION_SEND, "")
        i.PutExtra("android.intent.extra.TEXT", Url)
        i.SetType("text/plain")
        Dim jo As JavaObject = i
        jo.RunMethod("setPackage", Array("com.whatsapp"))
        StartActivity(i)
        Return True

    Else
      
        Return False
    End If
End Sub

But that won't work correctly. I mean it starts whatsapp but it does not join a group (as it suppose to with this URL).
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Bisgona knows what the code means "Code = KZLLLrFcFSFHa36yWmJ6IP", Is a number, a chat, or something else?

I searched on the internet and it looks like it's just the Verify Sicure Code (QR code) to access WhatsApp from the WEB (perhaps), which you do not need because you're on a device.
I suggest you use @MarcoRome's ela liberia to open a chat, unless you know that that code associates WhatsApp with something specific
 
Last edited:
Upvote 0

marcel

Active Member
Licensed User
Longtime User
Hi, We are loading pages that contains this link. When you press on this link (which works on FaceBook App or Chrome App) whatsapp will open and you will be joined to a group. In iOS it also works.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Do a try and see the name of the group to which they are associated, then you can search the B4A forum if there is a way to join a group .. I do not know him:p:p:p
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Do a try and see the name of the group to which they are associated, then you can search the B4A forum if there is a way to join a group .. I do not know him:p:p:p
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I've documented that the link you gave chose to accept the transmission of a Group Chat to WhatsApp.
I have not found any documentation on how to pass the code to the WhatsApp app. But try the code on the Android browser works. I can not help you
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
try this for enter to group

B4X:
Dim Intent1 As Intent
    Intent1.Initialize(Intent1.ACTION_VIEW, "https://chat.whatsapp.com/KZLLLrFcFSFHa36yWmJ6IP")
    Intent1.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(Intent1)

Change this KZLLLrFcFSFHa36yWmJ6IP with real group code:p
 
Upvote 0
Top