- Unity: 2020.3.9f1
- Native Share for Android & iOS: 1.4.4
- Platform: Android
- Device: LG Electronics, L-02K
- How did you download the plugin: Asset Store
Description
First of all, I would like to thank you for creating a great library.
Well, I added a function that takes a screenshot, resizes it, and then posts the image to another app.
It works fine without crashing or anything.
However, when I tested it on Facebook and Twitter, the behavior was different depending on the OS as follows
-
IOS
After posting, it appears the posting indication in my app, and after a few seconds, the posting is completed and the modal closes.
-
Android
After posting, the modal closes immediately without the posting indication in my app.
In the case of Android, even if I check the post on my desktop after posting, the post does not appear for any length of time.
When I launched the target app from the device where I posted, the posting process started and after waiting for a few seconds, the posting was completed.
The point is that the posting process on Android is only up to the point where it is put into the queue of the target app, and it is not done until I launch the app from the same device.
Is that the spec on Android?
It probably doesn't matter, but I'll post my code in case it does.
public IEnumerator ImageShoot(){
yield return new WaitForEndOfFrame();
Texture2D tex = ScreenCapture.CaptureScreenshotAsTexture();
int width = tex.width;
int height = width;
int x = (tex.width - width) / 2;
int y = (tex.height - height) / 2;
Color[] colors = tex.GetPixels(x, y, width, height);
tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
tex.SetPixels(colors);
string path = Path.Combine( Application.temporaryCachePath, "result.png");
File.WriteAllBytes(path, tex.EncodeToPNG());
Destroy(tex);
new NativeShare().AddFile(path)
.SetCallback((result, shareTarget) => AfterShare(shareTarget))
.Share();
}
Thanks,
Description
First of all, I would like to thank you for creating a great library.
Well, I added a function that takes a screenshot, resizes it, and then posts the image to another app.
It works fine without crashing or anything.
However, when I tested it on Facebook and Twitter, the behavior was different depending on the OS as follows
IOS
After posting, it appears the posting indication in my app, and after a few seconds, the posting is completed and the modal closes.
Android
After posting, the modal closes immediately without the posting indication in my app.
In the case of Android, even if I check the post on my desktop after posting, the post does not appear for any length of time.
When I launched the target app from the device where I posted, the posting process started and after waiting for a few seconds, the posting was completed.
The point is that the posting process on Android is only up to the point where it is put into the queue of the target app, and it is not done until I launch the app from the same device.
Is that the spec on Android?
It probably doesn't matter, but I'll post my code in case it does.
Thanks,