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. turnipinrut

    turnipinrut

    Joined:
    Oct 27, 2014
    Posts:
    13
    After installing the plugin, my android app no longer collect the new "google ID for advertising" for the AD networks i use.

    Both the Chartboost and Adjust IO SDK were working well before, now the do not seem to utilise GooglePlayServices properly.

    Is this a known bug?


    Thanks
     
  2. JLITTLEOFFICIAL

    JLITTLEOFFICIAL

    Joined:
    Oct 13, 2012
    Posts:
    8
    Hey, I got my billing issue to work out well, so thanks.

    Now, I got another issue. I'm working on displaying google+ icon within my own code, but I was looking through the code that you had, ie GooglePlayManager has a function called OnPlayerDataLoaded which passes the player string data that coordinates the url to be used for the display of the icon itself. The problem is...where and how does the OnPlayerDataLoaded function get called? When looking at the logcat while working on the build, it does get into this function, but how does that data string get created.
     
  3. Newando

    Newando

    Joined:
    Sep 9, 2013
    Posts:
    16
    stanislav-osipov and RoyalCoder like this.
  4. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Well the standard signing is works as it is :) However you can implement your own sight in UI and handle everything by yourself.
    Please have a look:
    https://unionassets.com/android-native-plugin/sign-in-132#advanced-sign-in


    You need to specify your Consumer key and secret, read more here:
    https://unionassets.com/android-native-plugin/twitter-167

    If you will steel not able to get it work, please send your device log to the support team.


    Looks like something serious. I will PM you my personal contact, so let's solve it.
    And guys if you have urgent issue, forum is not the best place to get answer quickly, I am checking it with 1-2 days interval.

    You can alwasy use stans.assets@gmail.com to get answers as fast as possible.
     
  5. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Please send you're device log with issue description, to stans.assets@gmail.com. Something is going wrong obviously.
    But we need more info to find out what is missing.



    created.

    Not sure what the question is. OnPlayerDataLoaded accepts player data as string and creates GooglePlayerTemplate object from received data. This function get called as soon as player info available.

    For example if user logged in, plugin will send Player data request to google. After login is succsesful you can get player data as desribed here:
    https://unionassets.com/android-native-plugin/sign-in-132#current-player-info

    If we talking about friends data, It can be loaded upon request. or When you got player id from the leaderboard for example, the plugin will automatically create data request for this player, which mean it will be available in few seconds. You can read more here:
    https://unionassets.com/android-native-plugin/friends-141



    Happy to hear that congratulations with your game!
     
  6. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    hi i am unable to test your demo on my device first time it does not show ads i try to update sdk then i cannot build the apk.

    can you pls tell me how to download the suitable sdk for this to run
     
  7. sull13

    sull13

    Joined:
    Feb 20, 2013
    Posts:
    1
    I just want to elaborate on JLittle's question. Basically we have used your plugin in the past and it has worked out great for us. Now we created a turn based game, and your plugin at least at the time did not have turn based support. In that case we had to use another plugin to create the game. We would like to have the google+ icon being displayed but the plugin we used with turn based multiplayer support does not have the functionality for loading an icon. We essentially needed advice as to how to get that "icon url" through google. So that's why that OnPlayerDataLoaded function was brought up, part of that parameter string, "data", has the image icon url as well as the player ID among other things. So if you could give us some advice as far as how loading an icon happens, or actually getting that image url through google that would be great.
     
  8. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    67
    Hi @lacost ,
    Over the past 1week, I've been facing trouble to get the FB intergration to work properly.
    In my FB App Dashboard, it shows that AppEvent was not being sent/call .

    In my Facebook App Dashboard, it shows :-
    We noticed you aren't using App Events ...etc

    I've read and follow thru your guide at :-
    https://unionassets.com/mobile-social-plugin/analytics-138
    which says :-
    Implementation
    You can easily insert these events into your apps by using the following code.
    Send an install message to Facebook. Does nothing on desktop apps at this time.
    SPFacebookAnalytics.ActivateApp ();

    I've also made follow thru :-
    https://unionassets.com/mobile-social-plugin/setup-133
    & my key hashes are correctly done. My FB Apps Dashboard shows no error.

    I've sent over the device logcat, androidmanifest, & my script for fb function to call the
    SPFacebookAnalytics.ActivateApp (); , my FB Apps dashboard report screenshot .

    Almost 2days since sent over...probably gone into your junk folder ?

    Thanks
     
  9. Tonmy_

    Tonmy_

    Joined:
    Jan 20, 2014
    Posts:
    5
    Hi there,

    I bought the Ultimate Mobile which comes with the Android Native, and I'm having a problem.

    I use GameAnalytics sdk (www.gameanalytics.com), and it uses the Advertising ID to identify the user. The problem is, after installing Ultimate Mobile, gameanalytics cannot receive the advertising ID anymore. I've been testing and if com.unity3d.player.UnityPlayerNativeActivity has the android.intent.action.MAIN, it works fine and Android Native doesn't. If Android Native has android.intent.action.MAIN, Android Native works fine, but game analytics doesn't.

    I can solve this problem if I could get the Android Advertising ID from Android Native, but I've went through the source code and documentation and the best I've found is the function "EnableAdvertisingIdCollection", but no function to retrieve
    the ID. GameAnalytics API lets me set my own ID, and I would like to keep using the Advertising ID.

    Any hints on how to solve this?

    Thanks
     
  10. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello,

    I assume you are talking about Admob example scene. If you not seeing the ad problem can be in the settings, since you need to provide valid ad unit ids, or enable test mode.
    To find out what exact issue you have I need to see your device log or editor log if you have compilation issues.


    Hmmm point is, that plugin is automatically load players info (with icon and other) of player which id's was sanded by the plugin to you. For example if some player connected to the Real-time match and plugin has reported his id to you, plugin will automatically start info retrieval for this player, which mean his info will be available shortly. I wasn't thinking that you will able to get player info in some other way...
    I will add this to the feature request, but with low priority.
    By the turn based support will be added in version 5.3


    Sorry, we are trying to answer questions ASAP, but sometimes it can take up to 3 days, since we have lot's of support request every day.

    I am not sure if I found your case, in the support mail, but if your name James L, then skype request is already sended to you. If no please contact me via PM in order to investigate your issue more deeply.

    We are accepting this feature request and it will be implemented with the next [lugin version, which will be out this weekend.

    Cheers!
     
  11. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Stan, today suddenly I get this error:

    I tried all threads, google it a lot no fixing, can you help me with this issue please ! :(
     
  12. MrTiger

    MrTiger

    Joined:
    Jan 9, 2014
    Posts:
    29
    for the android debug keystore file missing problem .. try this ..create a empty unity project and built a APK it should create a debug keystore
     
    RoyalCoder likes this.
  13. folta20

    folta20

    Joined:
    Nov 4, 2014
    Posts:
    3
    hi stan..
    i have some problem in my game,
    i try to use in app purchased function,,

    I follow the example on video about billing in app purchases..
    when i run the code The GUI enabled the button, so thats mean the billingmanager is inited, but when i click it nothing happen, i try run it on my android device, and nothing happen too
    I registered my base64key, item name rightly on setting, i registred on google too ,but it still won't work.. can you help me? so this is my code for in app purchasing..

    GameBillingManager.cs
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class GameBillingManager : MonoBehaviour {
    6.     public const int PLAYER_KEY_UNITYPLAYER = 0;
    7.     public const int PLAYER_KEY_IOS = 1;
    8.     public const int PLAYER_KEY_ANDROID = 2;
    9.     static int currentPlayerKey;
    10.  
    11.     private static bool _isInited = false;
    12.  
    13.     public const string ITEM_FLESH_001 = "com.example.flesh.001";
    14.  
    15.     public static void init()
    16.     {
    17.         _isInited = true;
    18.         #if UNITY_EDITOR
    19.         currentPlayerKey = PLAYER_KEY_UNITYPLAYER;
    20.         #elif UNITY_IPHONE
    21.         currentPlayerKey = PLAYER_KEY_IOS;
    22.         #elif UNITY_ANDROID
    23.         currentPlayerKey = PLAYER_KEY_ANDROID;
    24.         #endif
    25.         if(currentPlayerKey == PLAYER_KEY_ANDROID)
    26.         {
    27.  
    28.             AndroidInAppPurchaseManager.instance.addProduct(ITEM_FLESH_001);
    29.  
    30.            
    31.             AndroidInAppPurchaseManager.instance.addEventListener(AndroidInAppPurchaseManager.ON_PRODUCT_PURCHASED, OnProductPurchased);
    32.             AndroidInAppPurchaseManager.instance.addEventListener(AndroidInAppPurchaseManager.ON_PRODUCT_CONSUMED, OnProductConsumed);
    33.  
    34.             AndroidInAppPurchaseManager.instance.addEventListener(AndroidInAppPurchaseManager.ON_BILLING_SETUP_FINISHED, OnBillingConnected);
    35.             AndroidInAppPurchaseManager.instance.loadStore();
    36.         AndroidMessage.Create("12321","1212");
    37.  
    38.         }
    39.  
    40.         else if(currentPlayerKey == PLAYER_KEY_IOS)
    41.         {
    42.             IOSInAppPurchaseManager.instance.addProductId(ITEM_FLESH_001);
    43.            
    44.             IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.PRODUCT_BOUGHT, onProductBought);
    45.             IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.TRANSACTION_FAILED, onTransactionFailed);
    46.             IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.RESTORE_TRANSACTION_FAILED, onRestoreTransactionFailed);
    47.             IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.VERIFICATION_RESPONSE, onVerificationResponce);
    48.             IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.STORE_KIT_INITIALIZED, OnStoreKitInited);
    49.             IOSInAppPurchaseManager.instance.loadStore();  
    50.  
    51.         }
    52.  
    53.     }
    54.  
    55.     //--------------------------------------
    56.     //  PUBLIC METHODS
    57.     //--------------------------------------
    58.    
    59.    
    60.     public static void purchase(string SKU) {
    61.         if(currentPlayerKey == PLAYER_KEY_ANDROID)
    62.             AndroidInAppPurchaseManager.instance.purchase (SKU);
    63.    
    64.         else if(currentPlayerKey == PLAYER_KEY_IOS)
    65.             IOSInAppPurchaseManager.instance.buyProduct(SKU);
    66.     }
    67.    
    68.     public static void consume(string SKU) {
    69.         AndroidInAppPurchaseManager.instance.consume (SKU);
    70.     }
    71.  
    72.     //--------------------------------------
    73.     //  GET / SET
    74.     //--------------------------------------
    75.    
    76.     public static bool isInited {
    77.         get {
    78.             return _isInited;
    79.         }
    80.     }
    81.  
    82.     //--------------------------------------
    83.     //  EVENTS
    84.     //--------------------------------------
    85.    
    86.     private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase) {
    87.         AndroidMessage.Create("432","234");
    88.         switch(purchase.SKU) {
    89.         case ITEM_FLESH_001:
    90.             consume(ITEM_FLESH_001);
    91.             break;
    92.         }
    93.     }
    94.  
    95.     private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase) {
    96.         AndroidMessage.Create("432","234");
    97.         switch(purchase.SKU) {
    98.         case ITEM_FLESH_001:
    99.             GameData.AddFlesh(20);
    100.             break;
    101.         }
    102.     }
    103.  
    104.     private static void OnProductPurchased(CEvent e) {
    105.         AndroidMessage.Create("432","234");
    106.         BillingResult result = e.data as BillingResult;
    107.        
    108.         //this flag will tell you if purchase is avaliable
    109.         //result.isSuccess
    110.        
    111.        
    112.         //infomation about purchase stored here
    113.         //result.purchase
    114.        
    115.         //here is how for example you can get product SKU
    116.         //result.purchase.SKU
    117.        
    118.        
    119.         if(result.isSuccess) {
    120.             OnProcessingPurchasedProduct (result.purchase);
    121.         } else {
    122.             AndroidMessage.Create("Product Purchase Failed", result.response.ToString() + " " + result.message);
    123.         }
    124.        
    125.         Debug.Log ("Purchased Responce: " + result.response.ToString() + " " + result.message);
    126.     }
    127.  
    128.     private static void OnProductConsumed(CEvent e) {
    129.         AndroidMessage.Create("432","234");
    130.         BillingResult result = e.data as BillingResult;
    131.        
    132.         if(result.isSuccess) {
    133.             OnProcessingConsumeProduct (result.purchase);
    134.         } else {
    135.             AndroidMessage.Create("Product Cousume Failed", result.response.ToString() + " " + result.message);
    136.         }
    137.        
    138.         Debug.Log ("Cousume Responce: " + result.response.ToString() + " " + result.message);
    139.     }
    140.  
    141.  
    142.     private static void OnBillingConnected(CEvent e) {
    143.         AndroidMessage.Create("432","234");
    144.         BillingResult result = e.data as BillingResult;
    145.         AndroidInAppPurchaseManager.instance.removeEventListener (AndroidInAppPurchaseManager.ON_BILLING_SETUP_FINISHED, OnBillingConnected);
    146.        
    147.        
    148.         if(result.isSuccess) {
    149.             //Store connection is Successful. Next we loading product and customer purchasing details
    150.             AndroidInAppPurchaseManager.instance.retrieveProducDetails();
    151.             AndroidInAppPurchaseManager.instance.addEventListener (AndroidInAppPurchaseManager.ON_RETRIEVE_PRODUC_FINISHED, OnRetriveProductsFinised);
    152.         }
    153.        
    154.         AndroidMessage.Create("Connection Responce", result.response.ToString() + " " + result.message);
    155.         Debug.Log ("Connection Responce: " + result.response.ToString() + " " + result.message);
    156.     }
    157.  
    158.     private static void OnRetriveProductsFinised(CEvent e) {
    159.         AndroidMessage.Create("432","234");
    160.         BillingResult result = e.data as BillingResult;
    161.         AndroidInAppPurchaseManager.instance.removeEventListener (AndroidInAppPurchaseManager.ON_RETRIEVE_PRODUC_FINISHED, OnRetriveProductsFinised);
    162.        
    163.         if(result.isSuccess) {
    164.            
    165.             UpdateStoreData();
    166.             _isInited = true;
    167.            
    168.            
    169.         } else {
    170.             AndroidMessage.Create("Connection Responce", result.response.ToString() + " " + result.message);
    171.         }
    172.        
    173.     }
    174.  
    175.    
    176.     private static void UpdateStoreData() {
    177.         AndroidMessage.Create("432","234");
    178.         //chisking if we already own some consuamble product but forget to consume those
    179.         if(AndroidInAppPurchaseManager.instance.inventory.IsProductPurchased(ITEM_FLESH_001)) {
    180.             consume(ITEM_FLESH_001);
    181.         }
    182.     }
    183.  
    184.     private static void onProductBought(CEvent e) {
    185.        
    186.         IOSStoreKitResponse responce =  e.data as IOSStoreKitResponse;
    187.         Debug.Log("STORE KIT GOT BUY: " + responce.productIdentifier);
    188.         Debug.Log("RECIPT: " + responce.receipt);
    189.        
    190.         switch(responce.productIdentifier) {
    191.         case ITEM_FLESH_001:
    192.             GameData.AddFlesh(20);
    193.             break;
    194.            
    195.         }
    196.         IOSNativePopUpManager.showMessage("Success", "product " + responce.productIdentifier + " is purchased");
    197.     }
    198.  
    199.     private static void onRestoreTransactionFailed() {
    200.         IOSNativePopUpManager.showMessage("Fail", "Restore Failed");
    201.     }
    202.    
    203.     private static void onTransactionFailed(CEvent e) {
    204.         IOSStoreKitResponse responce =  e.data as IOSStoreKitResponse;
    205.         IOSNativePopUpManager.showMessage("Fail", responce.error);
    206.     }
    207.    
    208.     private static void onVerificationResponce(CEvent e) {
    209.         IOSStoreKitVerificationResponse responce =  e.data as IOSStoreKitVerificationResponse;
    210.        
    211.         IOSNativePopUpManager.showMessage("Verification", "Transaction verification status: " + responce.status.ToString());
    212.        
    213.         Debug.Log("ORIGINAL JSON ON: " + responce.originalJSON);
    214.     }
    215.    
    216.     private static void OnStoreKitInited() {
    217.         IOSInAppPurchaseManager.instance.removeEventListener(IOSInAppPurchaseManager.STORE_KIT_INITIALIZED, OnStoreKitInited);
    218.         IOSNativePopUpManager.showMessage("StoreKit Inited", "Avaliable products cound: " + IOSInAppPurchaseManager.instance.products.Count.ToString());
    219.     }
    220.  
    221.  
    222. }
    223.  

    GameData.cs :
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GameData : MonoBehaviour {
    5.  
    6.     public static int flesh {
    7.         get {
    8.             if(PlayerPrefs.HasKey("flesh")) {
    9.                 return PlayerPrefs.GetInt("flesh");
    10.             } else {
    11.                 return 0;
    12.             }
    13.            
    14.         }
    15.     }
    16.    
    17.     public static void AddFlesh(int amount) {
    18.         PlayerPrefs.SetInt("flesh", flesh + amount);
    19.     }
    20. }
    21.  

    GamePlay.cs
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GamePlay : MonoBehaviour {
    5.        
    6.     public GUIStyle style;
    7.  
    8.     void Awake(){
    9.         GameBillingManager.init();
    10.     }
    11.  
    12.     void OnGUI(){
    13.         GUI.Label(new Rect(10, 70, 150, 50), "Flesh: " + GameData.flesh.ToString(), style);
    14.  
    15.         GUI.enabled = GameBillingManager.isInited;
    16.         if(GUI.Button(new Rect(10, 130, 150,50), "Add Flesh")){
    17.             GameBillingManager.purchase(GameBillingManager.ITEM_FLESH_001);
    18.         }
    19.     }
    20. }
    21.  
     
  14. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Your android debug keystore file is missing
    Thanks a lot MrTiger you save the day...works fine now !

    P.S: Now I'm getting:

    I pasted the debug hash key to facebook app settings...still getting this error when I'm trying t log in from my phone :( any suggestions to fix this ?
     
    Last edited: Dec 24, 2014
  15. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    i dont see test mode where is test mode
     
  16. djoshi

    djoshi

    Joined:
    Mar 28, 2014
    Posts:
    182
    I have updated to latest version 5.1.1 & I found that Native Share doesn't seems to be working. Anyone else found this? If its a version bug please fix it soon.
     
  17. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello.

    Test mode for what feature?


    works just fine for me. Can you please share your device log with me?

    @D0R1N I just create the new guide, where I trying to give explanation about FB and Keystore. I hope It will answer all your questions.
    https://unionassets.com/android-native-plugin/facebook-sdk-and-keyhash-275


    Cheers!
     
    LoDx and RoyalCoder like this.
  18. djoshi

    djoshi

    Joined:
    Mar 28, 2014
    Posts:
    182
    Mailed you please check. Just to add that I have used AN_Share playmaker action.
     
  19. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I guess support team is already provided you with the answer, but if your problem is not solved yet, or you want me to take a look on it personally, please send me PM with your e-mail address so I cloud find your request at the support e-mail.

    Cheers!
     
  20. folta20

    folta20

    Joined:
    Nov 4, 2014
    Posts:
    3
    hello , wanna ask something,,
    i use your google play services api..
    i follow the instruction, tutorial, and i use ur example.

    but somehow i'm still can't sign in, when i try to call
    Code (CSharp):
    1. GooglePlayConnection.instance.connect ();
    the UI for sign up for google play service is show up, but when i choosing the account, it not connected, the callback is "Connection Result: Canceled", "Player Disconnected".

    So every time i try to sign in it got automaticly canceled and disconected, Thats what happen when i try to sign in.. Can you help me to solve the problem?
     
  21. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    It mean you have issue with app or google play console setup. Please send your device log to the support team.
     
  22. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    138
    Hi Lacost ,
    I have an issue that is i want to check list of apps that are installed on device, i have a list which consists of all app names(Package Names).when i try checking it with a for loop i could see only one notification displayed i.e.,"First app Not installed ",but check for the rest of the apps has not perfomed.can you please point me in right direction.
    Code (CSharp):
    1. public void CheckAppInstalation() {
    2.         //AndroidNativeUtility.instance.OnPackageCheckResult += OnPackageCheckResult;
    3.         //        AndroidNativeUtility.instance.CheckIsPackageInstalled("com.google.android.youtube");
    4.         for (int i = 0; i < AppNames.Count; i++) {//AppNames consists of all my app names for which a install check has to performed
    5.             AndroidNativeUtility.instance.OnPackageCheckResult += OnPackageCheckResult;
    6.             AndroidNativeUtility.instance.CheckIsPackageInstalled(AppNames[i]);
    7.            
    8.         }
    9.     }
     
  23. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Stan,

    Have there been recent changes to the AndoidAdMobController? I use your Android plugin in 4 apps, and was porting a 5th from iOS. No matter what I do, Ads will not show in this new app, on any of my android devices (Droid, Note 4, and Amazon Fire tablet). It's only 3 lines of code, and I've checked it against 2 other apps that are working. The ONLY thing I can see that is different is the version number of your API - v4.9 vs v5.1.

    Notes:
    • v4.9 vs v5.1
    • Copied android manifest exactly (except, of course, the app id)!!!
    • The new port is here (not working).
    • App that are working are here, here, and here.
    Code snippets :
    Code (CSharp):
    1.  
    2.            // In startup
    3.            AndroidAdMobController.instance.Init ("ca-app-pub-#/#");
    4.            AndroidAdMobController.instance.SetInterstisialsUnitID("ca-app-pub-#/#");
    5.  
    6.            // ... LATER, WHEN ITS APPROPRIATE ...
    7.           AndroidAdMobController.instance.StartInterstitialAd();
    8.  
    I'm out of ideas.
    Gigi.

    PS - Attached is my AndroidManifest.xml (extension changed to .txt for Unity Forum).
     

    Attached Files:

  24. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Hello, i`m reading your documentation but cant find how to implemente google +1 button.
    What message have to send when i clicked +1? to +1 on google play ? on social +1?
     
  25. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    Any thoughts? Guessing everyone's on holiday.
    Gigi

     
  26. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    can you please show me your OnPackageCheckResult method?

    Sorry, are you trying to find out when user clicks the button, here is teh code sample:
    Code (CSharp):
    1. PlusButton.ButtonClicked += ButtonClicked;
    2.  
    3.  
    4. private void ButtonClicked () {
    5.     AndroidMessage.Create("Click Detected", "Plus Button Click Detected");
    6. }

    Hey @Gigiwoo , I downloaded your app wich have the add issuem and here is whay I found in the app log:

    The Admob API provided by google inside PlayService lib. My plugin always comes with the latest play-service lib. For example current version has play_services_version: 6171000 which is specified in AndroidManifest.

    I gues you have used another plugin which comes with google-play-service.jar lib. And those lib was pretty old, as we see it has 4030500 version code. So, you need to use google-play-service.jar lib which you got with my plugin, or if you need to use old one for some reason you need to set correct version number in the AndroidManifest.

    Cheers!
     
    Gigiwoo likes this.
  27. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    Anyone got this error on install?



    This is what I get with the lastest plugin version and latest Unity3d version.
     
    Last edited: Jan 6, 2015
  28. Kastar-Troy

    Kastar-Troy

    Joined:
    Jul 18, 2012
    Posts:
    29
    Hi there, finally getting around to using this add on in my project, and I'm having some problems with getting a token for my web application.

    You've got the overload for LoadToken(string accountName, string scope). Have you tested this to see if it works with something like:

    LoadToken("joe@gmail.com", "audience:server:client_id:XXXXXX.apps.googleusercontent.com");

    This is the way that your meant to link the Android App Client Id to the Web Application Client in the Google Developer setup, so you verify Auth Tokens in a Web Server. Here is an article detailing what I'm talking about if your not sure: http://android-developers.blogspot.co.uk/2013/01/verifying-back-end-calls-from-android.html

    The simple LoadToken() works and I can get a simple Android Client Auth Token.
    Although it returns a blank string when I try and specify scope. Am I doing it right? Do I put the clients email address or my gmail account the OAuth is registered with?

    Edit: Actually neither of these work, is it actually wired up? Seems to just be returning null or something, no errors, no nothing.

    GooglePlayManager.instance.LoadToken(GooglePlayManager.instance.currentAccount,"audience:server:client_id:XXXXXXX.apps.googleusercontent.com");
    GooglePlayManager.instance.LoadToken(GooglePlayManager.instance.currentAccount,"oauth2:https://www.googleapis.com/auth/plus.login");
     
    Last edited: Jan 6, 2015
  29. Kastar-Troy

    Kastar-Troy

    Joined:
    Jul 18, 2012
    Posts:
    29
    Also is there any reason that the Leaderboards use a long for score? Why can't it be a decimal? What about people who track best times? Rounding up/down seconds is not cool and will end up with a bunch of people tied at first. :(
     
  30. di-lshod

    di-lshod

    Joined:
    Jan 15, 2013
    Posts:
    10
    Is it possible not to show local notifications when application is running?
     
  31. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey @hexaust , thanks for the report. I do not have similar reports so far. Can you please send me your project ot project example with the issue?


    Hey @Kastar Troy , sorry, I am not really got what you mean. Are you trying to use AN API in the web player?

    Here is what Google says about score formatting:

    While all scores are submitted to leaderboards and stored internally as long integers, the Game service can present them to the user in a number of different formats:

    • Numeric leaderboards present scores as numbers. These can be displayed as integers or as real numbers with a fixed number of decimal places. You submit the score as integers and the decimal point is inserted in the specified location. A score of 314159, for example, would be displayed as 3.14159, 3141.59, or 314159, depending on the decimal place you specified.
    • Time leaderboards present scores in hours / minutes / seconds / hundredths of a second format. You must submit scores as milliseconds, so 66032 would be interpreted as 1:06.03.
    • Currency leaderboards present scores in a currency format. You submit scores as 1/1,000,000th of the main currency unit. For example, a score of 19,950,000 would be interpreted as $19.95, assuming you specified your currency as USD.

    Will treat it as feature request. Added to the plugin Todo list.

    Cheers!
     
  32. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Hey lacost i have sent an email to stans.assets@gmail.com 2 days ago but i havent received an answer yet.

     
  33. di-lshod

    di-lshod

    Joined:
    Jan 15, 2013
    Posts:
    10
    Awesome, will wait.
     
  34. Mortalbombat

    Mortalbombat

    Joined:
    Aug 5, 2014
    Posts:
    10
    Hello
    I have a question about multiplayer and the whole concept about it. I have read these articles.
    https://developers.google.com/games/services/common/concepts/realtimeMultiplayer#messaging
    https://unionassets.com/android-native-plugin/real-time-multiplayer-145

    I understand that I can connect myself with anyone in a room and send him message. All I read is about one room with players connected together. I assume that the room scene exists on each player seperatly and they send a messages that appear on each player.
    But how do I actualy make a game with it. Lets say I have racing game with 2 player and AI racers.
    1)How do I put those 2 players in a game with a racing track instead of simple room. Should I let one player open the scene and send message to other player to force his game to open the same racing scene? Or is this handled by the service somehow?
    2) If I successfuly connect those playes in game. How to I send all the things between them. I mean I have to send all the time position of car, animations of other racing cars including second player car. If there was a shooting in the game, do I must send some information that one player instantiated an object. If the object is also moving, I also must send position of the new instantiated object to the other player.

    GooglePlayRTM.instance.SendDataToAll(data, GP_RTM_PackageType.RELIABLE);

    Is this the only way how to send all transform, animation, object creation data to other players?
    Please give me some explenation how to handle all of this by code. I tried default unity multiplayer and their concept of it is much clearer.
     
    Last edited: Jan 7, 2015
  35. Kastar-Troy

    Kastar-Troy

    Joined:
    Jul 18, 2012
    Posts:
    29
    I just got the decimal points working on the leaderboard, so thanks for that, I can see how it works now.

    As for AN, no I'm using it in Android, would never work in a web player. My Android game uses your login flow to authorize my Android App, from there I wish to get an Authorization token which I can send to a .NET Web Service to verify server side that the authorization is legit, otherwise server side your blindly trusting whatever is being sent from the device, which is bad and how games get hacked. You need to read the link here to understand what I'm trying to do:
    http://android-developers.blogspot.co.uk/2013/01/verifying-back-end-calls-from-android.html

    Google does not allow you to use an Auth Token created for an Android app, anywhere else except in that app. You need to specify two Clients in the Developer console, one for your Android App, and one for a web source, like a web service or web page. So when I try and send the Android App Auth Code to a web server and verify it through google again using it's the Google web API, Google doesn't recognize my web service as legit source of the Android App Auth Token, and I get an unauthorized response. The way to get an Auth Token from within the Android App which can then be sent across and used via a web service or web page, is to use the getToken overload and specify the source as the Client Id from the Google Developer console, for the purpose of a web app.

    As it stands now, that getToken overload doesn't do anything, returns null strings, nothing in android logs, no value, no exception, it's like it does nothing at all. Can you check that it's been implemented?

    This is literally the last piece of code I have to finish off my game, can you please dedicate some time to this soon? This will hold up my release :(
     
  36. Gigiwoo

    Gigiwoo

    Joined:
    Mar 16, 2011
    Posts:
    2,981
    What else can I check? Yours is the only Android plugin I use, and it's up to date. There is only one "google-play-services.jar" is in my entire Assets folder, and I slicked my Library to be sure. The manifest (attached) specifies "@Integer/google_play_services_version". I double checked everything and redeployed (give Google Play an hour or two), and still no ads.

    Gigi
     

    Attached Files:

  37. njwm

    njwm

    Joined:
    Apr 30, 2013
    Posts:
    26
    Hi lacost,

    I just release my game in which I use your asset. Your asset really helped us, thanks!

    I think I found an important bug using your asset on Lollipop (this is not a problem with android 4.x and earlier). The problem in in the androidmanifest.xml file; specifically this line :

    <permissionandroid:name="com.example.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature"/>.

    The problem is the "com.example", I think this should be replace with my game "Bundle ID". If I don't do that, I can'T install 2 games done with your asset at the same time. This append only on android Lollipop, and the error message is : "INSTALL_FAILED_DUPLICATE_PERMISSION" or error code "-505".

    Thanks!

    Here is my game if someone want to try it (until I do an update, it won't work if you have Lollipop AND another app with the asset)
    https://play.google.com/store/apps/details?id=ca.nsquared.sentinel
     
  38. folta20

    folta20

    Joined:
    Nov 4, 2014
    Posts:
    3
    hey i upgrade from 4.7 to 5.2,,
    but im not getting "the settings window will be opened automatically in the Inspector view. If for some reason it wasn’t opened after you imported the plugin, go to:
    Window → Android Native → Edit Settings





    And just press Update button. If the installation was completed successfully you should see the message as on the picture below.
    "

    theres no update button..
    can u give me solution?
     
  39. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey @moure just found your request, and looks like it's already answered. Sorry for delay for some reasons we have much more support requests after holidays.

    Hey @Mortalbombat plugins is provides almost the same multiplayer approach as offer by Google. I was trying save all Google API flexibility for my customers, but as the reason it can be hard to understand if you only starting your way with multiplayer development. Anyway just PM me your Skype if and we can have a quick chat, I will explain you the basic concepts.


    Hello @Kastar Troy
    here is how native implementation currently look like:
    Code (CSharp):
    1.     public void getToken(String accountName, String scope) {
    2.        
    3.         String tocken = "";
    4.         try {
    5.             tocken =  GoogleAuthUtil.getToken(AnUtility.GetLauncherActivity(), accountName, scope);
    6.         } catch (Exception e) {
    7.              Log.d("AndroidNative", e.getMessage());
    8.         }
    9.        
    10.        
    11.         UnityPlayer.UnitySendMessage(GameClientManager.PlAY_SERVICE_LISTNER_NAME, "OnTockenLoaded", tocken);
    12.     }
    13.    
    14.    
    15.     public void getToken() {
    16.        
    17.         AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
    18.  
    19.             @Override
    20.             protected Void doInBackground(Void... params) {
    21.                 String tocken = "";
    22.                 try {
    23.                     String accountName  = Games.getCurrentAccountName((mHelper.getGoogleApiClient()));
    24.                     tocken =  GoogleAuthUtil.getToken(AnUtility.GetLauncherActivity(), accountName, "oauth2:" + Games.SCOPE_GAMES.gs());
    25.  
    26.                    
    27.                    
    28.                      Log.d("AndroidNative", "tocken: " + tocken);
    29.                 } catch (Exception e) {
    30.                      Log.d("AndroidNative", e.getMessage() + e);
    31.                 }
    32.                
    33.                 UnityPlayer.UnitySendMessage(GameClientManager.PlAY_SERVICE_LISTNER_NAME, "OnTockenLoaded", tocken);
    34.                 return null;
    35.             }
    36.              
    37.         };
    38.        task.execute((Void)null);
    39.     }
    40.    
    41.  
    42.     public void invalidateToken(String token) {
    43.         GoogleAuthUtil.invalidateToken(AnUtility.GetLauncherActivity(), token);
    44.     }
    45.    
    And guys do not forget that you have full source code access after plugin purchase, so you always can add what you need, if plugin missing some important features.
    Please send me you're skype id, I will get in touch with you an we will add functionality you need.



    Probably some asset store update issue, just replace google-play-services.jar with this file:
    https://www.dropbox.com/s/4065t3qkde15jd5/google-play-services.jar?dl=0



    Please remove Plugins/StansAssets/Versions/AN_VersionInfo file. If Plugin setting will not be opened automatically go to: Window → Android Native → Edit Settings
    The install button will appear, so just press it and it will update whole plugin. If you will have any update issue, feel free to contact me directly. Forum is not the best place to get quick help. You can use my personal e-mail if you hav urgent issue.

    Cheers!
     
  40. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    We're using this plugin for the Android native share dialog. We're developing a cross platform application and are using other platform specific plugins for the corresponding features on those platforms.

    One issue that we just ran into with upgrading to 5.2 of this asset, is that it now causes our WP8 builds to fail with the following error:
    Looking at that function, it seemed easy to swap:
    Code (CSharp):
    1. String templateData = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(n) );
    with
    Code (CSharp):
    1. byte[] bytes = System.Convert.FromBase64String(n);
    2. String templateData = System.Text.Encoding.UTF8.GetString (bytes, 0, bytes.Length);
    NOTE: we didn't actually test that, since I wrapped it compiler preprocessors that essentially just revert the code when its actually in use. Though we used that same type of fix for other similar code
    Code (CSharp):
    1. #if UNITY_WP8
    2. byte[] bytes = System.Convert.FromBase64String(n);
    3. String templateData = System.Text.Encoding.UTF8.GetString (bytes, 0, bytes.Length);
    4. #else
    5. String templateData = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String(n) );
    6. #endif
     
  41. CoredumpLab

    CoredumpLab

    Joined:
    Mar 11, 2014
    Posts:
    14
    FYI!
    The update button will not be appears until the error is in your project.
    (That's a possibility also)
     
  42. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks for letting me know @chirhotec in fact I already got similar report few days ago. Totally my bad, it's already fixed. fix will appear in new version.

    Yep, than's true. Editor scripts may not work properly until project has compilation issues.
     
  43. FraMarSaMi

    FraMarSaMi

    Joined:
    May 13, 2014
    Posts:
    86
    Hi ! How can I manage my app when after an inapp billing the user ask me a refund ? my application should remove what has been given with the purchase and give the user the option to buy back the product if it is not consumable product. It's possibile with Android Native ? How can I to do it ?
     
  44. Kastar-Troy

    Kastar-Troy

    Joined:
    Jul 18, 2012
    Posts:
    29
    Edit: Just noticed your error message here: D/AndroidNative(15020): Calling this from your main thread can lead to deadlock
    I believe because the getToken is not called from another thread, the overloaded getToken is giving this error, and the bad error handling just returns a blank string without any exception information.
    Just done some more research and I'm certain of it, exception occurring cause it's not done async:
    http://stackoverflow.com/questions/...-can-lead-to-deadlock-and-or-anrs-while-getti


    The two overloads are written very differently, why is one performed in a different thread?

    Catching an error and just writing to the android log is pretty bad for an API, the exception should be passed back to the caller, we have no way of knowing if an error occurred in our code and how we should respond.

    Have you tested the implementation of this or just wrapped the Google API calls?

    Here are the Android Logs, it doesn't show anything cause a success is not logged by your code, but no exception either, I can't see any error logs from AN. But it looks like what is happening is that an error is occurring there, and your returning the initialized blank string, and for some reason the error is not being logged?

    I/Unity (15020): Current Account:XXXX@gmail.com

    I/Unity (15020):

    I/Unity (15020): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)

    I/Unity (15020):

    I/Unity (15020): AN: Using proxy for class: com.androidnative.gms.core.GameClientBridge method:getToken

    I/Unity (15020):

    I/Unity (15020): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)

    I/Unity (15020):

    D/AndroidNative(15020): Calling this from your main thread can lead to deadlock

    I/Prime31-OAS(15020): request token response code: 200


    I/Prime31-OAS(15020): request token body: oauth_token=l82Ehwk73hOUO3QiY1EB75VLSTEDe02n&oauth_token_secret=K7SkkAj5G2ltDV2FQq9khqFIWNwBK4Vk&oauth_callback_confirmed=true

    I/Prime31 (15020): initialized Twitter service. got requestToken

    D/dalvikvm(15020): GC_CONCURRENT freed 437K, 5% free 9794K/10268K, paused 2ms+6ms, total 37ms
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x008e
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0099
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x00a4
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x00af
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x00c1
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x00d3
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x00fd
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0007
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0018
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x001f
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0026
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x002d
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0034
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x003b
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0042
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0049
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x000f
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0016
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x001d
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0007
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x000e
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0015
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x001c
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0023
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x002a
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0031
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0038
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0011
    D/dalvikvm(15020): VFY: replacing opcode 0x60 at 0x0015
    D/dalvikvm(15020): GC_CONCURRENT freed 276K, 4% free 9931K/10268K, paused 2ms+3ms, total 17ms
    D/dalvikvm(15020): Note: class Lcom/google/android/gms/games/internal/IGamesService$Stub; has 191 unimplemented (abstract) methods
    D/dalvikvm(15020): GC_CONCURRENT freed 434K, 5% free 10013K/10480K, paused 2ms+1ms, total 17ms
    D/dalvikvm(15020): WAIT_FOR_CONCURRENT_GC blocked 5ms
    D/dalvikvm(15020): WAIT_FOR_CONCURRENT_GC blocked 7ms
    D/dalvikvm(15020): WAIT_FOR_CONCURRENT_GC blocked 7ms
    D/dalvikvm(15020): GC_FOR_ALLOC freed 295K, 5% free 9989K/10480K, paused 14ms, total 14ms
    W/Unity (15020): Missing Google Authentication token and player details, loadedAuthToken Auth Token null or empty Player Name:James Gramosli

    W/Unity (15020):

    W/Unity (15020): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)

    W/Unity (15020):

    I/Unity (15020): Authorised Google Token: <--- Returns an empty string here.

    I/Unity (15020):

    I/Unity (15020): (Filename: ./artifacts/AndroidManagedGenerated/UnityEngineDebug.cpp Line: 53)

    I/Unity (15020):
     
    Last edited: Jan 12, 2015
  45. noamgat

    noamgat

    Joined:
    Nov 22, 2009
    Posts:
    125
    Hello,

    I am using AndroidNative through UltimateMobile, and have run into a weird issue.
    I am trying to use push notifications, so I got the project number through the dev console, and built the sample android notification scene (in xExamples).
    In one device (Nexus 5, OS 5.0.1) it works flawlessly.
    In another device (Nexus 5, OS 4.4) it doesn't work at all. The callback isn't called with failure, it just isn't called at all.

    Is there a way to troubleshoot this issue?
     
  46. Mortalbombat

    Mortalbombat

    Joined:
    Aug 5, 2014
    Posts:
    10
    Hi,
    I have managed to make some very easy multiplayer with sending messages. Is it possible to send more complex data like arrays, vector 3 with google rtm? Example shows only strings

    string msg = "hello world";
    System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
    byte[] data = encoding.GetBytes(msg);

    I have one bug to report
    If I come to multiplayer example level and I accept the invitation, everything is ok. If I go to another level and then come back to rtm example level. I get 2 invitations, if other player who already invited me, invite me again. If do this process multiple times. The invitation comes multiple times. And if I accept the invitation more than once. Application crashes.

    Do you have a fast fix for that?
     
  47. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Will treat it as feature request will add into new releases.


    I believe we have Skype conversation abit it and issue is fixed.

    Well, sure but I need alteast to see the device log. You can send it as PM or to the support team at stans.assets@gmail.com


    Well actually as you seen example send byte array, you can send anything via byte arrays. Send multiplayer messages via byte array is the fastest way of sending PTP messages. Or you can use JSON string, it will increate messages size but it easy to read and parse. I am prefer to use own byte protocol since its more secure and message weight is less.



    I will check this, but sounds like the example scene issue, I guess I just forgot to unsubscribe from the event listener. API is fine anyway. But I will double check thanks for the report.
     
  48. Goodev

    Goodev

    Joined:
    Feb 19, 2013
    Posts:
    25
    If I build WindowsPhone8, I get error.

    Error building Player: Exception: Error: method `System.String System.Text.Encoding::GetString(System.Byte[])` doesn't exist in target framework. It is referenced from Assembly-CSharp.dll at System.Collections.Generic.List`1<LocalNotificationTemplate> AndroidNotificationManager::LoadPendingNotifications(System.Boolean).
     
  49. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello, yea this is know issue. And will be fixed in the next update. So far I will send you fixed version of AndroidNotificationManager.cs so you can just replace it in your project
     
  50. Keitaro3660

    Keitaro3660

    Joined:
    May 20, 2014
    Posts:
    86
    hello, i already sent email 2 days ago but no response.

    so i will also ask here

    hello, i just want to try using unityads.
    but is your asset compatible with it?
    i see error when i try to build it now.

    here is the log

    Error building Player: CommandInvokationFailure: Failed to recompile android resource files. See the Console for details.
    C:\Program Files (x86)\Java\jdk1.7.0_09\bin\javac.exe -bootclasspath "Z:/Live Wall Project/ADT NEW/ADT-20130729/sdk/platforms/android-21\android.jar" -d "F:\rai scrolling\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\threesixsixty\ghostring\Manifest.java" "com\threesixsixty\ghostring\R.java" "com\unity3d\ads\android\Manifest.java" "com\unity3d\ads\android\R.java"
    stderr[
    com\threesixsixty\ghostring\R.java:28: error: ';' expected
    public static final int achievement_Newbie Diver=0x7f040003;
    ^
    com\threesixsixty\ghostring\R.java:28: error: <identifier> expected
    public static final int achievement_Newbie Diver=0x7f040003;
    ^
    com\threesixsixty\ghostring\R.java:29: error: ';' expected
    public static final int achievement_Rich Man=0x7f040005;

    etc
    looks like that is the value that i put in your android ids.xml file
    so what should i do now?
    can i use both your asset and unityads?


    please help, i really need to update faster