Is it possible in current state of NativeScript to create an app which listens for share intents on Android?
What I would like to achieve is for example having a website opened in my web browser on Android, tap on share and see my NativeScript app on the list of share targets.
I did accomplish this on a native Android app but can't get it to work in a NativeScript app. I've messed with the AndroidManifest.xml to add
<action android:name="android.intent.action.SEND"></action>
<category android:name="android.intent.category.DEFAULT"></category>
into intent-filter but this did not help. My app does not show up in the list of share targets.
NativeScript should support this scenario out of the box. Here's what my AndroidManifest in
app/App_resources/Android
of a default bootstrapped application looks like:edit: Very simple implementation to send intent to any of my other application:
First update your AndroidManifest.xml in app/App_Resources/AndroidManifest.xml
Add following intent-filter like below
Then Add following lines of code in your app.js
Now you can share your content from 3rd party app to your app.
In addition to the intent-filter you have to add in your AppManifest.xml make sure that you rebuild your app (livesync option may not reflect changes in AppManifest.xml)
Here is an NativeScript implementation for basic share
I've been searching for a solution to this question myself and found all of the others answers here very helpful.
Yet, I'm a noob (only two days in) for NativeScript and couldn't actually get where and how to implement all the code bits together to work.
By using the answers here I could continue my search and found a finished GITHUB EXAMPLE: NickIliev/nativescript-receiving-shared-content
For other freshmen (or freshwoman) looking for a finished example go to the repo and explore the code in
/demo/app/
directory. It was helpful for me and I'll hope it will help you too.