Comments (6)
Thank you very much #yasirkula you are awesome 👍 😃
from unitynativeshare.
You can either share the download link as plain text (SetText), or download the PDF file to the device and then share it as a file (AddFile).
P.S. Sharing the download link as plain text may not work as desired; e.g. if user decides to share on Facebook, it will be shared as a link rather than as an attached file.
from unitynativeshare.
You Can Put C# Example Code.
from unitynativeshare.
How do you plan to share the PDF? As a link or as a file?
from unitynativeshare.
The PDF are in Node Js serve in Public folder i want to download and put it in piece joint send after that deleted
from unitynativeshare.
using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
public void Share( string url )
{
StartCoroutine( DownloadAndShare( url ) );
}
private IEnumerator DownloadAndShare( string url )
{
// Credit: https://docs.unity3d.com/Manual/UnityWebRequest-CreatingDownloadHandlers.html
var uwr = new UnityWebRequest( url, UnityWebRequest.kHttpVerbGET );
string path = Path.Combine( Application.temporaryCachePath, "temp.pdf" );
uwr.downloadHandler = new DownloadHandlerFile( path );
yield return uwr.SendWebRequest();
if( uwr.isNetworkError || uwr.isHttpError )
Debug.LogError( uwr.error );
else
new NativeShare().AddFile( path ).Share();
// It may not be safe to delete the file immediately afterwards,
// maybe it is currently being shared? Instead, you can delete the file
// at that "path" later in your app's lifecycle or when your app starts
// File.Delete( path );
}
from unitynativeshare.
Related Issues (20)
- Using a callback changes the look of the sharing window HOT 1
- Sharing Image to Facebook (iOS) does not share the image just the text and link HOT 9
- Error with sharing HOT 13
- Error On Oculus Quest2 HOT 5
- Request for feature
- Crash with Unity as a library on Android 11 HOT 1
- Posting image+text on Instagram HOT 3
- Not possible to share image from Android Instant app HOT 3
- Android Build Failure: - Duplicate Class com.yasirkula.unity.NativeShare HOT 1
- Image not sharing with iOS app HOT 2
- Apps not showing on android 11 with 1.4.9 HOT 5
- Problem with sharing "No apps can perform this action" HOT 7
- NativeShare.Share() throwing exception on Android prod builds only (Unity NativeShare not doing anything on Android prod builds) HOT 7
- ios permission denied when using persistentPath for Sharing VideoFile HOT 2
- share file to slack in ios HOT 2
- SDK 31 above requires FLAG_IMMUTABLE or FLAG_MUTABLE PendingIntent. HOT 6
- Can't share image (without text) in Instagram with iOS 16.2 or older HOT 4
- Image is not getting shared when shared with Text on some platforms HOT 1
- Can't share to Instagram (except Reel) in iOS 16.3.1 HOT 1
- iOS Share video and text at the same time to iMessage HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unitynativeshare.