I’ve made a number of posts in the past talking about sharing via Twitter on React Native/iOS. A lot of people in Japan use Twitter, but even more use LINE on a daily basis and a few days ago I was integrating LINE messenger sharing into an iOS project so I thought I’d also write about what I found here. Sharing on LINE is surprisingly easy on iOS, you don’t need to integrate any third party SDKs because you can just use an intent URL.
Sharing on Line Messenger
I’ll start off by showing the schema URL for sharing on LINE messenger:
The [message] portion needs to be URL encoded, but aside from that things are fairly straightforward. If you open this URL with openURL it will switch to LINE messenger and let a user decide who they’re going to send the predefined message to. Below is an example of a method in Objective-C that encodes whatever text you’re going to send and then opens the URL:
I didn’t actually get around to testing this on Android because the only LINE account I have is signed in on my iPhone SE. I’m pretty sure the same principle should work on the Android app and it should also work with React Native and Linking’s openURL method. If anyone gets around to trying this on Android I’d love to hear the results below in the comments.
Why LINE Messenger?
It doesn’t matter so much if you don’t have a large portion of Japanese users, but LINE is basically like WhatsApp in Japan and from what I’ve heard is also quite popular in countries like Taiwan too. Twitter is also quite popular in Japan, mostly because you don’t have to give out many personal details to register – but its main function isn’t messaging like LINE. If you have some kind of share-able content in your app then I think it’s worth adding an option to share in LINE.