Search Unity

[Released] Android Native Plugin

Discussion in 'Assets and Asset Store' started by stanislav-osipov, Sep 20, 2013.

  1. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    that is what i do, i call FinishMatch on the second Player, the one who lost, after the first player, the one who won, called FinishMatch.

    But the Problem is: The first player can see the Game under "completed Games" the second player not! it's still under "your turn" matches, i can call FinishMatch a 100 times without changing.
     
  2. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    What GP_ParticipantResults do you set while finishing the match?
    Are they equal for second and first player?
    Please, could you provide me the code snippet with FinishMatch method call for second and first player?

    It will really help me to find out the reason of such behavior.
    Looking forward to your reply.

    Cheers!
     
  3. Dreamonaut

    Dreamonaut

    Joined:
    May 19, 2014
    Posts:
    32
    anyone having difficulty to create a room for realtime multiplayer ? ? it used the works fine but now i get an error code 4
    STATUS_NETWORK_ERROR_NO_DATA.
    I tried rebooting my phone, playing with a different account, i cant play multiplayer anymore, that's really weird since i didn't do any change to my multiplayer code and it used to work fine. Here is the error in the Eclipse Console :


    01-30 16:42:28.601: D/AndroidNative(8832): GAME_CLIENT_MANAGER findMatch!!!
    01-30 16:42:28.751: D/dalvikvm(13600): GC_CONCURRENT freed 1293K, 11% free 13137K/14680K, paused 2ms+4ms, total 44ms
    01-30 16:42:29.161: I/libjingle(24170): Token type:OAuth2
    01-30 16:42:29.161: I/libjingle(24170): Final XMPP server hostname talk.google.com port to 5222
    01-30 16:42:29.362: I/libjingle(24170): OpenSSLAdapter::OnConnectEvent
    01-30 16:42:29.472: I/libjingle(24170): BeginSSL: talk.google.com
    01-30 16:42:29.662: W/libjingle(24170): Warning(openssladapter.cc:388): ContinueSSL -- error -1
    01-30 16:42:29.662: W/libjingle(24170): Warning(openssladapter.cc:397): OpenSSLAdapter::Error(ContinueSSL, -1)
    01-30 16:42:29.662: I/libjingle(24170): SSL Cleanup
    01-30 16:42:29.672: I/libjingle(24170): Token type:OAuth2
    01-30 16:42:29.672: I/libjingle(24170): Final XMPP server hostname talk.google.com port to 5222
    01-30 16:42:29.762: I/libjingle(24170): OpenSSLAdapter::OnConnectEvent
    01-30 16:42:29.902: I/FitnessApp(19259): Performing Wearable Account Sync
    01-30 16:42:29.952: I/libjingle(24170): BeginSSL: talk.google.com
    01-30 16:42:29.982: D/WearableService(17583): callingUid 10023, callindPid: 17583
    01-30 16:42:30.002: V/BaseAuthAsyncOperation(13636): All scopes had been granted in the past, skip access token fetching
    01-30 16:42:30.012: V/BaseAuthAsyncOperation(13636): access token request successful
    01-30 16:42:30.032: I/FitnessApp(19259): Error connecting to gcore client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
    01-30 16:42:30.032: I/FitnessApp(19259): WearableSync Completed in 127 ms
    01-30 16:42:30.052: W/libjingle(24170): Warning(openssladapter.cc:388): ContinueSSL -- error -1
    01-30 16:42:30.052: W/libjingle(24170): Warning(openssladapter.cc:397): OpenSSLAdapter::Error(ContinueSSL, -1)
    01-30 16:42:30.052: I/libjingle(24170): SSL Cleanup
    01-30 16:42:30.052: D/AndroidNative(8832): onRoomCreated: 4
    01-30 16:42:30.052: W/AppOps(572): Bad call: specified package com.google.android.play.games under uid 10591 but it is really 10099
    01-30 16:42:30.062: I/Unity(8832): AN: Using proxy for class: com.androidnative.gms.core.GameClientBridge method:showWaitingRoomIntent
    01-30 16:42:30.062: I/Unity(8832):
    01-30 16:42:30.062: I/Unity(8832): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
    01-30 16:42:30.072: D/ChimeraCfgMgr(13636): Loading module com.google.android.gms.games from APK com.google.android.play.games
    01-30 16:42:30.072: D/ChimeraModuleLdr(13636): Module APK com.google.android.play.games already loaded

    01-30 16:42:30.072: I/Unity(8832): AndroidJavaException: java.lang.NullPointerException
    01-30 16:42:30.072: I/Unity(8832): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0

    01-30 16:42:30.072: I/Unity(8832): at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
    01-30 16:42:30.072: I/Unity(8832): at UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) [0x00000] in
     
  4. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    It looks like you have NullPointerException while ShowWaitingRoom method call.
    I need additional information to find out the reason of such behavior.
    Could you provide more extended LogCat log from your Android device.
    Just add Unity and AndroidNative filters to your Eclipse and perform the same set of aactions as earlier.

    My advice for you is to contact The Stan's Assets Support Team directly via support@stansassets.com
    You will get the best assistance shortly. That's the best approach in such an urgent issues.

    Best regards,
    Alex
     
  5. NINPO

    NINPO

    Joined:
    Jun 21, 2015
    Posts:
    9
    How can I combine IOSDeploy MobileSocialPlugin and AndroidNative ?

    Why there is so many incompatibilities between your's plugin ? Everytime i want to update. I just got a big headeach.


    If i install IOSDeploy First and MobileSocialPlugin after. IOSDeploy ask me to buy the plugin.... and i can't use it.

    If i install MobileSocialPlugin first and IOSDeploy Unity give me error on PluginsInstalationUtil and SA_EditorTool


    Why i need to buy and install IOSDeploy to be able to add Social.Framwork and MessageUI.Framework for postprocessing build on IOS ?


    You're plugin can be great but sometimes is really a shame.
     
  6. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I added your report to our bug tracker.
    Additional testing will take place on our side.
    If any issue will take place - fix will be provided.

    You can ask for the status of this case The Stan's Assets Support Team directly.

    Best regards,
    Alex
     
  7. Meic

    Meic

    Joined:
    Jun 27, 2013
    Posts:
    10
    Hi. Just updated android native to 7.4 (and got settings partially wiped out) and Facebook to 7.4.0. When I was trying to set up facebook settings fields by settings window the only thing I achieved was this error :

    NullReferenceException: Object reference not set to an instance of an object
    SocialPlatfromSettingsHelper.FacebookSettings () (at Assets/Extensions/GooglePlayCommon/Editor/SocialPlatfromSettingsHelper.cs:100)
    AndroidNativeSettingsEditor.SocialSettings () (at Assets/Extensions/AndroidNative/Editor/AndroidNativeSettingsEditor.cs:1696)
    AndroidNativeSettingsEditor.OnInspectorGUI () (at Assets/Extensions/AndroidNative/Editor/AndroidNativeSettingsEditor.cs:166)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1231)
    UnityEditor.DockArea:OnGUI()


    What's more, replacing current SocialSettings.asset with the one form backup also failed with the same results (errors). Is that a bug? Is there any other way to set facebook App Id/Name?

    Edit: I forgot to mention that I'm using Unity 5.3.2.
     
    Last edited: Feb 4, 2016
  8. arespics

    arespics

    Joined:
    Jul 23, 2015
    Posts:
    1
    Hi. Stan has been very kind to me answering all the emails i've sent to support@stansassets.com but i still have not my problem solved and i was wondering if maybe someone here will have a solution. My problem is that the twitter sample scene is not working. I've tried on 2 different phones using the last unity 3d and android native plugin versions and repeating countless times the documentation steps. After identificating myself from the application one phone sends me to the default browser saying that there is no website to reach. The other one just gives me a black screen.
    Anyone had the same issue and can help please?
    Regards to everyone.
     
  9. Dreamonaut

    Dreamonaut

    Joined:
    May 19, 2014
    Posts:
    32
    I have just noticed an issue in the Multiplayer Real Time feature, not sure if it's a bug in my code or i just don't understand how it works. I thought the connection was peer to peer but in a game with 3 players, if the player that created the room leave, the two other players dont send any messages nomore. is this a normal behaviour ? Thank you !
     
  10. ikarjon

    ikarjon

    Joined:
    Mar 31, 2013
    Posts:
    8
    Hi,
    Small question regarding the CreateNewSnapshot. According to Google the cover image is optional. How can I use CreateNewSnapshot without specifying the cover image? Am I missing something ? Or do I always have to provide a cover image when saving games?

    Thank you.
     
  11. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    You are right, there is no such a requirement on Google Play Services side.
    This is Android Native requirements.

    So, you may provide some default Texture2D as a cover image for every new snapshot.
    If it's not appropriate for you, you may send the feature request to Stan's Assets Support Team and the feature you need will be implemented shortly.


    Cheers!
     
  12. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I think, you got this error because of FacebookSettings.asset file wasn't created in your Unity project.

    Please, go to Facebook->Edit Settings menu. As a result, the Facebook configuration asset will be created.
    You will be able to edit Mobile Social Settings (App Name, App Id) after that.
    All the changes you made will be setup to Facebook Settings automatically.

    Best regards,
    Alex
     
  13. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Please, send me your e-mail, I'll check your case.
    You will get my feedback as soon as possible.

    Cheers!
     
  14. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    For Google Play Services there is no difference between room creator and general player.
    Ofcourse, you can mark the player as a room creator (in other words server), but it will be related to your particular use-case.
    So, most likely this issue is related to your implemented Real-Time Multiplayer logic.

    Could you send me your sample multiplayer project for test or it's your major project?
    My advice for you is to contact Stan's Assets Support Team.
    You wiil get the great assistance with any issues you are facing in your project.

    Best regards,
    Alex
     
  15. JungsangE

    JungsangE

    Joined:
    Jan 17, 2015
    Posts:
    6
    Hi
    I have a problem to use android android license request.

    When I call function AN_LicenseManager.instance.StartLicenseRequest() , this function result is always ERROR_UNKNOWN.

    Can I test this function with debug mode on mobile device?

    Is this function is only working on google play published?
     
  16. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    To get Application Licensing ready to go, you have to submit at least beta-version of your application.
    Also, you should test such a functionality with keystore signed APK.

    Please, follow these instructions to make App Licensing works with your applcation.

    Best regards,
    Alex
     
  17. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    The minimum is android 2.3 API 10
     
  18. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    I am upgrading Android Native Plugin on an old project from 6.3 to the latest 7.4. 6.3 does not have a "Remove" button. I also have iOS Native installed, and I see some Stan's common directories, and I don't want to accidentally delete a folder that I actually need. So what is the best way to remove the plugin before installing 7.4?

    EDIT:
    I went ahead and took a risk by doing this:
    1. Deleted AllDocumentation, AndroidManifestManager, AndroidNative, GooglePlayCommon, StansAssets* in Extensions directory
    2. Deleted StansAssets directory in Plugins

    And then installing 7.4 from scratch, which worked fine for me.
     
    Last edited: Feb 13, 2016
    AlexRay likes this.
  19. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
    Push with OneSignal dont working anymore ??
     
  20. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Android Native supports OneSignal push notifications.
    Great guide about OneSignal SDK integration you can find here.

    Best regards,
    Alex
     
  21. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    hi, and sry for my late reply, hadn't much time in the last weeks!
    i left GP_ParticipantResults blank, cause i thought i don't need it and it still works for the first player who calls FinishMatch. What exactly do i have to send as results?

    in the meantime i upgraded to 7.4, haven't changed anything in my code, but if i start a match and send null as the next player, cause it's automatch, then i get an exception.
    here is the log:
    Code (CSharp):
    1. 02-16 01:59:49.385 I/Unity   (6102): AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
    2. 02-16 01:59:49.385 I/Unity   (6102): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
    3. 02-16 01:59:49.385 I/Unity   (6102): at com.androidnative.gms.core.GameClientBridge.TBM_TakeTrun(GameClientBridge.java:831)
    4. 02-16 01:59:49.385 I/Unity   (6102): at com.unity3d.player.ReflectionHelper.nativeProxyInvoke(Native Method)
    5. 02-16 01:59:49.385 I/Unity   (6102): at com.unity3d.player.ReflectionHelper.a(Unknown Source)
    6. 02-16 01:59:49.385 I/Unity   (6102): at com.unity3d.player.ReflectionHelper$1.invoke(Unknown Source)
    7. 02-16 01:59:49.385 I/Unity   (6102): at java.lang.reflect.Proxy.invoke(Proxy.java:393)
    8. 02-16 01:59:49.385 I/Unity   (6102): at $Proxy1.run(Unknown Source)
    9. 02-16 01:59:49.385 I/Unity   (6102): at android.os.Handler.handleCallback(Handler.java:739)
    10. 02-16 01:59:49.385 I/Unity   (6102): at android.os.Handler.dispatchMessage(Handler.java:95)
    11. 02-16 01:59:49.385 I/Unity   (6102): at android.os.Looper.loop(Looper.java:148)
    12. 02-16 01:59:49.385 I/Unity   (6102): at android.app.ActivityThread.main(ActivityThread.java:5417)
    13. 02-16 01:59:49.385 I/Unity   (6102): at java.lang.reflect.Method.invoke(Native Method)
    14. 02-16 01:59:49.385 I/Unity   (6102): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    15. 02-16 01:59:49.385 I/Unity   (6102): at com.android.internal.os.Zygot
    16. 02-16 01:59:50.919 I/Unity   (6102): windowFocusChanged: false
    17. 02-16 01:59:50.937 I/Unity   (6102): onPause
    thanks for your work!
     
  22. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Let's try to clarify this case.

    GP_ParticipantResults should be used for setup results of every participant.
    To create GP_ParticipantResults you have to provide participant ID, GP_TBM_ParticipantResult and placing.

    GP_TBM_ParticipantResult is actually the enum value from following:
    Code (CSharp):
    1. public enum GP_TBM_ParticipantResult  {
    2.     MATCH_RESULT_UNINITIALIZED = -1,
    3.     MATCH_RESULT_WIN = 0,
    4.     MATCH_RESULT_LOSS = 1,
    5.     MATCH_RESULT_TIE = 2,
    6.     MATCH_RESULT_NONE = 3,
    7.     MATCH_RESULT_DISCONNECT = 4,
    8.     MATCH_RESULT_DISAGREED = 5
    9. }
    placing is integer number for player placing, e.g. first place/second/third and so on.

    If you have just created Turn-Based match and you should perform the very first turn, you have to provide string.Empty instead null for pendingParticipantId.

    Best regards,
    Alex
     
  23. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
    hi thx i read it but some links dont working and when testing it its not 100%.
    I testing it on my s5 and s3 and when i send a message it show only one device s3 but s5 not??
    And its only working when i click test notifcation before i can send a message :/
     
  24. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    If you need any additional information - please, ask me or contact Stan's Assets Support Team directly.

    Did you check push notifications settings on both (S3 and S5) devices?
    I need additional information to help you.
    What do you mean click test notification before? What test notification click?

    Cheers!
     
  25. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @AlexRay ,

    When will be available, the fix for OneSignal SDK in ANP ?

    Thanks?
     
  26. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Hopefully simple question about Leaderboards and Achievements:

    What are the Leaderboards and Achievements dropdown lists for in the Plugin?
    Isn't it enough to just modify ids.xml with your achievement and leaderboard lists?
    Is it necessary to fill out?
     
  27. MrGky93

    MrGky93

    Joined:
    Feb 27, 2014
    Posts:
    281
    hi have a another method i only use the onsignal and Stan's Assets . But using only the onesignal script in the tut from onesignal now works :)
     
  28. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Fix related to new OneSignal SDK location is available.
    Just replace AndroidNativeSettingsEditor.cs script in your project with the script attached to this post.
    All the issues with OneSignal SDK recognition should be fixed.

    Cheers!
     

    Attached Files:

  29. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Let's try to clarify this case.

    The best approach is to provide ids.xml file to Plugins/Android/AN_Res/res/values folder and fill in Leaderboards and Achievements drop-down lists of Android Native Settings Inspector window.

    For example, in Ultimate Mobile plugin the situation is following.
    Just assume, that you imported ids.xml file and added few Leaderboards to Ultimate Mobile Settings.
    In a case of Ultimate Mobile, you should provide leaderboards ID for Ultimate Mobile itself, iOS Leaderboard ID and Android platform (from Google Play Console).
    leader.png
    You can see on the screenshot above, that drop-down list with Leaderboard's names takes place.
    These names have been parsed from ids.xml file.
    You select a name, ID will be provided under the hood.

    For Android Native, the same functionality will be implemented as well.
    So, the main reason to provide ids.xml from you Google Developer Console is to prevent wrong data input.
    If you have any additional questions - I am open to the conversation.

    Best regards,
    Alex
     
  30. Waltari

    Waltari

    Joined:
    Mar 3, 2014
    Posts:
    3
    I am interested in utilizing this app for its following functionality:
    Camera And Gallery
    * Taking Photo from Camera
    * Loaing Texture from Gallery
    * Saving Texture to Gallery

    When was the last time this functionality was updated? I've tried out two other packages that did the same thing, but they proved to be buggy on the latest Android devices. Has anyone tried this out on Android 5.0 or later? Thanks!
     
  31. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,

    Android Native plugin is fully compatible with Android 5.0 or later versions.
    Great description of the functionality you mentioned you can find here.

    If you have any additional questions - please, contact Stan's Assets Support Team directly via support@stansassets.com
    You will get qualified feedback as soon as possible.

    Cheers!
     
  32. Waltari

    Waltari

    Joined:
    Mar 3, 2014
    Posts:
    3
    I bought the plugin and it works fine on previous Android versions, but on 5.0.1 Spirit LG it doesn't work consistently :/ When I select an image it merely opens the gallery again and if I select an image another time then it restarts the whole app, instead of just the gallery. Here are some things it prints into the console: http://pastebin.com/yDDjuAfX

    There is also a whole bunch of messages of various apps crashing in the log cat.

    Did I need to manually edit my AndroidManifest somehow? What am I missing or is it really a bug in the plugin?

    I made a new project with nothing but the gallery load and it still the same error.
     
    Last edited: Feb 21, 2016
  33. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    At first I want to say, that the messages you get are not crash reports, there are just warning messages.
    So, that's not the reason of why the application is actually crashing.

    You have very strange behavior with your project indeed!
    My advice for you is to contact Stan's Assets Team directly.
    Provide your project with the issue reproduced and you will get the assistance as soon as possible.

    Cheers!
     
  34. Waltari

    Waltari

    Joined:
    Mar 3, 2014
    Posts:
    3
    I'll send email to "support@stansassets.com". Is there anywhere else I could contact folks?

    Here is the project with a bug description as well, if someone was kind enough to check it out. Thanks!

    https://drive.google.com/folderview?id=0BzQ17Ml2aCRDRER4UC1IYU45MXc&usp=sharing
     
  35. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    hey, me again!
    i now have GP_ParticipantResult in my FinishMatch() but still the same Problem! The loser have the finished match always under "your turn" even if i call FinishMatch() for him too.

    here is my code from my GameEnded Method:
    Code (CSharp):
    1.     public void GameEnded()
    2.     {  
    3.         if (score.playerScore1 > score.playerScore2)
    4.         {
    5.             gameResults = new GP_ParticipantResult(myMatch.PendingParticipantId, GP_TBM_ParticipantResult.MATCH_RESULT_WIN, 1);
    6.         }
    7.         else if (score.playerScore1 == score.playerScore2)
    8.         {
    9.             gameResults = new GP_ParticipantResult(myMatch.PendingParticipantId, GP_TBM_ParticipantResult.MATCH_RESULT_TIE, 0);
    10.         }
    11.         else if (score.playerScore1 < score.playerScore2)
    12.         {
    13.             gameResults = new GP_ParticipantResult(myMatch.PendingParticipantId, GP_TBM_ParticipantResult.MATCH_RESULT_LOSS, 2);
    14.         }      
    15.        
    16.         GooglePlayTBM.Instance.FinishMatch(myMatch.Id, myData, gameResults);
    17.     }
    thanks for your help!
     
  36. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Hello, Under Stan assets ---> Android Native --> Edit setting ---> Google play I'm having this warning message:
    "Android resource folder DOESN'T exist" How can i Fix it?
     
  37. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    To get the best support it to contact Support Team via e-mail.
    So, you are doing right!

    I can see your e-mail in our support service account.
    You will get support engineer feedback shortly!

    Cheers!
     
  38. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    At first, I want to ask - did you installed the plugin correctly?
    Menu Window->Stan's Assets->Android Native->Edit Settings->Install Plugin

    Second, please, check following guide how to get Google Play Services settings resources.

    Best regards,
    Alex
     
  39. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,

    FinishMatch should be called on all the participants sides.
    E.g. if you have the game with three players, you should perform FinishMatch call on first, second and third player's side.
    That's Google Play Services guideline for Turn-Based Multiplayer.

    When the match has been played to completion (for example, a user has won the game), your game should call FinishMatch() to upload the user’s game data and signal to the other participants that the match is over. When your game invokes this method for the first time during a match, it must be during the user's turn. The match then appears under the Completed Matches category in the user's match list UI.

    Once a player calls FinishMatch() for the first time in the match, your game cannot call takeTurn() again in this match. Google Play games service sends a notification to all other match participants to inform them that the match is over. These participants see this match under Your Turn category in their respective match list UIs. At this point, your game can call finishMatch() for these participants to save their final game data. Invoking this method also moves the match to the Completed Matches category in the participant’s match list UI.

    Best regards,
    Alex
     
  40. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    i think i found my mistake, will test it soon!
     
    Last edited: Feb 25, 2016
  41. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Hello Guys,
    I've this issue: I'm trying to display my leaderboard on my device.
    This is what I've done so far
    1. Follow your steps to setUp The plugin: https://unionassets.com/android-native-plugin/plugin-setup-79
    2. Follow your steps to setUp The sdk and the google play service
    Check list:
    • Google Play services SDK installed
    • Added the game into the Developer console.
    • Create keystore and send a test apk to the google developer console.
    3. on the Assets/Plugins/Android/AN_Res/res/values/ids.xml i've added my application ID and my leaderboard ID.
    4. Added a new user a tester.
    4. This is the code that I use to autenticate the user:

    Code (CSharp):
    1.         if(GooglePlayConnection.State != GPConnectionState.STATE_CONNECTED) {
    2.             GooglePlayConnection.Instance.Connect ();
    3.             GooglePlayConnection.ActionConnectionResultReceived += ActionConnectionResultReceived;
    4.         }
    and this is my callback:

    Code (CSharp):
    1.     private void ActionConnectionResultReceived(GooglePlayConnectionResult result) {
    2.         if(result.IsSuccess) {
    3.             Debug.Log("Connected!");
    4.             GooglePlayManager.Instance.LoadLeaderBoards ();
    5.         } else {
    6.             Debug.Log("Cnnection failed with code: " + result.code.ToString());
    7.         }
    8.     }
    Now when I first run this code, the login pop-up will appare and I cose the test user that I've previously added. But when I run the code to show the leaderboard :

    Code (CSharp):
    1. GooglePlayManager.Instance.ShowLeaderBoardsUI();
    Noting will appare.
    Now if I go to another scene and came back to this one, the condition GooglePlayConnection.State != GPConnectionState.STATE_CONNECTED
    will always be True and so every time I have to log-in again.

    What is the problem?
    Thanks.
     
  42. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Please, could you provide LogCat logs from your device?
    Great guide how to capture LogCat logs you can find here.
    Add Unity and AndroidNative filter to Eclipse and capture the moment while testing the logic you described in your post.

    I'll check the logs you will provide and try to find out the reason of such behaviour.
    Looking forward to your reply.

    Cheers!
     
  43. Max_power1965

    Max_power1965

    Joined:
    Oct 31, 2013
    Posts:
    127
    Hello, I've atteched the LogCat. Let me know.
    Thanks.
     

    Attached Files:

  44. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    Sooooo i thought i found the mistake, but it's still not working.

    what i do step by step:
    (i have a quiz game, so player 2 is always the one, who calls FinishMatch first. Lets pretend player 2 won)
    player 2 finish his last turn and calls finish match like this:
    Code (CSharp):
    1. GooglePlayTBM.Instance.FinishMatch(myMatch.Id, myData, gameResults);
    in gameResults i have ParticipantId: p_2, GP_TBM_ParticipantResult.MATCH_RESULT_WIN and Placing: 1
    until this point, everything works fine and the game for player 2 is under "Finished Match".
    now player 1 click on the game, see the game result and then calls:
    Code (CSharp):
    1. GooglePlayTBM.Instance.FinishMatch(myMatch.Id, myData, gameResults);
    in gameResults i have ParticipantId: p_1, GP_TBM_ParticipantResult.MATCH_RESULT_LOSS and Placing: 2

    it gets called, but nothing change, the game for player 1 is still under "Your Turn". Don't see why.

    thanks for your help!
     
  45. flatpastel

    flatpastel

    Joined:
    Feb 27, 2016
    Posts:
    5
    Hello, Stan! I've purchased your Android Native Plugin, and still working on it. I have a question. How to use your Android Native Plugin for facebook sharing, but still include the text? I already know that facebook text will be ignored with your plugin, but any other way to do it? Thank you!
     
  46. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I inspected the LogCat logs you provided.
    Unfortunately, this is not enough informative log.
    I can not even find the application start moment.
    Add Unity and AndroidNative filter to Eclipse and capture the moment begin with application start.

    Please, follow the instructions mentioned above and provide useful information to make me able to help you.
    Another one good approach is to contact Stan's Assets Support Team directly via e-mail.
    You will get great support in a very short time.

    Best regards,
    Alex
     
  47. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I think you need Facebook sharing with OAuth check.
    In such a way both text and image you provide will be posted.

    Great guide about Facebook OAuth API with Android Native you can find here.

    Cheers!
     
  48. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    With the latest update of the plugin, there is new API available for such a cases.
    Please, replace GooglePlayTBM.cs script in your project with the script from the attachment.

    Notes: E.g. you have the game with three players.
    The third participant makes a decision to finish the match.
    From the third player side, you should call FinichMatch method with ParticipantResults for all the players.
    First and second players should perform ConfirmMatchFinish method calls on its own sides.

    For the third player
    Code (CSharp):
    1. GooglePlayTBM.Instance.FinishMatch(myMatch.Id, myData, gameResults);
    First and second players
    Code (CSharp):
    1. GooglePlayTBM.Instance.ConfirmFinishMatch(myMatch.Id);
    Best regards,
    Alex
     

    Attached Files:

  49. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    yeah! it's working =)
    Thank you very much! But i am facing a new problem :X

    i want to get the current leaderboardscore of the player and add the points he won to that score and send it back as new leaderboardscore.
    The first few times it seemed to work, but now the current leaderboardscore is still the old one. the leaderboardscore is 27, but if i try to load that score, it still says 23. no matter how often i try it.

    here is my code:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Leaderboard_Handler : MonoBehaviour {
    5.  
    6.     GPLeaderBoard leaderboard;
    7.  
    8.     string LEADERBOARD_ID = "DELETED TO POST";
    9.  
    10.     int points;
    11.     int score;
    12.  
    13.     long allGlobal;
    14.  
    15.     public void OnUpdateLeaderboards(int pointsToAdd)
    16.     {
    17.         Debug.Log("INSIDE ONUPDATELEADERBOARDS");
    18.         points = pointsToAdd;
    19.  
    20.         //listening for load event
    21.         GooglePlayManager.ActionLeaderboardsLoaded += OnLeaderBoardsLoaded;
    22.         GooglePlayManager.Instance.LoadLeaderBoards();
    23.     }
    24.      
    25.     private void OnLeaderBoardsLoaded(GooglePlayResult result)
    26.     {
    27.         Debug.Log("INSIDE ONLEADERBOARDSLOADED");
    28.         GooglePlayManager.ActionLeaderboardsLoaded -= OnLeaderBoardsLoaded;
    29.         if (result.IsSucceeded)
    30.         {
    31.             Debug.Log("INSIDE result.IsSucceeded");
    32.  
    33.             leaderboard = GooglePlayManager.Instance.GetLeaderBoard(LEADERBOARD_ID);
    34.  
    35.             UpdateLeaderBoard();
    36.         }
    37.         else
    38.         {
    39.             Debug.Log("Leaderboard Loaded error: " + result.Message);
    40.         }
    41.  
    42.     }
    43.  
    44.     private void UpdateLeaderBoard()
    45.     {
    46.         if (leaderboard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL).LongScore < 0)
    47.         {
    48.             Debug.Log("current playerscore < 0");
    49.             allGlobal = 0;
    50.         }
    51.         else
    52.         {
    53.             Debug.Log("current playerscore > 0");
    54.             allGlobal = leaderboard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL).LongScore;
    55.             Debug.Log("LB_Score old: " + allGlobal);
    56.         }
    57.  
    58.         score = (int)allGlobal+points;
    59.         Debug.Log("LB_Score new: " + score);
    60.  
    61.         GooglePlayManager.Instance.SubmitScoreById(LEADERBOARD_ID, score);
    62.         Debug.Log("Highscore should be submitted");
    63.  
    64.     }
    65. }
     

    Attached Files:

    Last edited: Mar 1, 2016
  50. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I inspected the LogCat logs you provided.
    Following records take place:
    Maybe you have too many leaderboards requests (request/submit scores) in your applications.
    It exceeds you daily or user quota as it's indicated in LogCat records.

    I'll make additional tests on my side for this case.
    My advice for you is to contact The Stan's Assets Support Team directly.
    I'll inform you with any results available.

    Best regards,
    Alex