Search Unity

NatShare - Free Sharing API

Discussion in 'Assets and Asset Store' started by Lanre, Apr 17, 2018.

  1. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Can you share more information about the crash? A screenshot of Xcode when the crash occurs and the logs from Xcode would be a good place to start.
     
  2. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    new info)) i update your plugin, from PR on github. Build on android - all fine, sharing work. Build on ios - sharing dont work. and my xcode log empty upload_2020-4-10_15-53-22.png
    upload_2020-4-10_15-57-8.png
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    It is impossible for the Xcode logs to be empty. At the very least, Unity will log its initialization code. Without more information I can't help you with whatever issue you are facing.
     
  4. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    i just added ingame debug console, and after press share - logs empty((
    upload_2020-4-10_16-19-4.png upload_2020-4-10_16-19-18.png
     
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I need to see the logs from Unity and the call stack during the crash. When the app crashes, Xcode will show a call stack. I need a screenshot of the Xcode window when that happens. In-game logs will not contain any information on this.
     
  6. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    now i try to fix not a crash. I press share - and nothing((( (android fine)
     
  7. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    @Lanre maybe this file can help ((
     

    Attached Files:

    • 1.txt
      File size:
      49.3 KB
      Views:
      345
  8. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    @Lanre its very strange situation. I add log text before share and they showed in xcode, but call stack no((
    code: upload_2020-4-10_16-43-51.png
     

    Attached Files:

  9. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    @Lanre One more log. Start line - 850( "try share" text)
     

    Attached Files:

    • 1.txt
      File size:
      352.8 KB
      Views:
      445
  10. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    @Lanre Help psl(( i lost hope ((
    try to change code:
    Code (CSharp):
    1.  public override void Execute()
    2.     {
    3.         //NatShareU.NatShare.Share(ScreenshotModel.Photo);
    4.         //using (var payload = new SharePayload("Sharing is caring :)",() => Debug.Log("Items shared")))
    5.         //    payload.AddImage(ScreenshotModel.Photo);
    6.  
    7.         ShareVideo();
    8.     }
    9.  
    10.     async void ShareVideo()
    11.     {
    12.         Debug.LogError("Try share");
    13.         var success = await new SharePayload().AddImage(ScreenshotModel.Photo).AddText("#wowbox").Commit();
    14.         Debug.Log($"Successfully shared items: {success}");
    15.     }
    the same problem. upload_2020-4-10_18-1-40.png
    Try share message display, others - no
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Make sure that your photo texture is readable. You can check the `isReadable` property on the texture.
     
  12. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    @Lanre
    My new issue seem to be that, on the latest branch (1.2.2 with the bridge-fix) iOS isn't asking for media permission before saving or sharing, resulting in nothing happening. I reverted back to 1.2.1 and it started asking for media permission again. heres and example of my code:

    In 1.2.2 (Doesn't work on iOS):
    Code (CSharp):
    1. if (await new SavePayload(Application.productName)
    2.     .AddMedia(videoPath)
    3.     .Commit())
    4.     onSuccess?.Invoke();
    5. else
    6.     onFailed?.Invoke();
    7.  
    In 1.2.1 (Does work in iOS):
    Code (CSharp):
    1. using (var payload = new SavePayload(Application.productName, () => onSuccess?.Invoke()))
    2. {
    3.     payload.AddMedia(videoPath);
    4. }
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I recommend opening an issue for this. I'll look into this.
     
  14. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    why this work on android and dont work on ios?( if problem in redeable texture)
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I'm not sure so I want to collect more information. You issue might be related to this issue.
     
  16. UniBitDeveloper

    UniBitDeveloper

    Joined:
    Jul 17, 2017
    Posts:
    19
    i just save my texture to png file, and use this code
    Code (CSharp):
    1.  Debug.LogError("Try share");
    2.         Debug.LogError(ScreenshotModel.PhotoPath);
    3.         var success = await new SharePayload().AddMedia(ScreenshotModel.PhotoPath).AddText("#wowbox").Commit();
    4.         Debug.Log($"Successfully shared items: {success}");
    i see info about 2 first line, but sharings is not activate ((
    upload_2020-4-10_20-55-26.png

    Update: change code to, and same sheat(( share UI dont open
    Code (CSharp):
    1. Debug.LogError("Try share");
    2.         Debug.LogError(ScreenshotModel.PhotoPath);
    3.         var success = await new SharePayload().AddText("#wowbox").Commit();
    4.         Debug.Log($"Successfully shared items: {success}");
     
    Last edited: Apr 10, 2020
  17. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    80
    I had an issue with sharing in 1.2.2 on IOS as well, I remember removing an UNITY_EDITOR conditional in Bridge.cs.
    Not sure why, but for some reason Unity did not run the code outside of the editor.

    So
    Code (CSharp):
    1. #if UNTIY_IOS && !UNITY_EDITOR
    Became
    Code (CSharp):
    1. #if UNTIY_IOS
    By all accounts it doesn't make sense, but that fixed it for me.
     
    Lanre likes this.
  18. Mukaujoka

    Mukaujoka

    Joined:
    Mar 17, 2017
    Posts:
    17
    Hello, after updating NatShare to its newest version I'm not able to build for Android anymore. I tried with Unity 2019.2.21f1 and Unity 2019.3.9f1. I'm building on a Mac with Catalina. This is the error I'm getting.

    It looks like the issue described in: https://github.com/natsuite/NatShare-API/issues/80
    And the android:requestLegacyExternalStorage="true" flag is actually present in the generated AndroidManifest.xml file. Using the workaround mentioned in the above link is not helping either, since the compiler is just complaining about a duplicate flag afterwards.

    Code (csharp):
    1.  
    2. CommandInvokationFailure: Gradle build failed.
    3. /Applications/Unity/Hub/Editor/2019.3.9f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2019.3.9f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
    4.  
    5. stderr[
    6.  
    7. FAILURE: Build failed with an exception.
    8.  
    9. * What went wrong:
    10. Execution failed for task ':launcher:processReleaseResources'.
    11. > Android resource linking failed
    12.   /Users/x/Desktop/Selfie-Olympics/Selfie-Olympics/Temp/gradleOut/launcher/build/intermediates/merged_manifests/release/AndroidManifest.xml:59: AAPT: error: attribute android:requestLegacyExternalStorage not found.
    13.    
    14.   error: failed processing manifest.
    15.  
    16. * Try:
    17. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    18.  
    19. * Get more help at https://help.gradle.org
    20.  
    21. BUILD FAILED in 1s
    22. ]
    23. stdout[
    24. > Task :launcher:preBuild UP-TO-DATE
    25. > Task :unityLibrary:preBuild UP-TO-DATE
    26. > Task :unityLibrary:preReleaseBuild UP-TO-DATE
    27. > Task :unityLibrary:checkReleaseManifest UP-TO-DATE
    28. > Task :launcher:prepareLintJar UP-TO-DATE
    29. > Task :unityLibrary:processReleaseManifest
    30. > Task :unityLibrary:compileReleaseAidl NO-SOURCE
    31. > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
    32. > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
    33. > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
    34. > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
    35. > Task :unityLibrary:generateReleaseResources UP-TO-DATE
    36. > Task :unityLibrary:packageReleaseResources UP-TO-DATE
    37. > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
    38. > Task :unityLibrary:prepareLintJar UP-TO-DATE
    39. > Task :unityLibrary:generateReleaseSources UP-TO-DATE
    40. > Task :launcher:preReleaseBuild
    41. > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
    42. > Task :launcher:compileReleaseAidl NO-SOURCE
    43. > Task :launcher:compileReleaseRenderscript NO-SOURCE
    44. > Task :launcher:checkReleaseManifest UP-TO-DATE
    45. > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
    46. > Task :launcher:generateReleaseSources UP-TO-DATE
    47. > Task :launcher:mainApkListPersistenceRelease UP-TO-DATE
    48. > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
    49. > Task :launcher:generateReleaseResValues UP-TO-DATE
    50. > Task :launcher:generateReleaseResources UP-TO-DATE
    51. > Task :unityLibrary:bundleLibCompileRelease
    52. > Task :unityLibrary:prepareLintJarForPublish
    53. > Task :unityLibrary:mergeReleaseShaders
    54. > Task :unityLibrary:compileReleaseShaders
    55. > Task :unityLibrary:generateReleaseAssets
    56. > Task :launcher:mergeReleaseResources UP-TO-DATE
    57. > Task :launcher:javaPreCompileRelease
    58. > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
    59. > Task :launcher:processReleaseManifest
    60. > Task :launcher:processReleaseResources FAILED
    61. > Task :unityLibrary:packageReleaseAssets
    62.  
    63. Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
    64. Use '--warning-mode all' to show the individual deprecation warnings.
    65. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
    66. 25 actionable tasks: 10 executed, 15 up-to-date
    67. ]
    68. exit code: 1
    69. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c28be54006ad442989ee1a401e08ea78>:0)
    70. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c28be54006ad442989ee1a401e08ea78>:0)
    71. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <c28be54006ad442989ee1a401e08ea78>:0)
    72. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <c28be54006ad442989ee1a401e08ea78>:0)
    73. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c28be54006ad442989ee1a401e08ea78>:0)
    74. Rethrow as GradleInvokationException: Gradle build failed
    75. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <c28be54006ad442989ee1a401e08ea78>:0)
    76. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c28be54006ad442989ee1a401e08ea78>:0)
    77. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c28be54006ad442989ee1a401e08ea78>:0)
    78. Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
    79. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <c28be54006ad442989ee1a401e08ea78>:0)
    80. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c28be54006ad442989ee1a401e08ea78>:0)
    81. UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <c28be54006ad442989ee1a401e08ea78>:0)
    82. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <c28be54006ad442989ee1a401e08ea78>:0)
    83. UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:340)
    84. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:187)
    85.  
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I haven't been able to get to this, but I will this weekend. Sorry for the delay.
     
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    You need to update your Android SDK build tools to 29. You can do this in the SDK Manager in Android Studio.
     
    Mukaujoka likes this.
  21. Kaleval

    Kaleval

    Joined:
    Apr 19, 2016
    Posts:
    7
    Hi!
    I'm too having problem with NatShare on iOS.
    After upgrade to 1.2.2 I couldnt share, so I also removed that UNITY_EDITOR part from Bridge.cs and it kinda worked, the preview image looks ok, but the shared image or saved image looks distorted. Am i using wrong texture format?
    Here s the image
    https://i.ibb.co/GsYvNvx/File.jpg
     
    Last edited: Apr 14, 2020
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I recommend opening an issue on GitHub. I'll look into this.
     
  23. cubin30

    cubin30

    Joined:
    Jul 15, 2016
    Posts:
    7
    Hi

    Having a little trouble with the SavePayload on Android 10. I've made sure the texture is readable and the proper permissions are included in the AndroidManifest and made sure to use Unity method of requesting Read/Write External permissions.

    Seems I am still getting an EACCES (Permission denied) java.io.FileNotFoundException error. I also tried setting <application android:requestLegacyExternalStorage="true"> in manifest.

    Included the snippet of the code used and logcat. Using NatShare 1.2.2

    Thanks for any help
     

    Attached Files:

    Last edited: Apr 29, 2020
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    I wonder if Android is enforcing the Storage Access Framework now. Have you checked that the app has write permissions in settings?
     
  25. a_rucula_do_mal

    a_rucula_do_mal

    Joined:
    Nov 22, 2015
    Posts:
    3
    Not working on iOS, nothing happens, no error on Log, trying to share a Texture2D generated inside Unity, not a external file, any clues?

    Already tried the "#if UNTIY_IOS && !UNITY_EDITOR" on the Bridge.cs fix
    Also added NSPhotoLibraryUsageDescription and NSPhotoLibraryAddUsageDescription to Info.plist, but not sure if its needed to share a Texture2D.
    Latest Version, and working perfectly on Android.

    Thanks in advance :)
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Check that your texture is readable and that it doesn't use a compressed format (must be RGB24, RGBA32, or BGRA32).
     
  27. cubin30

    cubin30

    Joined:
    Jul 15, 2016
    Posts:
    7
    I did a whole deletion and re-import of the plugin and seemed to resolve the issue. Perhaps some lingering older file version or meta data.
     
    Lanre likes this.
  28. cubin30

    cubin30

    Joined:
    Jul 15, 2016
    Posts:
    7
    Having similar issues with iOS, but with saving MP4 recording from NatCorder. Saving image file works with similar payload method. For saving a picture/texture I am using AddImage and for video/mp4 AddMedia. Both function correctly on Android.

    -Unity 2019.3.10f1
    -Xcode 11.3.1
    -iOS 11+
    -NatShare 1.2.2
    -NatCorder 1.7.1
     

    Attached Files:

  29. a_rucula_do_mal

    a_rucula_do_mal

    Joined:
    Nov 22, 2015
    Posts:
    3
    Just checked, texture is readable and RGBA32. I'm also trying to share a small string, sharing two things should not cause a problem right? At this point I have no idea on where to search for the problem...
     
  30. Phoria-Phill

    Phoria-Phill

    Joined:
    Jul 30, 2018
    Posts:
    1
    We found the iOS bug!

    In the Bridge.cs file (NatShare/Plugins/Managed/Internal) there is a typo:

    L:16 #if UNTIY_IOS && !UNITY_EDITOR

    Should be:

    L:16 #if UNITY_IOS && !UNITY_EDITOR

    The "IT" of UNITY was backwards :(
     
  31. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    @Lanre, just found another release-stopping issue. Apple just rejected our app because NatShare silently fails on iPads with iOS 13.4.1. I checked the log when I try to share a screenshot and I see this:
    Code (CSharp):
    1. 2020-05-21 09:32:27.156874-0400 dev[3761:1706953] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    2.     Probably at least one of the constraints in the following list is one you don't want.
    3.    Try this:
    4.        (1) look at each constraint and try to figure out which you don't expect;
    5.         (2) find the code that added the unwanted constraint or constraints and fix it.
    6. (
    7.     "<NSLayoutConstraint:0x283b9efd0 LPLinkView:0x1227895f0.leading == UILayoutGuide:0x282367b80'UIViewLayoutMarginsGuide'.leading   (active)>",
    8.     "<NSLayoutConstraint:0x283b9ec10 H:[LPLinkView:0x1227895f0]-(59)-|   (active, names: '|':_UIActivityContentTitleView:0x122a91140 )>",
    9.     "<NSLayoutConstraint:0x283b98820 H:|-(0)-[_UIActivityContentTitleView:0x122a91140]   (active, names: '|':_UINavigationBarContentView:0x122a78fc0 )>",
    10.     "<NSLayoutConstraint:0x283b98870 _UIActivityContentTitleView:0x122a91140.trailing == _UINavigationBarContentView:0x122a78fc0.trailing   (active)>",
    11.     "<NSLayoutConstraint:0x283a68960 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x122a78fc0.width == 6   (active)>",
    12.     "<NSLayoutConstraint:0x283b9eee0 'UIView-leftMargin-guide-constraint' H:|-(16)-[UILayoutGuide:0x282367b80'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIActivityContentTitleView:0x122a91140 )>"
    13. )
    14.  
    15. Will attempt to recover by breaking constraint
    16. <NSLayoutConstraint:0x283b9efd0 LPLinkView:0x1227895f0.leading == UILayoutGuide:0x282367b80'UIViewLayoutMarginsGuide'.leading   (active)>
    The result is that our sharing button does nothing. Interestingly, sharing works on my iPhone. looks like it's related to some layout issue on iPad or maybe the size of the screen shot?

    any ideas?
     
  32. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    @Lanre, just to add to the issue above: my QA team is telling me that sharing still works on a very old version of NatShare that our app currently uses in the appstore: "on the live version as soon as you tap share it asks you for app permission to access photos. In the recent rejected version it doesn’t ask you that question and nothing happens"
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Don't add a prefix when committing to NatShare. The prefix is only necessary for Unity's Handheld.PlayFullscreenMovie function.
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Good catch. I should mention that the PR where I made this change will be closed without merging because there's a better way to fix the IL2CPP issue. Thanks for the catch.
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Are you using the latest NatShare? See this PR and this issue.
     
  36. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    I'm using the latest version from the asset store. which is 1.2.2. the Git is also listed at 1.2.2. If the two are different, then the version number needs to be incremented. It's a dangerous practice to have different code-bases in two places with the same version number. I've literally spent hours (hundreds of dollars) trying to figure this out. I'm probably in the minority but I'd love it if you could start charging money for NatShare and then dedicate some more time to QA/bug fixes. We would happily spend $100 on a simple sharing plugin that is tested and guaranteed to work instead of a free one that seems to work every other release.

    Anyway, if we are supposed to use the GIT Repo for the latest build, can you please tell us which branch is the best one to have no issues with sharing and saving on iOS and android. I see branches 1.2, bridge-fix, and native-bridge but don't know which one is stable.
     
    Last edited: May 27, 2020
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    They are the exact same. The Asset Store build always mirrors the latest package on GitHub.
    Always reach out to me directly, whether through GitHub or by email. NatShare is best kept FOSS.
    The branch with version numbers correspond to the versions you'd see on the Asset Store and in the 'Packages' page on GitHub. In general, you should use the packages on GH or the Asset Store version. The other branches are always working branches (I have open PR's).
     
    mtalbott likes this.
  38. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    @Lanre , using the latest 1.2.3 branch of NatShare my QA team are reporting saving crashing on all Pixel Devices.

    My save code looks like:
    Code (CSharp):
    1. var success = await new SavePayload(Application.productName).AddImage(texture).Commit();
    2.  
    3.             if (success)
    4.                 onSuccess?.Invoke();
    5.             else
    6.                 onFailed?.Invoke();
    And the error log looks like:
    Code (CSharp):
    1. 2020-06-12 14:01:28.960 25393-25758/com.balti.virtual.appar8.dev E/AndroidRuntime: FATAL EXCEPTION: SavePayload Commit Thread
    2.     Process: com.balti.virtual.appar8.dev, PID: 25393
    3.     java.lang.IllegalArgumentException: Primary directory AppAR8 Dev not allowed for content://media/external/images/media; allowed directories are [DCIM, Pictures]
    4.         at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170)
    5.         at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
    6.         at android.content.ContentProviderProxy.insert(ContentProviderNative.java:481)
    7.         at android.content.ContentResolver.insert(ContentResolver.java:1828)
    8.         at api.natsuite.natshare.SavePayload.lambda$commit$0$SavePayload(SavePayload.java:72)
    9.         at api.natsuite.natshare.-$$Lambda$SavePayload$0wjtSNJuMX77rkaraI8nWQBBikI.run(Unknown Source:2)
    10.         at android.os.Handler.handleCallback(Handler.java:883)
    11.         at android.os.Handler.dispatchMessage(Handler.java:100)
    12.         at android.os.Looper.loop(Looper.java:214)
    13.         at android.os.HandlerThread.run(HandlerThread.java:67)
    do you think this has to do with using an album name of Application.productName? product name is just "AppAR8 Dev", by the way.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Make sure that your app has external write permissions, in the Android manifest (you can set this in Player Settings) and at runtime.
     
    mtalbott likes this.
  40. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    125
    Thank you!
     
    Lanre likes this.
  41. idkorcare

    idkorcare

    Joined:
    Oct 21, 2014
    Posts:
    3
    Im having an issue saving a video file to a specific folder on Android. It works as expected on IOS but on android its saving to a "video" folder. This had been working correctly at one point.
    await new SavePayload().AddMedia(path).Commit(); // use to save file to a "null" folder
    await new SavePayload("App Name").AddMedia(path).Commit(); // was saving to "App Name" folder and now goes to a "video" folder on Android but "App Name" on IOS

    recreated a new project with just NatCorder and NatShare in Unity 2019.3.9 with same result, any ideas?
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Saving to the album now requires Android Q. It worked before because we were able to explicitly create the directory and save the files there. But Android has stopped allowing apps direct access the file system; instead we have to go through the MediaStore API's which didn't add support for albums until Android Q.
     
  43. Seginus

    Seginus

    Joined:
    Feb 1, 2018
    Posts:
    18
    Was NatShare.GetThumbnail() deprecated in 1.2? The top-level post mentions being able to generate thumbnails from a filepath but it seems like that functionality was removed.
     
  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    Yup, it was removed. NatReader could be used as a replacement, but it is incomplete (doesn't yet work on Windows).
     
  45. idkorcare

    idkorcare

    Joined:
    Oct 21, 2014
    Posts:
    3
    Let me try asking this again with more information.

    Unity 2019.4.1f1 (Min API 26 Target API 29)
    NatCorder 1.7.2
    NatShare 1.2.3

    Samsung S8
    Android 9

    I cant specify album to save videos
    await new SavePayload().AddMedia(path).Commit(); // was saving to created "null" album
    await new SavePayload("App Name").AddMedia(path).Commit(); // was saving to created "App Name" album

    Now both save to a created "video" album, is that working as intended and is it because my target API is >= Build.VERSION_CODES.Q?

    Will it only save to the correct files with Android Q/10?

    Thanks again
     
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    As I mentioned earlier, saving to specific albums is now an Android Q+ feature. Android tightened controls on apps having access to the file system, which is how album saving worked previously (creating a sub directory in the DCIM folder).
     
  47. A_Oplesnin

    A_Oplesnin

    Joined:
    Feb 12, 2018
    Posts:
    3
    Hello, after upgrading to NetShare 1.2.3 we have an unwanted permission added to our project:
    android.permission.WRITE_EXTERNAL_STORAGE


    We don't use file sharing. Can you make this permission optional and remove it from main aar?
     
    Last edited: Jun 27, 2020
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,971
    The external storage permission is a fundamental requirement. If you don't want it, you can fork NatShare, make the modifications you need, and build your custom Android library.
     
  49. tempostudios

    tempostudios

    Joined:
    Jan 31, 2019
    Posts:
    5
    Hello,

    Having a bit of trouble with social media on iOS.

    iOS 13.5.1
    NatShare 1.2.3
    NatCorder 1.7.2
    XCode 11.5
    Unity 2019.4.1f1

    Using the ReplayCam demo scene in new Unity project. Record method looks like :

    Code (CSharp):
    1. public async void StopRecording () {
    2.             // Mute microphone
    3.             microphoneSource.mute = true;
    4.             // Stop recording
    5.             audioInput?.Dispose();
    6.             cameraInput.Dispose();
    7.             var path = await recorder.FinishWriting();
    8.             // Playback recording
    9.             Debug.Log($"Saved recording to: {path}");
    10.             var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";
    11.             Handheld.PlayFullScreenMovie($"{prefix}{path}");
    12.  
    13.             ShareManager.Instance.ShareLatestVideo($"{path}", "Test");
    14.         }
    Share method looks like this :

    Code (CSharp):
    1. public class ShareManager : Singleton<ShareManager>
    2.     {
    3.         public Action<bool> OnSubmitStatusUpdate;
    4.  
    5.         public async void ShareLatestVideo(string path, string caption = "")
    6.         {
    7.             var success = false;
    8.  
    9.             var payload = new SharePayload();
    10.  
    11.             payload.AddMedia(path);
    12.  
    13.             payload.AddText(caption);
    14.  
    15.             success = await payload.Commit();
    16.  
    17.             OnSubmitStatusUpdate?.Invoke(success);
    18.         }
    19.     }

    Result : Video replays once, then brings up Native iOS menu. Sharing to iMessage works fine. Sharing to Instagram brings up a dialogue "Please share a video longer than 0 seconds."

    Thanks
     
  50. sabanmete

    sabanmete

    Joined:
    Mar 20, 2020
    Posts:
    19
    Hi, im using natCorder and natShare,

    Code (CSharp):
    1. public async void StopRecording () {
    2.             // Mute microphone
    3.             microphoneSource.mute = true;
    4.             // Stop recording
    5.             audioInput?.Dispose();
    6.             cameraInput.Dispose();
    7.             var path = await recorder.FinishWriting();
    8.             // Playback recording
    9.             Debug.Log($"Saved recording to: {path}");
    10.             if (!Application.isEditor)
    11.             {
    12.                 var payload = new SavePayload("App1 Records"); // album name here
    13.                 payload.AddMedia(path);
    14.                 if (commit)
    15.                 {
    16.                     await payload.Commit();
    17.                 }
    18.             }
    19.             var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : "";
    20.             Handheld.PlayFullScreenMovie($"{prefix}{path}");
    21.             recordin.SetActive(false);
    22.         }
    this is my code for recording videos and saving into gallery, commit is a toggle button, when its off, app working but not saving in gallery, when its on, app crashes. Is there something wrong on code ? Also, im getting the same issue in AddImage function too, if i payload.commit(). Thanks.
     
    Last edited: Jun 29, 2020