Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] Android Native Plugin

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

  1. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    The project only contains his asset and I have a problems merging manifest... Ok, the solution was go back to version 7.1.1 Now it compiles. I think version 7.2 is broken.

    Dr. Argento did you test this asset on Unity 5.2.1f1 ? You have to find a way to change that code to one functional :S
     
  2. John_1379

    John_1379

    Joined:
    Jan 28, 2015
    Posts:
    15
  3. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Hi,

    i'm trying to implement incentivized Facebook share and i'm having some problems on a friends device. On my device and with my facebook user account, i can normally post and get the feedback (post id) that it was shared.
    Everything works for me.

    But if i tell a friend to try it out. It shares on his facebook wall, but the post id isn't returned. The unity log is:

    No Post Id: The given key was not present in the dictionary


    I'm using the method:

    SPFacebook.instance.FeedShare


    Btw, the app is live on facebook. And it actually shares the post, just post id is empty. Meaning that we never know it succeded

    Code (CSharp):
    1. SPFacebook.OnPostingCompleteAction += OnPost
    2.  
    3. private void OnPost(FB_PostResult res) {
    4.     if(res.IsSucceeded) {                                             // --> This wil not trigger
    5.         Debug.Log("Posting complete");
    6.         Debug.Log("Posy id: " + res.PostId);
    7.         SA_StatusBar.text = "Posting complete";
    8.     } else {
    9.         SA_StatusBar.text = "Oops, post failed, something was wrong";
    10.         Debug.Log("Oops, post failed, something was wrong");
    11.     }
    12. }
     
  4. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    I had a similar problem.. Maybe you need the publish_actions permission, and the review approved by Facebook. Maybe on your phone works because you are de admin that have the keyhash and your friend doesn't have a keyhash on Facebook, that's why I think the problem is the publish_actions permission.
     
  5. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    That's what i thought as well. But whenever i try to submit the app for review on facebook with the publish_actions permission it says the following:

    You need to test this permission in your app with any account listed in Roles before you can submit for review. It looks like you haven't tested this permission because no API request has been made against publish_actions in the last 30 days


    The keyhash. I wouldn't be surprised that something could be wrong here. But usually facebook doesn't even allow login if the hash key is wrong?
     
  6. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    So far we tried that i added my friends FB account to the Roles->Testers account. The thing did not return the post id.

    Then i asked my friend, to login with one of the "Test Users". And it posted ok, the post id was returned, everything worked.

    This is starting to point more towards publish_actions permission. The problem is still getting the:

    You need to test this permission in your app with any account listed in Roles before you can submit for review. It looks like you haven't tested this permission because no API request has been made against publish_actions in the last 30 days


    warning
     
  7. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Here are the 2 logcats.

    The first one (Defero_logcat_facebookPostId.txt) is the one, where we use a "normal" user account.
    The second one (Defero_logcat_facebookTestUser.txt) is the one, where we try with the test user. Which works perfectly.

    The lines that are the most interesanting to me are:

    V/FBUnitySDK(17004): sending to Unity OnFeedRequestComplete({"callback_id":"1","posted":true})

    vs

    V/FBUnitySDK(27269): sending to Unity OnFeedRequestComplete({"id":"UzpfSTEwMDAxMDg4MjYyMzI0OToxMTI5MDMxNTU3NDkxMDU=","callback_id":"2","posted":true})

    How to solve it any further, i don't have any idea. Facebook is still saying that no publish_action api requests have been made.

    Even though, i don't really care about the post Id. I really just need the "posted:true" variable, to continue with the release of my game.
     

    Attached Files:

  8. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Does anyone have any ideas?... It's the only thing i'm waiting for, before the release.

    I did notice, that if you post with the facebook application, the post id doesn't matter that much, because if it's not posted OnPost isn't triggered at all.
    But if you post with web interface (it looks like it's using web), then the post=true yes, but the post_id is missing. So in that case it does work like it's written in the documents on stans website.

    So in a perfect world, i would be able to submit for a review now. If only :/
     
  9. 0xsven

    0xsven

    Joined:
    Mar 5, 2015
    Posts:
    18
  10. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Could it be, that the default app icon is still displaying?

    Check id the icon is in the correct directory. Cant remember off the top of my head, but AN has a drawable folder inside
     
    Last edited: Dec 19, 2015
  11. 0xsven

    0xsven

    Joined:
    Mar 5, 2015
    Posts:
    18
    The icon is in the right drawable folder! I tested everything I could think of -.-
     
  12. PatriotsUnity

    PatriotsUnity

    Joined:
    Dec 17, 2015
    Posts:
    17
    hii , we are new to the android native plugin and we install it today to start social part in our game ,

    i got 2 Errors after install (ver 7.3 i think)

    unity 5.3

    1 :
    Assets/Extensions/StansAssetsCommon/EditorTesting/UI/Scripts/SA_EditorTestingUIController.cs(33,52): error CS0117: `PlayerSettings' does not contain a definition for `productName'

    and

    2 :

    Assets/Extensions/StansAssetsCommon/EditorTesting/UI/Scripts/SA_EditorTestingUIController.cs(25,52): error CS0117: `PlayerSettings' does not contain a definition for `GetIconsForTargetGroup'

    Any idea? do i miss something ? just install it like every other plugin ...import all .. ?
     
  13. PatriotsUnity

    PatriotsUnity

    Joined:
    Dec 17, 2015
    Posts:
    17
    ok , When i turn off the "Unity Ads" In services Tab , the errors goes away, is that means Android Native cannot work with Unity Services and unity Ads?

    EDIT : nope the error keep coming on... No idea :S , maybe becuase i turn it on then off the messege return :S
     
  14. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Yes, the latest version of Android Native is compatible with all set of Unity version beginning from Unity 4.6.0f1 to Unity v5.3.1f1 (the latest official version for now).
    Feel free to update to the latest version in your project.

    If any issues with manifests merging will take places, feel free to contact me.

    Cheers!
     
  15. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    For what purposes you use publish_actions permission?
    From the official Facebook documentation:

    So, what the purpose of publish_actions for your project?
    Anyway, you definitely should have pass App Review to get all the functionality enable and ready to go.

    LogCat logs you provided are have to use (10k-12k of records in each of them).
    Please, add Unity and AndroidNative filters into Eclipse and capture needed moment.

    Best regards,
    Alex
     
    Last edited: Dec 23, 2015
  16. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    What plugin version do you use in your project?
    I would like to recommend you update to the latest version of the plugin in your project.
    Android Native v7.3.1 (the latest version available in Asset Store for now) has new updates related to local and push notifications icons.
    I think, it will be interesting for you.

    If any issue will take place - feel free to contact me.

    Best regards,
    Alex
     
  17. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    255
  18. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    It's down for me too
     
  19. Grafos

    Grafos

    Joined:
    Aug 30, 2011
    Posts:
    231
    Also, I've decided to update to the newer version as I don't feel comfortable staying behind
    for many versions, but

    SPFacebook.Instance.FeedShare

    still crashes my app.
    The equivalent command in the earlier versions was posting fine.
     
  20. Rustamovich

    Rustamovich

    Joined:
    Sep 5, 2014
    Posts:
    36
    Hi guys!

    Dear Android Native Plugin support team!

    Please give us detailed instruction how to update from for example version 7.0.1 to 7.3

    I was trying do it in old ways, but every time I've got tons of errors from some Facebook scripts
     
  21. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi friends, I wonder if you know or if it's possible to change de GooglePlay UI Color for Leaderboard or Achievements screen ? Thanks in advance !
     
  22. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello guys,
    There were some technical issues with our website.
    For now, all is fixed and available.
    Please, check it.

    Cheers!
     
  23. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    What kind of error do you get with FeedShare method?
    Please, provide full error stack trace and I'll be able to help you.

    Cheers!
     
  24. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I added your request into our tasks list.
    New documentation guide will be added to our documentation server and will be available for you.
    For now, if you need any kind of assistance, please, contact Support Team directly.

    Best regards,
    Alex
     
  25. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Google Play Services uses the new Palette APIs to find a key color from your application icon for that background.
    So, the only way to change it is to change your app icon.

    Cheers!
     
    RoyalCoder likes this.
  26. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    I have a small usability issue with showing native dialogs. It is tied to a very specific use case:

    1. In Unity, trigger a native dialog to appear when the user hits the Android back button.
    2. When testing on a device, the native dialog will often appear and then instantly disappear before the user can interact. The problem is that the plug-in's native dialog uses KeyEvent.KEYCODE_BACK to trigger the cancel button, which is the same button the user pressed to launch the dialog. It appears that Android can be twitchy with the back button. I'm guessing that it is sometimes sending multiple press events for what feels like a single button tap.

    Note that this is MUCH more likely to happen on an Amazon Fire OS device than on a stock Google Android device. It can be very hard to get the dialog to stay up (you have to tap very quickly and precisely). However, I can still get this to happen on my Lollipop Nexus device fairly easily.

    If this isn't something that can be fixed, could you please add a way in c# to disable the dialog from listening to the KeyEvent.KEYCODE_BACK event?

    Thanks
     
  27. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Alex,

    Is there a possibility to check the amount of unlocked achievements are unlocked from X number (5/40) in GooglePlay ? Thanks !
     
  28. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    950
    I found a bug in SA_Singleton. It has this variable called 'applicationIsQuitting', and if it's true then the singleton instance will always return null. However, it's set to true in the OnDestroy function, which doesn't just call if the application is quit, but also if scenes are switched.

    So if you call a singleton, then switch scenes, you'll never be able to access the singleton again.
     
  29. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi guys, I got a problem with OneSignal, I installed the latest version of ANP and I need One Signal for push notification, I installed the sdk and get this error in ANP Settings:

    I need a urgent fix please ! Thanks !
     
  30. Chintao

    Chintao

    Joined:
    Jun 26, 2014
    Posts:
    54
    hi!
    i want to finish my turn based mp game, the winner calls GooglePlayTBM.Instance.FinishMatch(...) and on the winners side, the game is then listed under "completed matches".
    on the losers side, it's then under "your turn". i then show the loser, that he has lost and then calls again GooglePlayTBM.Instance.FinishMatch(...)
    and then it should also gets listed under the losers "completed matches", but it doesn't!
    it just stay under "your turn", the documentation says it should get listed under "completed matches" too.

    any help?
     
  31. tnbao91

    tnbao91

    Joined:
    Sep 5, 2013
    Posts:
    46
    My game needs to implement facebook unity sdk, IAP of Unity, Admob and Google Play Service. Can ANP deal with it?
     
  32. RoyalCoder

    RoyalCoder

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

    The ANP contains all the stuff that you mentioned, and a lot more features ! Trust me I'm a costumer ;)

    Regards,
     
  33. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    255
    Whenever I use this plugin with another Android plugin, I always get the error

    Error building Player: CommandInvokationFailure: Unable to merge android manifests.

    Which takes ages to resolve. Is there a way to make it so this plugin works better with other plugins that have AndroidManifest files?
     
  34. tnbao91

    tnbao91

    Joined:
    Sep 5, 2013
    Posts:
    46
    is this plugin work with IAP of Unity 5.3.0 ? Because I already implement my IAP manager with IAP Unity and I just only want implement Admob and GPS with ANP.
     
  35. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    I'm very interested in this plugin, but what are the chances of adding the Face API or the new Mobile Vision APIs generally?

    I'm also interested in having the same things added to the iOS version too...

    Are either of these things on your roadmap? And if so have you any indication of an ETA?
     
  36. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    The other problem I have (since I'd like to implement the Face API myself if I can) is that literally nothing in your documentation bears any resemblance whatsoever to what I see in Android Studio on PC- maybe its accurate for Mac only?
     
  37. 0xsven

    0xsven

    Joined:
    Mar 5, 2015
    Posts:
    18
    Hey Alex.
    Thank's for that update! This is exactly what I needed.

    There is only one thing that I can't figure out: Why is my 'Large Icon' so large on Android 4.x (see here: https://www.evernote.com/l/ACUmY0rZzptH9aM8-BZpQTFzQBxfOhDv8GkB/image.jpg) Android 5.x is working perfectly!
     
  38. Unititi

    Unititi

    Joined:
    Mar 6, 2013
    Posts:
    20
    can I upload screenshot to instagram with 'hashtag'??
    How can I do this. plz help!
     
  39. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    You have already get the answer in a separate thread here.

    Cheers!
     
  40. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    There is no bug in SA_Singletone code.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public abstract class SA_Singleton<T> : MonoBehaviour where T : MonoBehaviour {
    5.  
    6.     private static T _instance = null;
    7.     private static bool applicationIsQuitting = false;
    8.  
    9.  
    10.     [System.Obsolete("instance is deprectaed, plase use Instance instaed")]
    11.     public static T instance {
    12.         get {
    13.             return Instance;
    14.         }
    15.     }
    16.  
    17.  
    18.     public static T Instance {
    19.         get {
    20.             if(applicationIsQuitting) {
    21.                 return null;
    22.             }
    23.             if (_instance == null) {
    24.                 _instance = GameObject.FindObjectOfType(typeof(T)) as T;
    25.                 if (_instance == null) {
    26.                     _instance = new GameObject ().AddComponent<T> ();
    27.                     _instance.gameObject.name = _instance.GetType ().Name;
    28.                 }
    29.             }
    30.             return _instance;
    31.         }
    32.     }
    33.  
    34.     public static bool HasInstance {
    35.         get {
    36.             return !IsDestroyed;
    37.         }
    38.     }
    39.  
    40.     public static bool IsDestroyed {
    41.         get {
    42.             if(_instance == null) {
    43.                 return true;
    44.             } else {
    45.                 return false;
    46.             }
    47.         }
    48.     }
    49.  
    50.     /// <summary>
    51.     /// When Unity quits, it destroys objects in a random order.
    52.     /// In principle, a Singleton is only destroyed when application quits.
    53.     /// If any script calls Instance after it have been destroyed,
    54.     ///   it will create a buggy ghost object that will stay on the Editor scene
    55.     ///   even after stopping playing the Application. Really bad!
    56.     /// So, this was made to be sure we're not creating that buggy ghost object.
    57.     /// </summary>
    58.     protected virtual void OnDestroy () {
    59.         _instance = null;
    60.         applicationIsQuitting = true;
    61.     }
    62.  
    63.     protected virtual void OnApplicationQuit () {
    64.         _instance = null;
    65.         applicationIsQuitting = true;
    66.     }
    67.  
    68. }
    69.  
    There is one requirements for all the classes inherited from SA_Singletone class.
    All of them should contain DontDestroyOnLoad(gameObject) function call in Awake method.
    E.g. GooglePlayManager class of Android Native plugin definition:

    Code (CSharp):
    1. public class GooglePlayManager : SA_Singleton<GooglePlayManager> {
    2.  
    3. void Awake() {
    4.         DontDestroyOnLoad(gameObject);
    5.     }
    6. }
    So, as you can see there is no reason to worry about.

    Best regards,
    Alex
     
  41. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I think the reason of such behavior is that Android 5 scale the icon to appropriate layout size, instead of Android 4 just align icon in a center without scaling.
    You should select such icon resolution to be sure it displaying correctly on Android 5 and Android 4 versions.
    Just adjust icon size and check it on your Android device.

    Cheers!
     
  42. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Yes, work for sure!
     
  43. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Please, could you provide me full error's stack trace?
    I'll be able to help you with Android Manifests merging.
    Anyway, you may contact The Stan's Assets Support Team to get quick assistance for your case.

    Cheers!
     
  44. AlexRay

    AlexRay

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

    In Turn-Based Multiplayer match, every player should call FinishMatch on its own.
    E.g. there is Turn-Based match with only two players - both of them should call FinishMatch.
    After that match status will be finished for all the players.

    Best regards,
    Alex
     
  45. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    OneSignal SDK is not detected in your project because with the latest update import location has been changed.
    This issue will be fixed with the following plugin update.

    Cheers!
     
  46. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    Please, could you provide your code with the logic you mentioned?
    I'll be able to check it and perform additional tests on my side.

    Best regards,
    Alex
     
  47. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    To get the logic you described you have to implement following

    Code (CSharp):
    1. GooglePlayManager.ActionAchievementsLoaded += OnAchievementsLoaded;
    2. GooglePlayManager.Instance.LoadAchievements ();
    3.  
    4. private void OnAchievementsLoaded(GooglePlayResult result) {
    5.         GooglePlayManager.ActionAchievementsLoaded -= OnAchievementsLoaded;
    6.         if(result.IsSucceeded) {
    7.  
    8.             foreach (GPAchievement achievement in GooglePlayManager.Instance.Achievements) {
    9.                 Debug.Log(achievement.Id);
    10.                 Debug.Log(achievement.Name);
    11.                 Debug.Log(achievement.Description);
    12.                 Debug.Log(achievement.Type);
    13.                 Debug.Log(achievement.State);
    14.                 Debug.Log(achievement.CurrentSteps); //Here you can get current achievement's steps
    15.                 Debug.Log(achievement.TotalSteps); //Here you can get total steps amount
    16.             }
    17.         } else {
    18.             // Load achievements fail
    19.         }
    20.     }
    Please, taka a look at this code sample.
    It contains exactly the logic you need.

    Best regards,
    Alex
     
  48. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    For now there is no such a feature in our tasks tracker.
    Probably we will add this functionality in future, but I can not say exactly how much time it will take.
    Additional information will be announced.
    Keep looking forward for future updates.

    Have a nice day!
     
  49. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Alex,

    Thanks, I will try to implement like in sample you provided.

    Another question, why I don't get the Google Play Welcome back message in my game if I'm connected tot Google Play Services ?

    *This kind of message:
    Welcome.jpg
     
  50. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Display Welcome PopUp is related to Google Play Services itself.
    There are no APIs to setup appearance of this Popup manually.
    I think you got Welcome PopUp while first connection.
    Following times, it didn't display anymore.
    You will get this PopUp again after Google Play Service refresh local cache.

    If you have other information - please, feel free to share with me.

    Cheers!