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

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Can someone contact Stan as issues pilling up?
     
  2. njwm

    njwm

    Joined:
    Apr 30, 2013
    Posts:
    26
    I upgraded my games to unity 5.0.2 and I use this asset for ads and game services(version 6.5). Since the upgrade, I can't click on ads... someone have the same issue?
     
  3. mechanicalpig

    mechanicalpig

    Joined:
    Feb 15, 2015
    Posts:
    15
    So quick update to my connection problem on the previous page. I updated my Unity version to 5.02 and now the connection is working again.

    I think the new version of the plugin is having problems with older versions of Unity.
     
  4. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I don't get what you mean, can you explain more on delay?

    Any news on official fix for freezing issues and login issues (We need a new build asap)
    Everything is perfect with the asset just these things are causing mass problems.
    Not sure what is wrong and do not wish to spam forum but I keep checking each day for a fix, delaying my game updates.
     
    Last edited: Jun 10, 2015
  5. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    For now we don't consider about Share Line support.

    Anyway, I added your feature request. If there will be more same requests, this feature will be added in future plugin updates.

    Cheers!
     
  6. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    If your first game scene loading is very expensive and you call GooglePlayConnection.instance.connect() in Start() method (it has a lot of resources loading for example), it should cause application freezes.

    That's not an issue related to plugin work. It takes place because of your first game scene's start is overloaded.
    So, call Google Play connect in right place is your responsibility as a developer.

    If you call GooglePlayConnection.instance.connect() with some delay after application start, it's normal solution in this case. As a result, you have Google Play connection after application start with NO freezes.
     
  7. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    This warning indicates, that your Assets/Plugins/Android/res contains some resources, which will be included in your project build. Some Unity versions has warn you with this.

    Let's clarify this case.
    Unity policy for such cases is following - you have to provide all of your resources included into Android Library.
    Let's assume next situation. If every developer will be prompted to include resources in library build, that every time you add new resources into your project you should strictly rebuild all native libraries and replace them in your Unity project.

    That's not the case for Android Native plugin. Such approach may create many additional difficulties for developers.
    Our approach is to add all resources to Assets/Plugins/Android/res folder. Any resource in this folder will be included in APK file by default.

    It's in not an error, that will block your application. So, Unity just inform you, that your have Assets/Plugins/Android/res folder in your project and all of it's resources will be included in your result build.

    That is the reason why you get this warning while build for Android.
     
  8. AlexRay

    AlexRay

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

    For now Android Native plugin does not require application main activity.
    So, Android Native uses native activity for Google Play Service login.

    The answer for your question is following - we have this 1second immersive mode enable because of login activity popup while Google Play Service user login.
    The main advantage of not using main activity is ultimate cross-plugin compatibility.

    Android Native does not use main activity. Our plugin will NOT conflict with other plugins, that use main app activity.
    There is no way to disable 1sec immersive mode with Google Play Service login.

    Do you have any serious difficulties in this situation?
     
  9. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    I can explain you what is going on in this situation with Google Play connection.

    At your application start you call GooglePlayConnection.instance.connect() method.
    After that you get connection canceled message because there is no signed in user for Google Play Service.
    Following message is Sign In Required. That indicates, that user have sign in to his valid Google account.

    You mentioned that you have "Connection Failed" popup.
    But I think, there are no actual popup on display of your device.
    There are messages from your Android device, which you can see in LogCat.

    Next step is select Google Play account for Google Play connection (account selection popup may be displayed in case of many existing account on device). After you select certain account you will get success connection to Google Play Service as a result. As we can see you described in your message, that's the situation takes place here.

    It's not custom implementation of Android Native plugin. It's official Google Play connection flow.
    Any additional information you can find in Google Play Service documentation.

    If you have additional questions according this case - feel free to ask any info.
     
  10. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    That's quiet strange behavior.
    According log you provided, notification was scheduled successfully and should be displayed with proper time delay.

    Please, check enable notifications settings for the application on your Android device.

    If the issue still exists, I would recommend you contact Stan's Assets Support directly.
    Additional more extended log from your Android device may be required.
    You will get feedback as soon as possible.
     
    Last edited: Jun 11, 2015
  11. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Message in log you provided indicates that OneSignal SDK native libraries are missing in your application build.

    All JAR libs should be added automatically when you enable One Signal Push Notifications settings in Android Native Settings Inspector window. Are you sure you did not remove this libraries manually?

    Please, check Assets/Plugins/Android folder in your Unity project for OneSignalSDK JAR libs existence.
     
  12. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    For In-App Billing you have to setup all products in Google Play Developer Console, add all settings to Android Native Settings Inspector window. You have released at least beta-version of your application.

    If you are able to purchase your products, that your In-App Billing setup should be correct.
    So, please, check your code (especially subscription for necessary Purchase Manager AndroidInAppPurchaseManager.ActionRetrieveProducsFinished event).

    If the issue still exists, contact Stan's Assets Team for support.
     
  13. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45
    Thank you! now i can receive notifications, but no subtitle and message are displayed on the notification, title parameter only and icon, any suggestion? thanks!
     
  14. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    If I understand correctly, you are using GCM Push Notifications with Android Native plugin.

    What data format do you use for your push notification?
     
  15. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45
    Yes i'm using GCM push notification with android native plugin, i'm trying to send notifications with RESTclient in this format:

    {"to":"APA91bE6ij0JGK2rSXq4bIWuCoVtRxsqAa2CScsmrcR57YCk3dxQwX4NjrvRGNl7OrpmTv0jj1KLHLjATRS21wbDCh4lBh6UyU9Ah-x6VNtMelRIp6bb6J9rV_VvrqIgC-1yGJhbrcTxy-rbnGzc4hMU7sB88TzHw", "data":{"title":"title", "subtitle":"subtitle", "message":"message"}}

    only title is displayed on the notification
     
  16. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thanks for the information, appreciated.
    Thing is I do not think this happened when on earlier version of the asset, the initial version of the game produced no freeze effect. I upgraded plugins in game with some minor tweaks for a update and this started to happen, hence assumed it was asset fault. But I do the changes you said and see what happens.
    Cheers
     
    Hazlo likes this.
  17. petediddy

    petediddy

    Joined:
    Mar 17, 2015
    Posts:
    19
    Sure - my code to handle the Google Play Connection issue looks like this - probably not the best way, but it's working for me. The below code is in a scene manager object in my loading scene.

    Code (csharp):
    1.  
    2. void Update()
    3. {
    4. if (alreadyRanStartGooglePlay == false)
    5. {
    6. StartCoroutine ("StartGooglePlay");
    7. }
    8. }
    9.  
    10. IEnumerator StartGooglePlay()
    11. {
    12. if (GooglePlayConnection.state != GPConnectionState.STATE_CONNECTED)
    13. {
    14. GooglePlayConnection.instance.connect ();
    15. yield return new WaitForSeconds (1f); //this pauses for 1 second, allowing the connect call on prior line to finish.
    16. }
    17.  
    18. alreadyRanStartGooglePlay = true;
    19.  
    After this, I load leaderboards and achievements, if GooglePlayConnection.state == GPConnectionState.STATE_CONNECTED
     
  18. petediddy

    petediddy

    Joined:
    Mar 17, 2015
    Posts:
    19
    Still trying to figure out the Screenshot Sharing issue - can't get it to work. Any help?

    AlexRay, do you have any advice how to get the Screenshot Sharing to work? Does this feature work on your device?
     
  19. eduisfun

    eduisfun

    Joined:
    Apr 2, 2015
    Posts:
    7
    The issue was resolved by uploading the same build to play store as a beta. Thanks
     
  20. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    To correctly display notification message you have to change your notification data bundle structure.
    So, just replace message tag with alert.

    For your case:
    "data":{"title":"title", "subtitle":"subtitle", "alert":"message"}
     
  21. eduisfun

    eduisfun

    Joined:
    Apr 2, 2015
    Posts:
    7
    I get an error saying
    Product Purchase Failed: Cant Start async operation(consume) because another async operation (consume) is in progress.

    What should I do to check if its already happening, so that I can avoid calling it again?
     
  22. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thanks dude, much appreciated, this worked although still not 100percent stable but good enough for release.
    I still think the asset itself could include some feature and small bug fixes for better stability.
    Anyway maybe not a good idea to check on Update() I just did script onStart() etc
     
  23. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    This is almost 4 day I'm in contact with the support but didn't get any reasonable answer of how to make that dam*ned Interstitial to get work as it should. The last response was yesterday, to make some Singleton class, but I've no idea how to do it (the level of English knowledge in support is also kinda, well, worse then mine, I don't understand them sometimes). Maybe anyone from the forum can help me? What I'm trying to do.

    I do have a gameplay scene, where all actions is happening. I set my Interstitial ID and call the Load method to load the Interstitial. Once the player click on back button of the phone I call to show the Interstitial. But every time I do it, I get "Interstitial should be setted first error" in the phone... Is there anyone here, who has integrated interstitial? Can you try to see in your code, if you are able to show the Interstitial once the back button on the phone has been clicked...

    P.S. To note one more thing, when you call the LoadInterstitial method, instead of simply loading the Interstitial it also does show the Interstitial, which sucks, because there are one more API named as SHowInterstitial, and this fckng method should show the interstitial but not the LoadInterstitial method..(this situation also mentioned in the review section of the asset in the assetstore).. I think the quality of this asset has started to become worst and worst. I bought this asset because of easy integrations, but just because of this I'm holding the release of my game.. and I'm thinking of downloading the FREEE official unity's admob plugin and start to use that one, instead of this asset...
     
    Last edited: Jun 12, 2015
  24. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45

    it works! but where can i find the documentation for this bundle structure? i need to replace old notifications when i receive a new one : )
     
  25. jeffsherwin

    jeffsherwin

    Joined:
    Aug 22, 2014
    Posts:
    47
    Hi

    Been trying to wire up the google play achievements and leaderboards. Followed the documentation - twice.

    keep getting
    GooglePlayConnection failed with code: SIGN_IN_REQUIRED

    right after I sign in on android 19 os.

    any advice here? I am about ready to drop the leaderboards from the android version

    thanks!
    Jeff
     
  26. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Mate read the last 3 pages of the thread!
     
    jeffsherwin likes this.
  27. jeffsherwin

    jeffsherwin

    Joined:
    Aug 22, 2014
    Posts:
    47
    thanks - will put the hack in place. was hoping not to have to parse pages and have someone sum it up. :)
    If this doesn't work I can live without leaderboards for a release. Be a nice patch once they get it fixed right.

    glad i looked here been hacking on this for a couple of days
     
  28. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Hello, i have some problem when i want to use onesignal service with android native plugin, when i install this plugin, then google play services still in connecting...
    thank you for support.

    I have to delete:
    <meta-dataandroid:name="com.google.android.gms.version"android:value="7327000"/>

    Because got a conflict with other :
    <meta-dataandroid:name="com.google.android.gms.version"android:value="@Integer/google_play_services_version"/>

    Maybe this the problem?
     
    Last edited: Jun 13, 2015
  29. jeffsherwin

    jeffsherwin

    Joined:
    Aug 22, 2014
    Posts:
    47
    Shoving GooglePlayConnection.instance.connect (); into a coroutine and giving it time to finish did not work for me :(
    Going to remove from release until this can be addressed. Even without the issue with this plug in - there is too much wiring into googleplay. Usually not like google to have something so clunky.

    thanks for the help
     
  30. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45


    i'm trying to use this module too on a Moto G, when i take a picture with the native camera nothing happen, no callback at all, it remain in the camera module, if i take a second shot my app restart... why? i'm so frustrated...
     
  31. Apptention

    Apptention

    Joined:
    Jun 15, 2014
    Posts:
    5
    Hi stan!
    I am using functions [ just google mobile ad , play game service ]
    In my manifest , I removed "UnityPlayerNativeActivity" and make "UnityPlayerActivity" into main activity
    and no error occurred.< ads and game services work well >
    What does the UnityPlayerNativeActivity do ?

    android native plug-in 6.5
    unity 5.0.2 p4
     
    Last edited: Jun 14, 2015
  32. Apptention

    Apptention

    Joined:
    Jun 15, 2014
    Posts:
    5
    uncheck "Keep Android Manifest Clean" flag and change this value in manifest manually .
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"android:value="false"/> - incorrect
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"android:value="true"/> - correct
     
    Last edited: Jun 14, 2015
    aer0ace likes this.
  33. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45
    Hi, i've a little problem with gcm notification icon, on some devices it appear very small, in others don't appear at all, there's a specific resolution or extension for notification icon? thanks
     
  34. clever

    clever

    Joined:
    Oct 11, 2012
    Posts:
    38
    Hi there, trying to implement a Google Services sign-in for my game. The first time it worked fine, however for some reason it stopped working since. Now I'm getting a result of CANCELED, then SIGN_IN_REQUIRED. I'm signed in on the Android phone, any idea what the issue is?

    The code I use for the callback is:

    private void ActionConnectionResultReceived(GooglePlayConnectionResult result) {
    if(result.IsSuccess) {
    AndroidMessage.Create("Connection Success", "Logged into Google Play: \n"+ result.code.ToString());
    Login_Player_Success();
    } else {
    AndroidMessage.Create("Connection Error", "Connecting to Google Game Services failed: \n"+ result.code.ToString());
    Debug.Log("Connection failed with code: " + result.code.ToString());
    }
    }

    I checked and the app ID is correct
     
  35. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Have you read the last few pages of this thread??
     
  36. Dreamonaut

    Dreamonaut

    Joined:
    May 19, 2014
    Posts:
    32
    Hello Stan, few months ago i wrote this:

    And i would like to know if you had time to add this feature ? Thank you ! ! keep up the good work.
     
  37. ottolb

    ottolb

    Joined:
    Jul 1, 2009
    Posts:
    42
    Hey, I'm using a backend service, which I can't change bundle structure that came from server. There is a way to change parse on the plugin?

    I'm receiving from server:
    I/AndroidNative(8862): Received: Bundle[{messageId=55820860e4b04bc338905315, messageCount=3, messageTitle=qwrqw, messageSubTitle=werwer, from=136220355815, message=qqweqwe, android.support.content.wakelockid=4, collapse_key=do_not_collapse}]

    Thanks
     
  38. clever

    clever

    Joined:
    Oct 11, 2012
    Posts:
    38
    I tried the waitforseconds(1f) and it didn't change anything, same thing (CANCELED then SIGN_IN_REQUIRED), I tried making it wait for more time... same thing!!! VERY F-ING FRUSTRATING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    I read the last 3 pages, it doesn't explain why in one build it worked and then in the second build (where the Android code was not changed) it stopped. Also, any idea why the callback gets called *if* there was a lag due to loading? Does the Google code just give up a few milliseconds later?
     
    Last edited: Jun 18, 2015
  39. sandeepsmartest

    sandeepsmartest

    Joined:
    Nov 7, 2012
    Posts:
    138
    Replace below line
    <meta-dataandroid:name="com.google.android.gms.version"android:value="7327000"/>
    with
    <meta-dataandroid:name="com.google.android.gms.version"android:value="@@Integer/google_play_services_version"/>

    Do not delete, just replace. Also make sure that you have below lines of data included in your manifest file
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver"/>
    <receiver android:name="com.unity3d.plugin.downloader.UnityAlarmReceiver"/>
    <receiver android:name="com.onesignal.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
    <intent-filter>...</intent-filter>
    </receiver>
    <service android:name="com.androidnative.gcm.GcmIntentService"/>

    <application>
    <activity android:name="com.onesignal.NotificationOpenedActivity"/>
    </application>

    if it doesnt work let me know i will send my manifest file.
    Hope this may Help You
     
    IndieFist likes this.
  40. redccoma

    redccoma

    Joined:
    Feb 15, 2015
    Posts:
    13
    Hi. I've been using the ANP 6.2 version.

    Then push function was normal, I updated to 6.6 version because the ANP other features side bug.
    (When you send a push icon and title are output correctly, a message will be a problem to get a space.
    There was also the problem icon, the icon did not come as intended.But I had resolved to change the icon file name in uppercase to lowercase. Had it says in the guidelines for this part's a little unfortunate part would have been a little more comfortable.)

    And it did not push function operates normally, I suffered for three days.
    I was hard..;(

    But today I found the cause.
    Some of the methods in the code below must ANP 6.6 version an_googleplay.JAR file.


    private void sendNotification(Bundle extras)
    {
    ...

    String title = extras.getString("title");
    String message = extras.getString("alert");

    ...
    }

    How'd take it

    String message = extras.getString ("alert");

    I've been able to find any errors in this section. To operate normally think should have been supposed to be "alert" rather than "message".
    I will separate the same as the original message when you send messages from the server without modifying it by adding jar file to the GCM alert key've solved this problem.

    But this I think we should solve this STAN. Other developers who are suffering from this problem, I hope this helped to.
     
  41. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45

    hi redccoma, what do u mean "the push icon did not come as intended"? cause i have a similar problem with push notification icon too, that's how my icon appear in push notification, take a look to my screenshot.
    Tried to change icon name with lowercase char but didn't worked, any idea why?
    thank you
     

    Attached Files:

  42. redccoma

    redccoma

    Joined:
    Feb 15, 2015
    Posts:
    13
    My problem is push notification icon is not applied. At that time when problem occurred. apply icon is default app icon.
    (i solved. change correct file name.)

    i think your problem is apply app icon size very small. what is icon size? my size is 192 * 192.
     
  43. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45

    i tried a lot of different images, formats (jpeg, png, gif) and different sizes, same result, really no idea why : )
     
  44. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Did you contact Stan about this, also always make sure your using latest asset version to test on.
     
  45. Skatola

    Skatola

    Joined:
    Jan 17, 2013
    Posts:
    45
    yes of course, he asked me for a screenshot of my icon problem, i sent it and waiting for reply.
    And yes, tried with the last version of the asset obviously
     
    MrEsquire likes this.
  46. clever

    clever

    Joined:
    Oct 11, 2012
    Posts:
    38
    BTW MrEsquire, I did contact Stan, was helpful. The CANCELED problem is fixed, I had to delete the game on Developer Console > Game Services and re-add it again with a fresh keystore credentials. That fixed it/.
     
    aer0ace and MrEsquire like this.
  47. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Hello. I have a problem with the latest version.
    When i send an achievement, i have a native android pop showing the id if the achievement on a white box.
    Please, i have send an update to store and now i can't fix that.
    I have reinstalled the plugin and all.
     
  48. Meic

    Meic

    Joined:
    Jun 27, 2013
    Posts:
    10
    Hi. I've got question about Twitter posting mechanism. I'm using PostWithAuthCheck method and it works fine when request was successful. When request fails the callback method (OnPostingCompleteAction) does receive info about that but there is no any data describing what's the reason of the failure. I was hoping for some kind of error codes in a data field of TWResult instance that is passed to callback method but there is none passed (at least while trying to duplicate message - the data received is IsSucceeded field = false and data field = "[]").
    Is that some kind of plugin bug or am I misunderstood the way it should work?
     
  49. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    A lot of search results for the "AdMob ads aren't clickable" problem have this as the solution, and I'm just confirming that this is still the case, since most search results will be for earlier Unity and AdMob versions.
    I'm using Unity 5.0.1f1 and Android Native Plugin v6.3
    Works perfectly. Thanks!
     
  50. AlexRay

    AlexRay

    Joined:
    Jul 9, 2014
    Posts:
    993
    Hello,
    This feature was added to Android Native plugin.
    Android Native plugin has 'Replace old notification with new one' option to enable/disable push notifications replacement.

    So, you will get it with the following update.
    Anyway, if you want to get such functionality earlier, you may contact Stan's Assets Support Team.
    Probably you will get Android Native v6.7b with new functionality added.

    Cheers!