Search Unity

[Released] Android Native Plugin

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

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hey @Oniony , what unity version are you using?

    Well, this is good feature request I will implement clean function in the nex release. So far I can suggest a workaround. Just store parsed message using PlayerPrefs, and ignore message if it was already passed earlier.


    Good point. I will do that.
     
  2. Abhaya.Agrawal

    Abhaya.Agrawal

    Joined:
    Jun 10, 2013
    Posts:
    1
    @lacost : can i use this plugin for getting geolocation?
     
  3. gmork6

    gmork6

    Joined:
    Aug 15, 2012
    Posts:
    1
    Hello Stan, I am currently learning how to use your asset and I started from CustomLeaderboardUIExample scene that comes with Android Native. I have set up the Play services as I was told to in documentation, enabled required APIs on Google side, introduced valid resource Id's and after a deploy to my mobile and clicking Connect button in the example I get a Google Play connection icon/splash and then this happens (adb log):

    I/Unity (12253): SIGN_IN_REQUIRED
    I/Unity (12253): UnityEngine.Debug:Internal_Log(Int32, String, Object)
    I/Unity (12253): UnityEngine.Debug:Log(Object)
    I/Unity (12253): PlayServiceCustomLBExample:OnConnectionResult(CEvent) (at F:\Unity\GoogleTest\Assets\Extensions\AndroidNative\xExample\Scripts\PlayService\PlayServiceCustomLBExample.cs:359)
    I/Unity (12253): UnionAssets.FLE.EventDispatcher:dispatch(Int32, Object, String) (at F:\Unity\GoogleTest\Assets\Extensions\FlashLikeEvents\Events\Core\Events\EventDispatcher.cs:178)
    I/Unity (12253): UnionAssets.FLE.EventDispatcher:dispatch(String, Object) (at F:\Unity\GoogleTest\Assets\Extensions\FlashLikeEvents\Events\Core\Events\EventDispatcher.cs:152)
    I/Unity (12253): GooglePlayConnection:OnConnectionResult(String) (at F:\Unity\GoogleTest\Assets\Extensions\AndroidNative\PlayService\Manage\GooglePlayConnection.cs:186)
    I/Unity (12253):

    I've been trying to find the answer to that one for some time now, with no success, so I decided to ask at the source :) Thanks in advance!

    Edit: I made sure my keystores/keys are correct in Google Play, I added both debug and custom keys as suggested by https://developers.google.com/games/services/console/enabling
    In the plugin settings I changed only the resources ids, as it's the only thing I need for the example scene. It's connecting, telling me "welcome back myemail@gmail.com" and then SIGN_IN_REQUIRED...
     
    Last edited: Feb 25, 2015
  4. auzden

    auzden

    Joined:
    Nov 15, 2012
    Posts:
    5
    Hi,

    Using Android Native version 6.0.3 in our app and discovered some Log that were attempting to print nullptr in BillingManager.java, possibly others (log attached). Looks like ex.getMessage() can return null; I'm not a Java expert so I don't know how frequent this occurs or under what conditions.

    As a workaround I'm changing:
    Log.d("AndroidNative", ex.getMessage());
    to:
    Log.d("AndroidNative", "" + ex.getMessage());

    --
    Thanks!
     

    Attached Files:

    • log.txt
      File size:
      2.9 KB
      Views:
      1,073
    MrXee likes this.
  5. Nguyen Huy Thach

    Nguyen Huy Thach

    Joined:
    Jan 14, 2013
    Posts:
    26
    Hi lacost,

    Thank for your greate plugin,

    We bought your plugin (Android Native Plugin) in the last week to use in our project to take photo by the native camera and save photo to Photo folder. However, we have some problems: with the same program, but with different devices, we got different results.

    For details,
    1. HTC: HTC J butterfly HTL21:
    We can get photo by the native camera and display it in a Unity Texture. However, if we save the photo and we check in the photo folder of Android, there are two similar photos in the photo folder.

    2. SHARP: AQUOS PHONE Xx mini 303SH
    We can get and display photo in a Unity Texture. However, there is no photo, although it has an icon of the photo. If we touch on the icon, an error dialog is displayed: "Media not found" and we cannot see any photo.

    3. Sony Mobile Xperia AX SO-01E
    We can get and display photo in a Unity Texture and we also can see the photo in the photo folder. However, the texture is rotate -90 degree.

    Some sample code are:
    Code (CSharp):
    1. private void OnClickCamera()
    2.  
    3.    {
    4.  
    5.        AndroidCamera.instance.OnImagePicked += OnImagePickedAndroid;
    6.  
    7.        AndroidCamera.instance.GetImageFromCamera();
    8.  
    9.    }
    10.  
    11.    // Callback (Android).
    12.    private void OnImagePickedAndroid(AndroidImagePickResult result)
    13.  
    14.    {
    15.  
    16.        Debug.Log("-----------------------------OnImagePicked Android");
    17.  
    18.        if (result.IsSucceeded) {
    19.  
    20.            image.renderer.material.mainTexture = result.image;
    21.  
    22.        }
    23.  
    24.        AndroidCamera.instance.OnImagePicked -= OnImagePickedAndroid;
    25.  
    26.    }
    ----------------------------------------------------

    Other Settings

    -----------------------------------------------------

    AndroidNativeSettings

    Camera Capture Mode = Full Size Photo

    Max Loaded Image Size = 512

    Using Prodiuct Name as Folder Name = true;
     
  6. Mr-Blue825

    Mr-Blue825

    Joined:
    Oct 8, 2012
    Posts:
    30
    Hi,

    We checked the Bundle ID and all others settings but even if everything seems to be ok, it doesn't work.
    We cannot post screenshot on Facebook too, even if the connection works great, and we can post normal message.

    Thanks.
     
  7. di-lshod

    di-lshod

    Joined:
    Jan 15, 2013
    Posts:
    10
    Is there any way to get external storage path using this plugin?
     
  8. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Not yet, but I will add this to the feature request list.

    Hey @gmork6 looks like set up issue, can you please send me the device log? It will contain more information, why the connection is failed.


    Thanks a lot for the feedback. I will fix it!

    Hey @Nguyen Huy Thach pretty interesting report. can you please send me the logs from those devices.

    Since google is returning developer error this is definitely set up issue, you can request help from my support team at stans.assets@gmail.com please provide them device log and developer access to your google console.


    Well, I need to see the log, before I can tell why it's not working.

    I do not have this feature unfortunately.

    Cheers!
     
  9. slimsami

    slimsami

    Joined:
    Jul 29, 2014
    Posts:
    3
    Hi ,
    thank you for the asset, it really helps.
    I'm having some issues with the push notificationg ( GCM) , the new notifications overwrite the old ones, so there is only one shown in the notification bar. Is there a way to show multiple notifications or merge them?
    I tried 2 different API keys or change the title, message but it always overwrite the old notification
     
  10. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    I want to track Facebook installs.
    I entered my app ID in the Facebook settings.
    Is that all I have to do to track installs, or is there more stuff to do?
     
  11. Apptention

    Apptention

    Joined:
    Jun 15, 2014
    Posts:
    5
    Hi! This Plug-in has been a great help in my project.
    I have a question.
    Should i destroy banner by "AndroidAdMobController.instance.DestroyBanner(banner.id)" before Application.Quit()?
    Sometimes unity3D with admob cause problem when the application quit or start. <android>
    Without admob , no issue.
    I don't know why...
     
  12. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Hello, it's sounds like a bug and we was able to reproduce it, so you can expect fix in the next release.

    You can use FB analytics. have a look:
    https://unionassets.com/mobile-social-plugin/analytics-138

    Cheers!
     
  13. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Point is that you do not have to use Application.Quit() at all. here is the reason why.
    1) Due to Android and IOS policy, the system should decide by itself when to stop the application. That't why you do not have to do Quit button in your mobile app. If user wants to quit he will just press the "Home" button.

    2) Admob is official Google API, and it does not expect that you will should down the app via Application.Quit(). as result you will have crashes.
     
  14. Apptention

    Apptention

    Joined:
    Jun 15, 2014
    Posts:
    5
    I have never heard of the policy about quit function on android os.
    Anyway, I'll look for some other way.
    Thanks for your fast answer!
     
  15. Apptention

    Apptention

    Joined:
    Jun 15, 2014
    Posts:
    5
    Exactly same issue here.
    Trying to solve the problem until now.
    ----------------------------------------------------------------------------
    After downgrade to 5.1 there is no issue.
    ----------------------------------------------------------------------------
    In my guess , there were something problem on my phone or google play
    Today work well.
     
    Last edited: Mar 2, 2015
  16. Nguyen Huy Thach

    Nguyen Huy Thach

    Joined:
    Jan 14, 2013
    Posts:
    26
    @lacost
    Please see the attached files for logs of these 3 devices.

    Thanks,
     

    Attached Files:

    • logs.zip
      File size:
      61.8 KB
      Views:
      500
  17. Phuzz

    Phuzz

    Joined:
    Mar 31, 2014
    Posts:
    48
    Hello,

    I cannot seem to be able to Use Chartboost with your plugin, "Unable to Merge Manifests" , I did remove conflicts based on the Guide on "Union Assets" website but then after it compiles all the playmaker actions seem to be non responsive, no leaderboards or ads from Admob.

    Am I missing anything ?
     
  18. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Stan,
    I'm trying to achieve Push Notifications on Android Devices via Parse , I followed this tutorials
    Push Notifications & Push with Parse ...but doesn't work, I get this error on Parse :

    Any ideas how to make it work ? Thanks
     
  19. ottolb

    ottolb

    Joined:
    Jul 1, 2009
    Posts:
    42
    Hi,
    How can I do that? Tried this, but it's always empty:
    AndroidSocialGate.StartShareIntent(caption, someLink, someImage, "facebook.katana");
     
  20. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    hey everyone, using latest plugin and latest unity, are you guys able to use the .connect() method? it wont connect on my end, no popup window, also i made an empty project just the plugin, and it wouldn't connect also, just stood there saying it could not find method gms etc, on logcat, can anyone help please
     
  21. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Can you please describe what action you trying to use, and provide the device log as well.


    Hello, can you please send this issue to the stans.assets@gmail.com. My developer who working on Push Notification side will get in touch with you.



    You are trying to use Native posting instead OAuth. I sure following guides will make it clear for you.
    https://unionassets.com/mobile-social-plugin/coding-guidelines-134
    https://unionassets.com/mobile-social-plugin/platform-behavior-differences-153
    https://unionassets.com/mobile-social-plugin/general-features-135

    Let me know if you steel need help


    Can you please share with me your log cat? I would like to know what is says excatly.


    Cheers!
     
  22. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    Can you please share with me your log cat? I would like to know what is says excatly.


    Cheers![/QUOTE]
    heres a log from just now
     

    Attached Files:

    • log.txt
      File size:
      39.4 KB
      Views:
      1,019
    Last edited: Mar 4, 2015
  23. Keitaro3660

    Keitaro3660

    Joined:
    May 20, 2014
    Posts:
    86
    hello, haven't you update the release note anymore??
    https://unionassets.com/android-native-plugin/versions
    i really want to see the change/add/etc before updating.

    anyway, how is the unity ads or everyplay integration official support that you mention before??
    any news?
     
  24. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Rushing with Unity 5 fixes. I will do all version notes tomorrow.

    Guess they are very busy, since haven't hear anything from them around a month. But I prettu sure there will be no issues, since android native does not overrides main activity anymore.

    There might be duplicates issues, but it's very easy to remove duplicated jars..
     
    Keitaro3660 likes this.
  25. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I been spending whole day trying to Fix Google Play Services.

    Soon as I try and logic I get Connecting To Google Play:

    Connection Failed
    SIGN_IN_REQUIRED
    Due too: INTERNAL_ERROR

    I have no cancel in the code, no idea what I'm doing wrong, followed all instructions.
    idS setup etc, could it be manifest file.

    Using Unity latest/Latest Package.
     
    Last edited: Mar 5, 2015
  26. redccoma

    redccoma

    Joined:
    Feb 15, 2015
    Posts:
    13
    hello stan!
    I have a little problem.

    Code (CSharp):
    1. GooglePlayManager.instance.SubmitScoreById(LEADERBOARD_ID, score);
    (so SubmitScore Function).
    using this code. Event not response.(OnScoreSubmited event).

    - already fix Assets/Plugins/Android/res/values/ids.xml.
    - already add google developer console data.
    - last console log is AN: Using proxy for class: com.androidnative.gms.core.GameClientBridge method:submitScoreById

    is there something to miss?
     
  27. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    OK I solved this, but dont know what the issue is, it seems I needed to remove some features that are not used within the kit, I only needed google play services. There is some conflict happening, will try and provide more information later. Some kind of new bug I think with the kit
     
  28. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    where u able to use the connect method correctly? ive been trying to get user to sign in but doesnt work, and im using latest plugin also
     
  29. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Yes after almost 1 and half days of trial and error not able to connect, I finally managed it.
    The issue is in the setting menu: Window, Android Native, Settings.
    We disabled all we are not using apart from PlayServices and it started to work, now we need to investigate what check box was causing it to fail with INTERNAL_ERROR.
     
  30. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    would love to know what google play service version you are using, since i just did what u told, and it still wont sign in
     
  31. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Version: 658700
    But you need to build your APK first and write the error you are getting, may not be the same issue as me.
    So it should give you some feedback, if no error then your programming sumfin wrong.
    Again still investigating.
     
  32. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    theres a log a few replies up, which is what it is doing,
    Failed resolving Lcom/androidnative/gms/core/GameClientManager; <<< that for example, im using the sample scenes, my ids are correctly changed, game is published have testing accounts enabled and sha1 thingie is correct, so yep not working forme
     
  33. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    well,,,, ive resolved my issue, when all hope was lost and everything was darker than dark... figured to test on another pc, just transfering everything, and guess what, app has stopped responding, at least i knew something was diferent....in the end it was my pc , that had crapped itself, something becam corrupt , regardless of uninstalling and cleaning, so formatted pc reinstall , and copy pasted my files again, all works ...like a glove ty
     
  34. Dnine

    Dnine

    Joined:
    Oct 10, 2013
    Posts:
    6
    Hi,
    Google game services always stopped and my game crashed after invite friends in realtime multiplayer?
    That problems happen after i update from 6.0.3 to 6.1.1

    Is anything change in that version? thanks.
     
  35. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    hey everyone again, could someone please tell me what does this error means ?

    Caused by: java.lang.IllegalStateException: Must include Drive.SCOPE_APPFOLDER to use snapshots!

    it is caused when loading a saved game, via the Saved Games platform
     
  36. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I would really appreciate if will share with me what you found. Since I am always testing plugin with all feature enable, have no idea what conflict may occur.


    We had some fixes with TMB in v 6.2, please try it out. And in case it will not solve your issues, please send me your device log.


    You missed the setup step, In order to use saved games API, you need to enable Drive API in th plugin settings, please have a look:
    https://unionassets.com/android-native-plugin/saved-games-142#implementation

    Cheers!
     
  37. Phuzz

    Phuzz

    Joined:
    Mar 31, 2014
    Posts:
    48
    For some reason I cannot Download this Asset, I have an Older version, I tried unity 4.2 and Latest Unity 5, its the only Asset that fills the download bar with red and shows "Error", is it from my side or Unity Store?

    I tried deleting it from save location and re-downloading still no luck
     
  38. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    @lacost

    i did enabled drive api in the console, that error is reported when you display the save menu, when u click which state to load, the game crashes and that error pops up in logcat
     
  39. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44

    im afraid my friend sometimes you have to delete your whole temp folder, use ccleaner or something, in my case, i noticed something was strange because the game compiled on another pc fine and when i tried using the plugin it would stop responding, but on my pc, the game would not show any error or anything...so i figured, format my pc and test,,,, well it appears something was broken inside my pc which was making strange errors... i had tried uninstalling unity upgrading downgrading deleting every temp folder , with no luck, reformat did it
     
  40. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    @lacost

    Can you check another thing if I have the native plugin and also android manifest manager plugin, (Unity 4.6.3) and try to build I get some kind of error message displayed with the scripts.
     
  41. Phuzz

    Phuzz

    Joined:
    Mar 31, 2014
    Posts:
    48
    I tried CCleaner no luck, deleted temp, no luck, i don't think formatting is an option right now, im almost sure though it has something to do with a cached file somewhere that needs to be deleted but cannot figure it out.
     
  42. Animals

    Animals

    Joined:
    Mar 7, 2015
    Posts:
    2
    Same problem.
     
  43. Phuzz

    Phuzz

    Joined:
    Mar 31, 2014
    Posts:
    48
    Ok, had a try next day was sure its not going to download, but it did, I think the problem was from the other side and not my PC, Thank you for the great asset. :)
     
  44. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    @lacost
    still getting this error

    Caused by: java.lang.IllegalStateException: Must include Drive.SCOPE_APPFOLDER to use snapshots!

    when i click on a game save, to load it.. drive api is enabled and also on the unity plugin, everything is like in the setup, the game saves states correctly but will not load correctly returns that error then crashes.... is there some other additional steps to manage the loading ?
     
  45. Keitaro3660

    Keitaro3660

    Joined:
    May 20, 2014
    Posts:
    86
    hello, unity ads is working flawlesly now, thanks :D

    but i have been strugling for more than 5 hours now trying to implement gamethrive :(
    why my device is still not registered in gamethrive?

    my script when app start is (please check what i miss? or wha t should i do?)
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class gamethrivecall : MonoBehaviour {
    6.     // Use this for initialization
    7.     void Start () {
    8.         GoogleCloudMessageService.instance.InitGameThriveNotifications ();
    9.         }
    10.  
    11.     public void InitGameThriveNotifications() {
    12.         GameThrive.Init(AndroidNativeSettings.Instance.GameThriveAppID, AndroidNativeSettings.Instance.GCM_SenderId, HandleNotification);
    13.     }
    14.  
    15.     //ActionGameThriveNotificationReceived += HandleNotification;
    16.  
    17.  
    18.     // Gets called when the player opens the notification.
    19.     private void HandleNotification(string message, Dictionary<string, object> additionalData, bool isActive) {
    20.         // Your app logic
    21.     }
    22.  
    23. }
    24.  
    and where should i put this code?
    Code (CSharp):
    1. ActionGameThriveNotificationReceived += HandleNotification;
    example please... because it got error when i uncomment this..
    Unexpected symbol `+=' in class, struct, or interface member declaration

    and for the GCMS sender ID in AN setting, is the ID that have api-project- or just the number?
    ----------------------------------------------------------

    My condition is
    1. My android apps isn't published yet, still test mode with google play service (leaderboard etc) and ofcourse GMS activated. Is "not published" the problem here?
    2. i use Any Ip for google GMS like in gamethrive tutorial here http://documentation.gamethrive.com/v1.0/docs/installing-the-gamethrive-sdk
    3. i also done all tutorial here http://documentation.gamethrive.com/v1.0/docs/installing-the-gamethrive-sdk and https://unionassets.com/android-native-plugin/push-notifications-169 (the difference is, i use EMPTY IP like in the gamethrive tutorial. i already try with 0.0.0.0/0 but my device still not registered


    please help me, what i'm missing?
    really noob at coding here :/
    i just hope there's playmaker action available :/
     
    Last edited: Mar 9, 2015
  46. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    still playing with this, from time to time, today im not sure how to make this work, if im correct in this next code the data is saved to the drive correct?,
    Code (CSharp):
    1. GooglePlaySavedGamesManager.instance.CreateNewSnapshot(currentSaveName, description, Screenshot, "some save data, for example you can use JSON or byte array", TotalPlayedTime);
    in particular, the lines that say "some save data, for example you can use JSON or byte array", lets say i only saved int Score, which contains well, the score.. how or on what part of the code is that handled so that when you load your saved game it changes the values accordingly., this is the part im confused
     
  47. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    anyone please ?
     
  48. redccoma

    redccoma

    Joined:
    Feb 15, 2015
    Posts:
    13

    hello stan!

    i confirmed your thread.
    change AndroidNativePlugins version(6.2).(because i had Relevant GooglePlayService Event function problem.)

    but... i can`t found Android native plugins Setting in inspector.
    One must be initialized and set from?

    qwdqwdqwd.png
     
    Last edited: Mar 10, 2015
  49. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    It looks like the Store issue, But you can always contact the support team and ask them to send latest plugin version for you!



    Well you can do like this:
    Code (CSharp):
    1. GooglePlaySavedGamesManager.instance.CreateNewSnapshot(currentSaveName, description, Screenshot,MyScore.ToString(), TotalPlayedTime);
    and then just parse your score from string when snapshot is downloaded.

    Sorry for slow forum replays. You can get answers much faster if you will use support e-mail. Send e-mail stans.assets@gmail.com. And also remind that you already have the conversation with me on the forum, int this case such ticket will be referred to me directly.
    BY the way are you sire your play service settings is correct? Can you check it once again?
    https://unionassets.com/android-native-plugin/saved-games-142#implementation


    Can you please give me the error log? Thanks!


    You just need to open the plugin settings. Window -> Android Native -> Edit Settings
    The settings resource will be created automatically. If that is not happening, then something is goes wrong, and you should have at least error message in the console window.
     
  50. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    @Keitaro3660
    Solution for your error is following:
    GoogleCloudMessageService.ActionGameThriveNotificationReceived += Your_Method;

    As Your_Method you can add your own method and implement necessary game logic.