Commit b0f4c4ef5ebc20b2e3d439421bbeceeac27d8e88

Authored by thiago.filipe
1 parent a6d83150
Exists in master and in 1 other branch Export

Fix refresh android

Assets/Scenes/Main.unity
... ... @@ -3592,53 +3592,53 @@ Animation:
3592 3592 m_GameObject: {fileID: 535548070}
3593 3593 m_Enabled: 1
3594 3594 serializedVersion: 3
3595   - m_Animation: {fileID: 7400000, guid: 365e5f41595503c48915848d883fabfe, type: 2}
  3595 + m_Animation: {fileID: 7400000, guid: 56fd236d710575546b549738e3dc9933, type: 2}
3596 3596 m_Animations:
3597   - - {fileID: 7400000, guid: f1f36f20657e5244e9c1e21117d9a452, type: 2}
3598   - - {fileID: 7400000, guid: 55bec2c04d14e74488ef127ee380a080, type: 2}
3599   - - {fileID: 7400000, guid: b368bfe0efa37c04bb9c661058ccedb9, type: 2}
3600   - - {fileID: 7400000, guid: 365e5f41595503c48915848d883fabfe, type: 2}
3601   - - {fileID: 7400000, guid: fa9ef8a15fe08a143bc89dc00289fc17, type: 2}
3602   - - {fileID: 7400000, guid: 939bebf16bb2dba44894c5745c5dc1f8, type: 2}
3603   - - {fileID: 7400000, guid: aecdf652be04b444f84644ba7c403960, type: 2}
3604   - - {fileID: 7400000, guid: 53ed20623f5573345a4fb057db454b05, type: 2}
3605   - - {fileID: 7400000, guid: b0bafda258c57414ebfbc4cf89719795, type: 2}
3606   - - {fileID: 7400000, guid: 67caa6e2d05387848a9448b57fffcb0f, type: 2}
3607   - - {fileID: 7400000, guid: a79227e28dd60fa4c9812a51ab9d455e, type: 2}
3608   - - {fileID: 7400000, guid: 8b1d930398178064795f5d23af67dce4, type: 2}
3609   - - {fileID: 7400000, guid: af8192a32a30ab746be40ff1dcb8bc0a, type: 2}
3610   - - {fileID: 7400000, guid: e282c734045b47241988e2b9fdf0dc7e, type: 2}
3611   - - {fileID: 7400000, guid: 698d03f46785361449a10cc0003862eb, type: 2}
3612   - - {fileID: 7400000, guid: e193836512c744c4299651990fc3ca10, type: 2}
3613   - - {fileID: 7400000, guid: c4d452a56e2f4ee4a83e5679f969a354, type: 2}
3614   - - {fileID: 7400000, guid: 220a675640cc72d4f9c8d364c9a377b4, type: 2}
3615   - - {fileID: 7400000, guid: 9a1e34a6954967f4fb3982394bf61eef, type: 2}
3616   - - {fileID: 7400000, guid: 039911b68664f7b40b97e2665893a1e5, type: 2}
3617   - - {fileID: 7400000, guid: b4a4a507b5b85404f9ca30cf2855b359, type: 2}
3618   - - {fileID: 7400000, guid: 3b67cb87e08f4e34badc00f7b49d2591, type: 2}
3619   - - {fileID: 7400000, guid: dc854de773a9e3f488c7a1b42d6a460b, type: 2}
3620   - - {fileID: 7400000, guid: 21b376087ddd4ec46a1da0c3ba1181d9, type: 2}
3621   - - {fileID: 7400000, guid: db84b318b67dbc54fa1fab6d31dfeb6e, type: 2}
3622   - - {fileID: 7400000, guid: 47e5da18eda740844ba111cfab49d0eb, type: 2}
3623   - - {fileID: 7400000, guid: ba9dc32834cf193429f27449b1d9d701, type: 2}
3624   - - {fileID: 7400000, guid: 22f7b3c892f0e5e41b120798d7953026, type: 2}
3625   - - {fileID: 7400000, guid: 9396f2d833a082446b36b0cda61ba87c, type: 2}
3626   - - {fileID: 7400000, guid: 289449396bffd4045b8657269df378f2, type: 2}
3627   - - {fileID: 7400000, guid: 99bb7e6adbe6d5f4984c51d5d5e92045, type: 2}
3628   - - {fileID: 7400000, guid: b6faf58a03a0dc24cb9777c70fda828b, type: 2}
3629   - - {fileID: 7400000, guid: b2b18bfa970783a4ab32945b1c4bc54b, type: 2}
3630   - - {fileID: 7400000, guid: a8b0488b23a43b3499d2b1d8b81f0707, type: 2}
3631   - - {fileID: 7400000, guid: ccdf6bab5e56c0447abfc0a8f745b62c, type: 2}
3632   - - {fileID: 7400000, guid: 8d2c7cdb67fea144e9660db7edd82239, type: 2}
3633   - - {fileID: 7400000, guid: 6191f3fb2e8027b48ac60aa48c11065d, type: 2}
3634   - - {fileID: 7400000, guid: dbf77a3c567182846bad50598584109d, type: 2}
3635   - - {fileID: 7400000, guid: d2f41e4d1ce31a4458ccdab2cd91faae, type: 2}
3636   - - {fileID: 7400000, guid: fc72e7fd88de0b94fb9b050fc1368547, type: 2}
3637   - - {fileID: 7400000, guid: 5b7bf0ae891107f4aaa366ba42eac9ee, type: 2}
3638   - - {fileID: 7400000, guid: d9c72b1fb167df045ae7ac711d1dee6c, type: 2}
3639   - - {fileID: 7400000, guid: d927185f3fb021844834f7086d346e3a, type: 2}
3640   - - {fileID: 7400000, guid: e62d77cfc7d0d104b84d8beb5ef72c33, type: 2}
3641   - - {fileID: 7400000, guid: 1dd400df2179f94469eb2480a313a8cf, type: 2}
  3597 + - {fileID: 7400000, guid: c888b74092e95d647bde3a70261c79a7, type: 2}
  3598 + - {fileID: 7400000, guid: 40d0a790b3070ce4d81fc3da05bb1963, type: 2}
  3599 + - {fileID: 7400000, guid: b51aee90ed0d25840b3c3d07b0138c89, type: 2}
  3600 + - {fileID: 7400000, guid: 360cc2b0364920c4ebc83c179b438ec1, type: 2}
  3601 + - {fileID: 7400000, guid: a1df8cb05298af045b2be5384f26437c, type: 2}
  3602 + - {fileID: 7400000, guid: 37c181c0836f84d4a8e25e67948031dd, type: 2}
  3603 + - {fileID: 7400000, guid: 4876b0814a4a3fd4386a47aead3d7207, type: 2}
  3604 + - {fileID: 7400000, guid: f631fe8169818ba4aaf06daed9e39a7e, type: 2}
  3605 + - {fileID: 7400000, guid: 2e44a90255a34fc4daaf3501a03ba3f3, type: 2}
  3606 + - {fileID: 7400000, guid: 37682432023174c4e9a65c33c5bcf6ad, type: 2}
  3607 + - {fileID: 7400000, guid: 640c9d6234220764b893b1f4610cdd7e, type: 2}
  3608 + - {fileID: 7400000, guid: e3f85472d697c2b48a0f45c19e777c61, type: 2}
  3609 + - {fileID: 7400000, guid: 37acbbb29e9f37645bc036795319ac94, type: 2}
  3610 + - {fileID: 7400000, guid: 67ff80d2ea811764582b3c4cfb2add22, type: 2}
  3611 + - {fileID: 7400000, guid: 5e103a53e53391843a93077f19061252, type: 2}
  3612 + - {fileID: 7400000, guid: 0dbce6a38bccda54b8d8443be19c2905, type: 2}
  3613 + - {fileID: 7400000, guid: 7391bb14ca59ae34582bb754db53a460, type: 2}
  3614 + - {fileID: 7400000, guid: d4a1fa94131f32c418ffdadf548db9f2, type: 2}
  3615 + - {fileID: 7400000, guid: 3dca07e4550670b4e842986e06aa5a41, type: 2}
  3616 + - {fileID: 7400000, guid: 8d22d5e519d6b8e498f48b51631ce8f7, type: 2}
  3617 + - {fileID: 7400000, guid: 7952ed760df457746864064d057a1d9f, type: 2}
  3618 + - {fileID: 7400000, guid: 6feff12708ff8c74282adac908065059, type: 2}
  3619 + - {fileID: 7400000, guid: ed5c2ec7af4ecdf46bc8ad611a9bbe9e, type: 2}
  3620 + - {fileID: 7400000, guid: 27f596f7fb38c374986ba04b5bf611e8, type: 2}
  3621 + - {fileID: 7400000, guid: 2eb5f0288bd3a974ea446273239d009a, type: 2}
  3622 + - {fileID: 7400000, guid: 3fd16a68343cc144cb70cb3db4b0aa9b, type: 2}
  3623 + - {fileID: 7400000, guid: 00ba6a68a60cf8348913c1e1d08225e3, type: 2}
  3624 + - {fileID: 7400000, guid: 5600eee8fa75c8d4c92845cd1176bceb, type: 2}
  3625 + - {fileID: 7400000, guid: 3d4889193e5c46d4a8a9ea1282279390, type: 2}
  3626 + - {fileID: 7400000, guid: 85921d4ab9939a74b8d2a58fc4163730, type: 2}
  3627 + - {fileID: 7400000, guid: ab8c477aa3617b348ac1537726e6842f, type: 2}
  3628 + - {fileID: 7400000, guid: 338176eab422f4343ae0ae772d51dfa6, type: 2}
  3629 + - {fileID: 7400000, guid: 0373e89bc94f97f42aefada1a5e994ac, type: 2}
  3630 + - {fileID: 7400000, guid: beca8deb081aa4b4997e3d50fa3c04cc, type: 2}
  3631 + - {fileID: 7400000, guid: 48f6c6bc2bc27744e9f12e87e4b504eb, type: 2}
  3632 + - {fileID: 7400000, guid: c1e3354da9dc9b74cacf65993ca5639e, type: 2}
  3633 + - {fileID: 7400000, guid: 9d3f854d217779e47b726e84a47da4fe, type: 2}
  3634 + - {fileID: 7400000, guid: 56fd236d710575546b549738e3dc9933, type: 2}
  3635 + - {fileID: 7400000, guid: bf04328d95b211f4b96bc4d5e4f5523c, type: 2}
  3636 + - {fileID: 7400000, guid: e1bee7fd96ded354aa9bd72e4008a4c5, type: 2}
  3637 + - {fileID: 7400000, guid: d369df1e9db31e74e8bec69b7e1eeaef, type: 2}
  3638 + - {fileID: 7400000, guid: bee4bcce8696adb44b4af556524884d8, type: 2}
  3639 + - {fileID: 7400000, guid: 024064fef8ad0984aa83a059ef0e97c8, type: 2}
  3640 + - {fileID: 7400000, guid: d071f97fc9e45a745ad417f099115813, type: 2}
  3641 + - {fileID: 7400000, guid: 36d0b9cf63020da4286cf20b16b495c5, type: 2}
3642 3642 m_WrapMode: 0
3643 3643 m_PlayAutomatically: 1
3644 3644 m_AnimatePhysics: 0
... ...
Assets/Scripts/Export Video/MediaShareAndroid.cs
... ... @@ -67,13 +67,14 @@ public class MediaShareAndroid : MonoBehaviour
67 67 try
68 68 {
69 69 FileStream SourceStream = new FileStream(Path.Combine(destination, FilePath), FileMode.OpenOrCreate);
  70 +
70 71 if (SourceStream.CanWrite)
71 72 {
72 73 SourceStream.Write(videoContent, 0, bytes);
73 74 SourceStream.Close();
74 75  
75   - Refresh(FilePath);
76   - finishWriting();
  76 + Refresh(FilePath,finishWriting);
  77 +
77 78 yield break;
78 79  
79 80 }
... ... @@ -88,8 +89,9 @@ public class MediaShareAndroid : MonoBehaviour
88 89 catch (Exception e)
89 90 {
90 91 PlayerLogger.Log("MediaShareAndroid", "WriteOnAndroid", "Message: " + e.Message);
91   - PlayerLogger.Log("MediaShareAndroid", "WriteOnAndroid", "Message: " + e.StackTrace);
  92 + PlayerLogger.Log("MediaShareAndroid", "WriteOnAndroid", "Message: " + e.StackTrace);
92 93 new AndroidToast().showToast("Você precisa dá permissão ao aplicativo", "LONG");
  94 +
93 95 errorWriting();
94 96 }
95 97  
... ... @@ -104,19 +106,33 @@ public class MediaShareAndroid : MonoBehaviour
104 106  
105 107 /* Calling Android Services to refresh the video path, making available to show in gallery*/
106 108  
107   - private void Refresh(string FilePath)
  109 + private void Refresh(string FilePath, Action finishWriting)
108 110 {
109 111 if (Application.platform == RuntimePlatform.Android)
110 112 {
111   -
112   - AndroidJavaClass jcUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
113   - AndroidJavaObject joActivity = jcUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
114   - AndroidJavaObject joContext = joActivity.Call<AndroidJavaObject>("getApplicationContext");
115   - AndroidJavaClass jcMediaScannerConnection = new AndroidJavaClass("android.media.MediaScannerConnection");
116   - //AndroidJavaClass jcEnvironment = new AndroidJavaClass("android.os.Environment");
117   - // AndroidJavaObject joExDir = jcEnvironment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory");
118   - string path = destination;
119   - jcMediaScannerConnection.CallStatic("scanFile", joContext, new string[] { path }, new string[] { "video/mp4" }, null);
  113 + /*
  114 + AndroidJavaClass jcUnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  115 + AndroidJavaObject joActivity = jcUnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
  116 + AndroidJavaObject joContext = joActivity.Call<AndroidJavaObject>("getApplicationContext");
  117 + AndroidJavaClass jcMediaScannerConnection = new AndroidJavaClass("android.media.MediaScannerConnection");
  118 + //AndroidJavaClass jcEnvironment = new AndroidJavaClass("android.os.Environment");
  119 + // AndroidJavaObject joExDir = jcEnvironment.CallStatic<AndroidJavaObject>("getExternalStorageDirectory");
  120 + string path = Path.Combine(destination,FilePath);
  121 + jcMediaScannerConnection.CallStatic("scanFile", joContext, new string[] { path }, new string[] { "video/mp4" }, null);
  122 + */
  123 + Debug.Log("**create activity instance");
  124 + AndroidJavaClass classPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  125 + AndroidJavaObject objActivity = classPlayer.GetStatic<AndroidJavaObject>("currentActivity");
  126 +
  127 + Debug.Log("**create Uri class");
  128 + AndroidJavaClass classUri = new AndroidJavaClass("android.net.Uri");
  129 +
  130 + Debug.Log("**create Intent object");
  131 + AndroidJavaObject objIntent = new AndroidJavaObject("android.content.Intent", new object[2] { "android.intent.action.MEDIA_SCANNER_SCAN_FILE", classUri.CallStatic<AndroidJavaObject>("parse", "file://" + Path.Combine(destination,FilePath)) });
  132 +
  133 + Debug.Log("**call sendBroadcast");
  134 + objActivity.Call("sendBroadcast", objIntent);
  135 + finishWriting();
120 136  
121 137  
122 138 }
... ...
ProjectSettings/ProjectSettings.asset
... ... @@ -165,7 +165,7 @@ PlayerSettings:
165 165 AndroidTargetDevice: 0
166 166 AndroidSplashScreenScale: 0
167 167 androidSplashScreen: {fileID: 0}
168   - AndroidKeystoreName: F:/Thiago Filipe/Downloads/keystore.keystore
  168 + AndroidKeystoreName: C:/Users/Thiago/Downloads/keystore.keystore
169 169 AndroidKeyaliasName: vlibras
170 170 AndroidTVCompatibility: 0
171 171 AndroidIsGame: 0
... ...