Page 2 of 2
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 1:53 am
by simon.schvartzman
Regarding
Just out of curiosity, what happens when you enter the whatsapp address into the address bar of the web browser on the device?
I had that curiosity as well and tried it at the very beginning
If I insert the same URL on my WebBrowser (both iPhone and desktop) the WhatsApp picking contact window opens as expected.
I "guess" I might have a clue, looking at the Launch URL documentation I see that it supports only 3 types of URL
which of course would leave whatsapp: out of the equation resulting on an error (which shouldn't be the one I'm getting but that's another story).
But why does it work then on the desktop? I'm going to ask this on the Quality board...
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 3:44 am
by SparkOut
I have no real clue, and not an Apple user but I imagine you would need to edit the plist to create the custom url association.
The faq link already quoted does say "Be sure to include WhatsApp URL scheme in your application's Info.plist under LSApplicationQueriesSchemes key if you want to query presence of WhatsApp on user's iPhone using -[UIApplication canOpenURL:]."
Quite what you need to do to edit the plist, I am not sure, but I suspect that you are mostly there, if you get that edit done correctly.
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 10:40 am
by simon.schvartzman
@SparkOut I guess you are right. I will explore editing the plist (sounds like rock science to me but I will give a try) as outlined on this lesson
Will report the result here.
p.s. the funny thing is that I choose LC because it was "high level" with no need to go too deep into the details

Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 12:44 pm
by bogs
simon.schvartzman wrote: Tue Dec 18, 2018 1:53 am
I had that curiosity as well and tried it at the very beginning
Ah. I did re-scan the entire thread to see if you had already tried this, apparently my comprehension skills weren't up to the challenge. That is 2

in one thread for me

<sigh>
It sounds (as you already said) like SparkOut has the answer, if program associations for iOs are configured through the plist, then that is the missing special ingredient. I'd never have guessed that one (but probably should have).
Lc itself is 'high level', the reason you chose it was valid. Associations, though, as I mentioned above, are set through the OS your running on, and the methods to set them up are not made by Lc. That would go for any OS you were programming for, in any language.
If you were writing a program for Windows for instance, and you needed (without user intervention) to have your program open when someone clicked on a certain type of file, you can see the steps are basically similar ~
Even if you were using VisualStudio, MSs own IDE, there isn't (or wasn't, last time I used it) any way to do this 'automatically' from inside a language.
It sounds like the pList is Apples version of the registry, all keys you need then have to be created by you.
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 3:25 pm
by simon.schvartzman
Hi guys, good news. With the usual great support from Panos I ended up reading the Lesson
Using custom URL schemes found here
http://lessons.livecode.com/m/4069/l/58 ... rl-schemes
(why I didn't do it earlier! shame on me)
Adding "whatsapp" on "Custom URL Scheme" field of the Basic iOS standalone setting did the trick! It was muuuuch easier than I thought.
Edited: the bad news is that this method doesn't allow to share pictures (which is my goal) just text...
Anyway many thanks to all that answered and hope it helps somebody in the future
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Dec 18, 2018 10:56 pm
by bwmilby
Did you look at mergPopActivity as a possible solution?
Re: Mobile Sharing an Image via Whatsapp
Posted: Wed Dec 19, 2018 12:42 am
by simon.schvartzman
@bwmilby, I did not consider mergPopActivity before and after learning about it, is clear that it delivers exactly what I need. Many thanks for pointing me to it.
I guess I should have spent more time searching the forum before opening a new post
BTW in the Dictionary it says it works only for iOS, is there something similar for Android?
Regards,
Re: Mobile Sharing an Image via Whatsapp
Posted: Wed Dec 19, 2018 12:48 am
by bwmilby
No problem. I had an idea when I first saw the thread but it took me a bit to locate the correct command.
I think the URL direction is the way for Android. I’m not aware of an external, but with LCB it should be possible.
Re: Mobile Sharing an Image via Whatsapp
Posted: Wed Dec 19, 2018 12:54 am
by simon.schvartzman
Brian, not sure I understand what you mean by
...with LCB it should be possible
could you please clarify?
thanks
Re: Mobile Sharing an Image via Whatsapp
Posted: Wed Dec 19, 2018 4:25 am
by bwmilby
My guess is that there is an Android API that could be leveraged in the same way as the iOS external. Using the FFI capabilities of LCB a library could be built to allow access to those functions from LCS. See the Toast Notification Library as an example.
Re: Mobile Sharing an Image via Whatsapp
Posted: Mon Dec 24, 2018 7:31 pm
by simon.schvartzman
Thanks Brian, it seems too complicated to me (but I will have a look) compared with mergPopActivity which is really straightforward and works really well.
Regards
Re: Mobile Sharing an Image via Whatsapp
Posted: Wed Feb 20, 2019 6:58 pm
by simon.schvartzman
For those readers interested in the subject please have a look at the following post
https://forums.livecode.com/viewtopic.php?f=53&t=32193
where you can see that the solution is much is really easy. Thanks Jacque!
Re: Mobile Sharing an Image via Whatsapp
Posted: Sat Jul 22, 2023 9:52 am
by LucaJones
To enable image sharing via whatsapp in your app, you can use url schemes to open whatsapp with the image attached.
For ios, use whatsapp://send?text=&abid=IMAGE_URL and for android whatsapp://send?text=&image=IMAGE_URL replace IMAGE_URL with the image's url or path.
Re: Mobile Sharing an Image via Whatsapp
Posted: Tue Sep 12, 2023 12:40 pm
by stam
Do the posts above not answer your question?