Search Unity

[Released] Android Native Plugin

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

  1. CallToAction

    CallToAction

    Joined:
    Feb 10, 2014
    Posts:
    22
    I'm getting the following error from the InappPurchaser
    You are trying to load data from a www stream which had the f
    ollowing error when downloading.
    java.net.MalformedURLException: Protocol not found: null
    (Filename: Line: 253)
    InAppPurchaseManager, no purchases avaiable
    InAppPurchaseManager, no products avaiable

    I've created my products in the developer console, uploaded my beta apk, added my products to the store through the settings windows in unity. Any ideas?
     
  2. wana7262

    wana7262

    Joined:
    Jul 2, 2012
    Posts:
    97
    Cloud Save is very confusing to me...!!! how can i save my game's data to cloud service? all my scores guns unlocked are saved in Playerprefs but how can i submit it to cloud, and restore it... an example will be perfect
     
  3. eskiroy

    eskiroy

    Joined:
    May 9, 2014
    Posts:
    11
    Hi,
    I just bought your plugin and wanted to integrate into my app, but I have also included Vuforia plugin in my project. I'm currently stuck with merging the 2 AndroidManifest together to make everything work. Would you be kind enough to point me to the right direction as to how I can get things working?
    Sorry I'm quite new to programming, please bear with my ignorance. Thanks so much in advance!
     
  4. cuberob

    cuberob

    Joined:
    Apr 6, 2014
    Posts:
    5
    There is an example cloud scene in the extension folder, it shows you how to submit a string to the cloud and load it from the cloud again. What I did is parse everything I want to save to a json string and than submit that to the cloud, when loading it I decode this JSON string and restore all level stats from there.

    The only problem I'm still having is that auto-loading this cloud data when the cloud is empty (or has been reset) still results in a crash, (as described in my post on the bottom of page 7) if someone can help me out with this that would be very very welcome!
     
  5. Spy-Shifty

    Spy-Shifty

    Joined:
    May 5, 2011
    Posts:
    545
    Hi,
    could it be that the GooglePlayRTM.instance.sendDataToPlayers methode doesn't work?
    The player string param is the GP_Partisipant.id id or? Otherwise it makes no sense ^^

    If i send data to all, it works. But if i send the data to a specific player, the player didn't receives the package...

    The GP_Partisipant.id is something like p_ASFGASD and so on


    EDIT:

    I believe I found your bug...

    in line 171 in RealTimeMultiplayerController.class (in your jar file...)

    you do a comparison of:
    if (p.getPlayer().getPlayerId().equals(id)) {

    but you have to compair this one:
    if (p.getParticipantId().equals(id)) {


    I believe...
     
    Last edited: Jul 31, 2014
  6. Pinkrooster

    Pinkrooster

    Joined:
    Jul 30, 2014
    Posts:
    4
    Hi,
    I am currently developing a mobile game that uses your great asset. In your documentation there is a reference to a few functions for the Facebook Scores API (e.g. LoadPlayerScores etc.). But SPFacebook does not have those functions in my version. Can you help me with this? I can of course use the FB.API function, but I rather only use your asset.
     
  7. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    I just purchased your asset, looks rather nice of course, delving into more it seems a bit overwhelming and mostly written in C#. I want to make a remove ads button in my android game, using JavaScript if possible. Do you have any example code for this, something really cut down?

    So code I'd look at using in my game would be something like:

    1. function Awake()
    2. {
    3. SetupAds();
    4. }
    5. function SetupAds()
    6. {
    7. if(PlayerPrefs.HasKey("AdFree"))
    8. return;
    9. // do setup of ads here
    10. }
    11. function RemoveAds()
    12. {
    13. if(PlayerPrefs.HasKey("AdFree"))
    14. Debug.Log("Ads already removed");
    15. else{
    16. PlayerPrefs.SetInt("AdFree",1);
    17. PlayerPrefs.Save();
    18. // disable all advert objects here
    19. }
    20. }
    21. function RestorePurchases()
    22. {
    23. if(IsProductPurchased("ProductId"))
    24. RemoveAds();
    25. }
    Could I ask if there is a simple way of using your asset to use/check the line:
    if(IsProductPurchased("ProductId"))

    maybe:
    public bool IsProductPurchased(string SKU)
    Or do I have to modify the file GameBillingManagerExample to suite my needs?

    Many thanks for any advice or help you could provide.
    Kim
     
  8. Nezard

    Nezard

    Joined:
    Apr 14, 2013
    Posts:
    12
    Hello. I have a question.

    If 'isInited'(in BillingExample.cpp) returned 'false', can I call 'init'(in BillingExample.cpp) again?

    I like to see right information of items in my game when reopening Itemshop page after an internet connecting error occurred.

    if 'calling init again' is not possible, could you give an example which can regain item information when reopening itemshop page?
     
  9. Nezard

    Nezard

    Joined:
    Apr 14, 2013
    Posts:
    12
    Another question..Sorry..
    How can I know whether it is login on google play or not?
     
  10. Dreamonaut

    Dreamonaut

    Joined:
    May 19, 2014
    Posts:
    32
    Hi Nezard, are you talking about google play game service ? If so, i think you need listeners :

    GooglePlayConnection.instance.addEventListener (GooglePlayConnection.PLAYER_CONNECTED, OnPlayerConnected);

    GooglePlayConnection.instance.addEventListener (GooglePlayConnection.PLAYER_DISCONNECTED, OnPlayerDisconnected);

    and in void OnPlayerConnected & void OnPlayerDisconnected you put a boolean which turn true or false, depending what event happen.

    Hope it helps ! !
     
  11. AetA

    AetA

    Joined:
    Feb 28, 2014
    Posts:
    1
    Hi all,
    i have this following error when i want to use the "twitter shared image" button :
    The plugin and the "androidnative.jar" is up to date.
    Someone already have that ?
    Thank you.
     
    Last edited: Aug 4, 2014
  12. Nezard

    Nezard

    Joined:
    Apr 14, 2013
    Posts:
    12
    Hi, Dreamonaut!
    Thank you for your reply!
    I meant google play store but It helps me because I am trying to add a system related google play service on my game now!
     
  13. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Thank you again for this amazing plugin !

    But do you plan to add Amazon Kindle Fire to your plugin ? In USA, they have a big part of the tablet market.

    + playmaker of course ;)


    Thank you !
     
  14. MatthewVale

    MatthewVale

    Joined:
    Aug 5, 2014
    Posts:
    5
    Hey, I've been using the Ads in this plugin for my games with no problem! However I've noticed that Google is updating their AdMob stuff as shown here...
    http://support.google.com/admob/v2/topic/3011419

    How will this effect the plugin? Will you update the plugin to deal with the new AdMob? Any information will be appreciated as I'm slightly concerned

    Thanks
     
  15. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    126
    Hi Lacost,
    I've been waiting for last couple of months for the detailed procedure of implementing Google Cloud Messaging (GCM) and many of the plugin users require this feature very badly.So,can u please make urself free for giving us the procedure of implementing GCM which adds a great benefit for developers..
    Thank you Lacost
     
  16. destapp

    destapp

    Joined:
    Oct 22, 2012
    Posts:
    18
    hi, i've been using SPFacebook.instance.Login("email,publish_actions"); to login but when i tried in my device and touch connect button it doesnt working and only appeared permission popup. any ideas?

    note : i'm using unity 4.5.1 and anp v4.2.0
     

    Attached Files:

    Last edited: Aug 7, 2014
  17. rc183

    rc183

    Joined:
    Sep 6, 2013
    Posts:
    3
    I tried to implement the Google Play Game Services. I just try to sign in a user like this :

    Code (CSharp):
    1. GooglePlayManager.instance.addEventListener(GooglePlayConnection.PLAYER_CONNECTED, OnGooglePlayGameServicesUserLoggedIn);
    2. GooglePlayConnection.instance.connect();
    3.  
    4. private static void OnGooglePlayGameServicesUserLoggedIn(CEvent e)
    5. {
    6.             Debug.Log("CONNECTED TO GOOGLE PLAY SERVICES");
    7. }
    8.  
    But the method "OnGooglePlayGameServicesUserLoggedIn" is never trigerred. It's normal ?

    Thanks
     
  18. RC15

    RC15

    Joined:
    Apr 19, 2013
    Posts:
    38
    I've just updated the plugin to the last version and I got this error on logcat when I call GooglePlayConnection.instance.connect ();

    Code (CSharp):
    1. I/Unity   (28136): AndroidJavaException: java.lang.NullPointerException
    2. I/Unity   (28136):   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0
    3. I/Unity   (28136):   at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
    4. I/Unity   (28136):   at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    5. I/Unity   (28136):   at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    6. I/Unity   (28136):   at AndroidNative+<CallActivityFunction>c__AnonStoreyB8.<>m__0 () [0x00000] in <filename unknown>:0
    7. I/Unity   (28136):   at UnityEngine.AndroidJavaRunnableProxy.run () [0x00000] in <filename unknown>:0
    8. I/Unity   (28136):   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo c
    9. ulture) [0x00000] in <filename unknown>:0
    10. I/Unity   (28136): Rethrow as TargetInvocationException: UnityEngine.AndroidJavaRunnableProxy.run()
    11. I/Unity   (28136):   at U
    Ids.xml is filled with the right information and all jar are in the right place ( as suggested by installation guide)


    Btw it's a good plugin, but updating it has become a nightmare, version after version.
    Everytime you have to deal with some refactoring, class name or properties changed.
    It's praiseworty adding always new features, but it'd be good if the plugin was more modular and stable.
     
  19. adamvisionstudios

    adamvisionstudios

    Joined:
    Apr 24, 2014
    Posts:
    44
    I noticed you have "ART mode support (starting from Unity 4.5) "

    Currently my game is not supporting ART mode and I cannot for the life of me figure out how to fix this. Is there any help you can offer in the way of whether I should buy this plugin for only that use described? Or is there another way to go about allowing ART mode support?

    Thanks for any help.
     
  20. thbach

    thbach

    Joined:
    Feb 14, 2014
    Posts:
    9
    Running Android, Latest ANP, Followed the Chartboost integration and its working fine and showing up.
    Only issue is the Ads not being able to be clicked on or closed (using the X button on the ad)
    The only way I can close the interstitial Ads is to use the back button

    anyone had this issue? and help

    cheers
     
  21. wao

    wao

    Joined:
    Aug 9, 2014
    Posts:
    10
    When i replace Assets\Plugins\Android\androidnative.jar for AndroidNativeEclipce\bin\androidnative.jar in a new unity project i will get Unable to convert classes into dex format error.
    According to documentation "When you will change any script in the project jar file will be recompiled automatically, and you be able to find it under the project bin folder. " How am i suppose to merge plugins when androidnative.jar from bin folder already giving me the error?
     
    Last edited: Aug 9, 2014
  22. Stans-Assets

    Stans-Assets

    Joined:
    Jun 20, 2014
    Posts:
    57
    AndroidNative v 4.2 just released.



    New Features:
    • Twitter Application-only API added
    • Facebook Leaderboards API added
    • Facebook Likes API added
    • AndroidSocialGate SendMail method added
    • AndroidNotificationManager CancelLocalNotification method added
    • Billing Example Scene improved

    Fixes:
    • Twitter Auth Fixed
    • Play Service auth bug fixed when no Play Service available on device
    • Play Service Example scene (Submit Score button) fixed
     
    augasur and ababab5 like this.
  23. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Great !
     
  24. Dreamonaut

    Dreamonaut

    Joined:
    May 19, 2014
    Posts:
    32
    Great ! thanks stan !

    Is the Quest system of google game service works ?

    Thank you in advance.
     
  25. Nezard

    Nezard

    Joined:
    Apr 14, 2013
    Posts:
    12
    Hello.
    My in-game scene has 2 gameobjects named "AndroidAdMobController" and 'AndroidInAppPurchaseManager" though in-game scene doesn't use anything about android ad mob and purchase..
    These are in the scene automatically.
    I guess it is maintained as my lobby scene uses those.
    So, I wonder whether it makes a bad effect on game performance or not.
    And I also wonder whether I can destroy these 2 gameobjects when the scene starts or not.
     
    Last edited: Aug 11, 2014
  26. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    136
    Hello Stan,

    I Updated to 4.2 and I added In Apps in my game.

    But I got this Error on Android device when I retrieve products details.
    AndroidInAppPurchaseManager.instance.retrieveProducDetails ();

    Code (CSharp):
    1. D/dalvikvm(  133): Zygote::ForkAndSpecialize +
    2. D/dalvikvm(  133): Zygote::ForkAndSpecialize : 9028
    3. I/ActivityManager(  509): Start proc com.google.android.gsf.login for service com.google.android.gsf.login/com.google.android.gsf.loginservice.GoogleLoginService: pid=9028 uid=10011 gids={50011, 3003, 1007, 1028, 1015, 1006, 3002, 3001, 2001, 3006}
    4. D/dalvikvm( 9028): Zygote::ForkAndSpecialize : 0
    5. D/dalvikvm( 9028): zygote get new systemTid : 9028
    6. D/dalvikvm( 9028): Elevating priority from 0 to -8
    7. D/dalvikvm( 9028): zygote get thread init done
    8. V/ActivityManager(  509): Binding process pid 9028 to record ProcessRecord{41830580 9028:com.google.android.gsf.login/u0a10011}
    9. V/ActivityManager(  509): New death recipient com.android.server.am.ActivityManagerService$AppDeathRecipient@415d1328 for thread android.os.BinderProxy@416bbdf0
    10. V/ActivityManager(  509): New app record ProcessRecord{41830580 9028:com.google.android.gsf.login/u0a10011} thread=android.os.BinderProxy@416bbdf0 pid=9028
    11. I/Unity   ( 8957): IndexOutOfRangeException: Array index is out of range.
    12. I/Unity   ( 8957):   at GooglePlayManager.OnPlayerDataLoaded (System.String data) [0x00000] in <filename unknown>:0
    EDIT: I got this message on the method OnPlayerLoaded
    OnPlayerDataLoaded data 11341631844505XXXXXX|Name1 Name2|null|null
     
    Last edited: Aug 13, 2014
  27. Zimorgh

    Zimorgh

    Joined:
    Apr 22, 2013
    Posts:
    9
    Hello everyone, I've just upgraded to version 4.2 and when the import was completed, I've got the following error:

    Assets/Extensions/GooglePlayCommon/Social/Twitter/Tasks/TwitterPositngTask.cs(41,37): error CS1061: Type `TwitterManagerInterface' does not contain a definition for `AuthificateUser' and no extension method `AuthificateUser' of type `TwitterManagerInterface' could be found (are you missing a using directive or an assembly reference?)

    I'd like some help on how to solve this, I'm using Unity 4.5.0
    Edit: I'd like to point out that I can't even run my project on the editor until this problem is solved.

    Thanks.
     
  28. Zimorgh

    Zimorgh

    Joined:
    Apr 22, 2013
    Posts:
    9
    I saw the problem, in the TwitterPositngTask.cs
    It should say:
    _controller.AuthenticateUser();

    After that, no errors.
     
  29. Aishiteru

    Aishiteru

    Joined:
    May 3, 2014
    Posts:
    31
    Hi Stan, does this asset require additional assets to work ? example : Mobile Social Plugin.
     
  30. Soleferry

    Soleferry

    Joined:
    Nov 13, 2013
    Posts:
    4
    Hi everyone, it seems that the function GetScoresList doesn't work for me : it only returns a leaderboard with only one score : the current player's score. Does anyone knows how to fix that ?
     
  31. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    This will be implemented in 4.5 version (about week or so)


    My bad, just update to latest version.

    Nope, Android part of Mobile Social Plugin already included.


    Have you tried example scene?

    Cheers!
     
  32. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi Stan,

    It should be great to not pop up at each launch the Google Play Login view if the user click on "cancel".


    And It should be very useful if we can test if an achievement if done or not to offer the possibility to the user to retrieve his progression if he use multiples devices. (the same for iOS).
    (+ playmaker actions ;) )

    Thank you very much sir !!
     
  33. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Yep, and it's already fixed! I will upload update to Asset Store in few days.

    There is such possibility :) You can load achievements info, and then state and progress is available for you.
    And sure, I will make the PlayMaker action for this! :)
     
    ababab5 likes this.
  34. Stans-Assets

    Stans-Assets

    Joined:
    Jun 20, 2014
    Posts:
    57
    AndroidNative v 4.3 just released.



    New Features:
    • Editor settings improved
    • Simple JS use example added. UseAPIFromJSExample scene
    • CustomLeaderborUIExample example scene updated
    • CustomLeaderborUIExample_old example scene removed
    • AndroidSocialGate.SendMail function now can work with multiple recepients

    New Play Maker Actions:
    • AN_GetImageFromCamera
    • AN_GetImageFromGallery
    • AN_SaveImageToGalalry
    • AN_SaveScreenshotToGallery
    • AN_RetriveProductInfo
    • AN_PlayServiceDisconnect
    • AN_PlayServiceInit -> Renamed to AN_PlayServiceConnect

    Refactor:
    • GooglePlayManager: GetAchievementd -> GetAchievement

    Fixes:
    • Fixed exception when loading empty state from google cloud
    • WP8 Build issues caused by RTM_Game_Example fixed
     
    Soleferry likes this.
  35. DeltaGemini

    DeltaGemini

    Joined:
    Dec 20, 2012
    Posts:
    3
    Hi there,

    We're using the Android Native plugin in our Unity game to control Google Play Services. We can log in fine, but we're unable to log out. As soon as we log out from Google's Achievements menu, it signs back in automatically when we get back to the game without us calling it. We've now tried using the sign-out function explicitly, and we're not receiving confirmation back.
     
  36. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    The plugin is works as recommended by google
    https://developer.android.com/google/auth/api-client.html


    So when you back from achievement UI, the onStart -> connect will be called.

    As soon as you will call

    Code (CSharp):
    1. GooglePlayConnection.instance.disconnect ();

    Here is what will happend (C# part from plugin code)

    Code (CSharp):
    1.    
    2. public void disconnect() {
    3.  
    4.         if(_state == GPConnectionState.STATE_DISCONNECTED || _state == GPConnectionState.STATE_CONNECTING) {
    5.             return;
    6.         }
    7.  
    8.         OnStateChange(GPConnectionState.STATE_DISCONNECTED);
    9.         AndroidNative.playServiceDisconnect ();
    10. }
    11.  
    12. private void OnStateChange(GPConnectionStateconnectionState) {
    13.  
    14. _state = connectionState;
    15.    switch(_state) {
    16.     caseGPConnectionState.STATE_CONNECTED:
    17.       dispatch(PLAYER_CONNECTED);
    18.       break;
    19.    caseGPConnectionState.STATE_DISCONNECTED:
    20.      dispatch(PLAYER_DISCONNECTED);
    21.      break;
    22. }
    23.  
    24.   dispatch(CONNECTION_STATE_CHANGED, _state);
    25.  
    26.   Debug.Log("Play Serice Connection State -> " + _state.ToString());
    27. }
    28.  
    29.  
    30.  
    So you will have event dispatch and
    Will be changed also.
    Cheers!
     
  37. cristivp

    cristivp

    Joined:
    Nov 1, 2012
    Posts:
    6
    Hi Lacoste,

    Same problem over here. I just want the user to be able to sign out from the settings in the Achievements UI.

    After I tap the Sign Out button, I get back to the game and I get signed in again. At the same time I receive a SIGN_IN_REQUIRED from the ConnectionResult callback.

    Any ideas as to what this means?

    Any help is greatly appreciated.
     
  38. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    You're the best ;)

    For iOS Plugin too ? :)


    Is there available in this update ?

    Thanks !
     
  39. BitDemon-Games

    BitDemon-Games

    Joined:
    Jan 27, 2013
    Posts:
    9
    For Google Play Services real time multiplayer:
    Is it possible to create a room in one scene then once the room is full transfer the room over to another scene? The first scene effectively acting as a pre-game lobby before starting the game.
     
  40. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    it will be un 4.5 version with us scheduled on next this weekends
     
    ababab5 likes this.
  41. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Sure. All API isn't related to the scenes. That is up to you how to build your game scene flow.

    The Network manager is singleton, so you can access it's data and public function from anywhere you need.
    Cheers!
     
    BitDemon-Games likes this.
  42. BitDemon-Games

    BitDemon-Games

    Joined:
    Jan 27, 2013
    Posts:
    9
    I have it so the players start a new scene when the room is full but when the new scene has loaded the room status starts as "ROOM_STATUS_ACTIVE" then quickly changes to "ROOM_VARIANT_DEFAULT" and the participants quickly changes from 2 to 0, so i'm guessing the room closes on start. How would I fix this?
     
  43. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Please show me how do you referring to room status.

    Looks like you stored it in local variable with was destroyed while your scene switch.
    Cheers!
     
  44. BitDemon-Games

    BitDemon-Games

    Joined:
    Jan 27, 2013
    Posts:
    9
    Im using the same code as the example,
    Code (CSharp):
    1. status.text = GooglePlayRTM.instance.currentRoom.status.ToString();
    Also could it be the listener I'm using to start the new scene? Currently I'm using GooglePlayRTM.ON_ROOM_CONNECTED
     
  45. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Looks weird, The API will work the same, and it not depends of scene change at all. I will send you updated version with logs to find out waht is wrong.

    Cheers!
     
  46. cipu

    cipu

    Joined:
    Mar 27, 2013
    Posts:
    10
    HI lacost i was found this bug.

    When i press button connect facebook without login into app native facebook.
    Will have a popup show on and i can fill info.

    But if i dont do anything and press back button i will return scene. Then I press connect button again and game will be crash.

    im using android native 4.4
     
  47. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    hi, can we use your package for launching another app from inside of unity app?

    The other app can be developed in any other language too. So any suggestion? Should I buy your package for this?
    rahu
     
  48. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Thanks for report, will test it.


    I am nit sure what you mean, Do you want to launch another application on the phone from your app. Like for example luancg youtube app by it's bundle id? Am I correct?
     
  49. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    Yes, exactly that.
    Do you know how to do that?
     
  50. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    That's pretty easy to do.
    I will treat at feature request and will add this to next plugin version (3.5) it will be uploaded tomorrow.
    Cheers!
     
unityunity