Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Prime31 Android Plugins Officially Live!

Discussion in 'Android' started by prime31, Jun 6, 2011.

  1. gaskbr

    gaskbr

    Joined:
    Dec 3, 2012
    Posts:
    1
    @prime31

    Hey there, I'm using prime31 IAB for Android and I need to know when a user cancels a purchase, just like you exposed the event in the StoreKitManager for iOS "purchaseCancelledEvent". How can I do it? Is that possible?

    Thanks in advance

    gaskbr
     
  2. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gask, the event list in the documentation has the following event which may be of interest:

    // Fired when a purchase fails
    public static event Action<string> purchaseFailedEvent;
     
  3. LukasO

    LukasO

    Joined:
    May 23, 2013
    Posts:
    115
    Hi,

    I'm not sure if it's a problem with the plug-in or Unity, but I'm getting a bug where in the Android Manifest the same activity is being declared twice. This is in my own application's manifest rather than the one provided by prime31. This is causing a crash when running the application. I keep having to delete the latter of the two declarations by hand.

    Was wondering how to fix this.

    Cheers
     
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @lukas, the plugin will only generate a new AndroidManifest if one doesnt exist so your problem lies elsewhere.
     
  5. LukasO

    LukasO

    Joined:
    May 23, 2013
    Posts:
    115
    If I run the application before installing your plug-in, this problem did not occur, so I am thinking there's a decent chance that it's something to do with the plugin. I notice the post processor edits my existing manifest to add your necessary information into the mainfest so I was wondering if thjat could be anything to do with it.

    Thanks
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @lukas, as previously mentioned, our post build system will only generate a new AndroidManifest file if one doesn't already exist. The proper way to modify it is to use the prime[31] menu to generate an AndroidManifest file then add what you need to it.
     
  7. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    Hi Primates,

    We are using your GoogleCloudMessaging solution and as soon as I call
    Code (csharp):
    1. GoogleCloudMessaging.register("XXXXXX")
    the android crashes while the development build logs the following exception:

    Code (csharp):
    1. System.TypeInitializationException: An exception was thrown by the type initializer for GoogleCloudMessaging ---> System.ExecutionEngineException: JNI Exception
    2. at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <filename unknown>:0
    3. at UnityEngine.AndroidJavaClass..ctor (System.String className) [0x00000] in <filename unknown>:0
    4. at GoogleCloudMessaging..cctor () [0x0000d] in /Users/Guy/.../GoogleCloudMessaging/GoogleCloudMessaging.cs:19
    5. --- End of inner exception stack trace ---
    6. at CloudMessaging.RegisterToCloudMessaging () [0x0000a] in /Users/Guy/.../CloudMessaging/CloudMessaging.cs:39
    7. at CloudMessaging.OnGUI () [0x00028] in /Users/Guy/.../CloudMessaging/CloudMessaging.cs:21
    What am I doing wrong?

    I'll also add that even though we are removing the existing android manifest from our project, the "Generate" menu button does not seem to generate a manifest.

    A call from GoogleCloudMessaging.cs supplied by you caused this exception.

    Code (csharp):
    1. using( var pluginClass = new AndroidJavaClass( "com.prime31.GoogleCloudMessagingPlugin" ) )
     
    Last edited: Jul 25, 2013
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @guy, your Unity project may have some issues. Have you tried importing the plugin in an empty project to rule that out? We have never seen any case of the Manifest generator not writing a file.
     
  9. GuyTidhar

    GuyTidhar

    Joined:
    Jun 24, 2009
    Posts:
    320
    Issue solved.

    I had missing jar files. It would be an amazing miracle had it work without them :)

    Cheers!
     
  10. parthpatel1612

    parthpatel1612

    Joined:
    May 17, 2013
    Posts:
    15
    I am using prime31 google play service plugin and prime31 In app billing services and I just put my game on the google play store.
    Now user are sending me the crash reports with this error.

    Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{**************/com.prime31.UnityPlayerActivity}: java.lang.NullPointerException
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    at android.app.ActivityThread.access$600(ActivityThread.java:141)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.NullPointerException
    at com.unity3d.player.g.a(Unknown Source)
    at com.unity3d.player.g.b(Unknown Source)
    at com.unity3d.player.UnityPlayer.resume(Unknown Source)
    at com.unity3d.player.UnityPlayer.a(Unknown Source)
    at com.unity3d.player.UnityPlayer.init(Unknown Source)
    at com.unity3d.player.UnityPlayerNativeActivity.onCreate(Unknown Source)
    at com.prime31.UnityPlayerActivity.onCreate(UnityPlayerActivity.java:29)
    at android.app.Activity.performCreate(Activity.java:5104)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)


    I don't know what I am doing wrong. Both the plugin works fine but sometime it crashing.
     
  11. CinLing

    CinLing

    Joined:
    Jul 15, 2013
    Posts:
    6
    dear prime..
    Is this the way to generate the key hash?
    Strange..
    I dont got any error but i cant test to post something on my wall via your demo application..
    $print copy.png
    Thanks..
     
  12. NathanWarden

    NathanWarden

    Joined:
    Oct 4, 2005
    Posts:
    663
    Hi Prime31, I have your AdMob plugin provided by a client whose app I'm building. On my Nexus 7 the ads will rotate out every 30 seconds or so like it's supposed to, but for some reason his Galaxy Tab only ever shows the first one. Am I doing something wrong or is this a bug in the plugin or even ad mob itself?

    Thanks,
    Nathan
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @nathan, contact Google for assistance with their SDK. It is closed source and we obviously have no access to their code or servers to assist.
     
  14. Bryson

    Bryson

    Joined:
    Jul 10, 2012
    Posts:
    12
    Hey prime,

    Is there any way to grab a list of Google+ friend names/IDs by using the Google Play Game Services plugin? I'm trying to show the player a list of invite-able friends (preferably those who have installed the app).
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bryson, no. The Google+ service is not exposed by the plugin.
     
  16. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    266
    Hi Prime,

    Quick question/note about the Google IAB plugin. We are updating from v2 billing and I noticed that while your documentation says that unmanaged products can no longer be used, Google's IAB migration document says that unmanaged items from existing apps will be treated as managed items by the v3 system: http://developer.android.com/google/play/billing/billing_overview.html#migration

    This seemed to work OK for awhile, though one of our testers was able to get a consumable item in a state where:
    • It had been purchased.
    • It was not consumed.
    • The inventory query does not return the purchased item.
    • Trying to purchase the item gets an "Item Already Purchased" from Google.
    • Trying to consume the item returns a failure (because it wasn't returned when querying the inventory).

    So yeah...that seems like a bust. Maybe Google is incorrectly excluding the consumable items from the inventory query because they aren't managed. Is the correct course of action to recreat old v2 consumables as separate v3 managed products?

    Thanks!
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @kromenak, I personally found that Google's docs were not accurate hence the note in our docs. Recreating the items as managed fixed any issues for me.
     
  18. CinLing

    CinLing

    Joined:
    Jul 15, 2013
    Posts:
    6
    no one answer me..
    T,T
     
  19. piroshi

    piroshi

    Joined:
    Jan 9, 2012
    Posts:
    16
    I 'm having problems with EtceteraAndroid.saveImageToGallery() too. The example works but even when I copy the code to another scene it return false
     
  20. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    266
    @prime31, thanks; I recreated the v2 items and haven't had that issue again.

    Another issue I've noticed is that if a user initiates a purchase, but suspends the app before Google prompts them to confirm the purchase, then my app will not receive a "Purchase Success" or "Purchase Failed" callback and there is potential for the app to hang waiting for a response.

    It also seems that the first time I call Purchase again after this happens, I get this error: Null data in IAB result (response: -1002:Bad response received).

    I'm trying to manually find a quick fix (and it is an edge case for sure), but it seems that even if I suspend/resume at that time in the app, the IAB flow shouldn't freak out like it does.

    EDIT: This odd behavior seems to be caused by a Unity 4.2 manifest setting "android:launchMode="singleTask". If I remove this line, everything works fine with IAB, but there are a bunch of graphical glitches that occur. If I include that line, it seems that every time I resume the app, the GoogleIABProxyActivity is forced to the background, which causes odd behavior. Any thoughts on how to resolve that???

    EDIT 2: We are still doing testing, but I think we've tentatively resolved the issue by following this article: https://lilpickle3000.wordpress.com/2013/01/30/android-singletask-launchmode/. Apparently, there is a bug/feature with using "singleTask" launch mode where resuming an app from the home screen will destroy all activities on top of the launch activity in the task stack. The article provides a workaround.
     
    Last edited: Aug 9, 2013
  21. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    Hey,

    I'm using the Etcetera plugin for Android and I want to use a scroll-able inline webview for my application. When I tried the demo scenes, the inline webview doesn't allow scrolling and clicking inside them. When I click on the webview (which is over a button), the button underneath it gets pressed instead of the link on the webview. Is there anything I'm missing out or doing wrong?
     
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bik, here is a copy/paste directly from the documentation: "Note that Unity's input handling will still occur so make sure nothing is touchable that is behind the web view while it is displayed."
     
  23. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    @prime31, I read the documentation and my problem is not the underlying button being clicked. My problem is that the actual webview is not clickable. More so I'm interested in scrolling the webview rather than actually clicking it.
     
  24. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    746
    @prime31, how long does it take for the cancelled purchase to show up as cancelled on a queryInventorySucceededEvent?

    It's been about 45 minutes so far but still comes through as purchaseState == 0
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @trooper, Google's documentation does not list any time periods. I've seen a few tests take over a day.
     
  26. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    @prime31 Is your support system generally so bad, or I'm the only one being on the receiving end of such affair? Is there something that can be done about my problem, or do I have to shift to other options than using your plugins?
     
  27. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bik, we can't reproduce a webview not scrolling and we havent received any other similar reports. Granted scrolling in an inline web view will never actually be smooth due to the device having to render an entire game plus a webview which is an extremely heavy control. Perhaps switching to a standard webview is a good idea. You included exactly no information (no device model, Android OS version, logcat output, etc) and the webview is a standard Android component. Googles code handles all touches, scrolling, loading, rendering etc. I'm not sure what exactly you expect us to be able to do here. Issues with standard controls which we have no power over are best brought up by submitting a proper bug report to Google.
     
    Last edited: Aug 10, 2013
  28. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    Okay. Fair enough. I wanted to know whether this is a general problem or if I'm doing something wrong.

    However, I think I've been able to reproduce the problem. The problem occurs only when I'm using the Qualcomm Vuforia plugin. It seems that the Etcetera plugin and the Vuforia plugin don't go hand in hand. Do you have a workaround? The logcat didn't have much useful information, still I can share it if you want. I'm using Galaxy Note II for testing. The Unity version is 4.1.2.
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bik, Vuforia overrides the Unity Activity so it is quite possible they are not forwarding touches along to other native views. You will have to check with them to see if they have a workaround.
     
  30. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    Okay, thanks for the info. Apparently, Vuforia does override the Unity Activity. I tried to make my own plugin for making a webview, but no luck. I forwarded the touches to the the native views, but doesn't seem to work! Hope I find a workaround soon! :/
     
  31. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bik, I did just think of something: you may want to make sure the AndroidManifest.xml that Vuforias uses adds the proper attribute to have events forwarded:

     
  32. sanjodev

    sanjodev

    Joined:
    May 29, 2012
    Posts:
    63
    @prime31, Is there a way to reset achievements for the GooglePlayServices similar to the GameCenter method call, resetAchievements?
     
  33. parthdarji

    parthdarji

    Joined:
    Jun 30, 2012
    Posts:
    14
    OH MY GOD!!!! That indeed was the problem. The value of this metadata is specifically set to false by the Vuforia plugin. Changing it to true did the trick. Th
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sanjokids, I believe there is a way to reset data but Google did not expose it via their Android SDK. You may be able to do it manually using their REST API. You will want to check their docs to see if it is possible.
     
  35. davidhorak

    davidhorak

    Joined:
    Nov 7, 2012
    Posts:
    16
    Hi Prime31,
    I have problem with Twitter login.
    After I log in into my Twitter app, the the Twitter redirect to my REDIRECT URL, and this page is shows in browser windows, and there is no callback into Unity.

    Where is the problem ?
     
  36. Bryson

    Bryson

    Joined:
    Jul 10, 2012
    Posts:
    12
    Hey Prime,

    I just added a few new prime31 Android plugins to my project, regenerated the AndroidManifest file, and am now getting an exception when I run it on a device:

    Code (csharp):
    1.  
    2. 08-15 10:32:06.781: E/AndroidRuntime(3530): FATAL EXCEPTION: main
    3. 08-15 10:32:06.781: E/AndroidRuntime(3530): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.company.project/com.prime31.UnityPlayerProxyActivity}: java.lang.ClassNotFoundException: com.prime31.UnityPlayerProxyActivity
    4.  
    Any thoughts on what to do about this? Not quite sure what this is telling me here, or where to expect the UnityPlayerProxyActivity class.
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bryson, looks like you are missing a jar file. Redownload and reimport the plugins. The P31UnityActivity jar file should end up in the Plugins/Android folder
     
  38. Deleted User

    Deleted User

    Guest

    Hi Prime

    I have a couple of questions before purchasing your Android IAB plugin. Does the IAB plugin override the main activity or require these lines in the activity manifest?

    HTML:
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    
    Secondly does anyone know if this works with BFS Google Play Google Services Plugin?

    Thanks
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @meridian, the plugin does not override the main Activity.
     
  40. Ali Arslan

    Ali Arslan

    Joined:
    Aug 19, 2013
    Posts:
    1
    Hi Prime,

    Am facing a strange problem and i cant find whats wrong. Am using social networking plugin to post pictures to facebook. The first picture gets posted perfectly. However if the i try to post again. i get java.io.FileNotFoundException: https://graph.facebook.com/me/photos

    If i logout and login again then I can post one photo and on every photo after that i get this again. so i have to logout and then login again to post a picture. Please tell what i am doing wrong.

    my code is:

    Code (csharp):
    1. if(FacebookAndroid.getSessionPermissions().Contains("publish_actions")){
    2.             print ("account validated");
    3.             FBScreenShotNumber++;
    4.             string path = "TEST" + FBScreenShotNumber + ".png";
    5.             string origin = System.IO.Path.Combine(Application.persistentDataPath, path);
    6.            
    7.             while( System.IO.File.Exists(origin) ){
    8.                 FBScreenShotNumber++;
    9.                 path = "TEST" + FBScreenShotNumber + ".png";
    10.                 origin = System.IO.Path.Combine(Application.persistentDataPath, path);
    11.             }
    12.    
    13.             Application.CaptureScreenshot(path);
    14.             print (Application.persistentDataPath+"/"+path);
    15.             //yield return new WaitForSeconds(2.0f);
    16.            
    17.        
    18.             while( !System.IO.File.Exists(origin) )
    19.             {
    20.                 yield return null;
    21.             }
    22.            
    23.             if(System.IO.File.Exists(origin)){
    24.                 var bytes = System.IO.File.ReadAllBytes( origin );
    25.                 print("posting now");
    26.                 Facebook.instance.postImage( bytes, "I just played ", completionHandler );
    27.                
    28.             }
    29.             PostImage=false;
    30.            
    31.             bottombar.SetActive(true);
    32.         }
     
    Last edited: Aug 19, 2013
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @ali, when you run into issues with Facebooks servers you need to contact Facebook. They are the only ones that can tell you why they are rejecting the second post.
     
  42. storatest

    storatest

    Joined:
    Apr 8, 2013
    Posts:
    8
    when will prime31 plugins verison in unity asset store be up to date to the prime31 site one?
     
  43. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @storatest, which plugin are you referring to?
     
  44. Alessaint

    Alessaint

    Joined:
    Mar 21, 2011
    Posts:
    43
    Hi Prime,

    I'm deciding whether to include Google Services License check into our game so I went through the plugin documentation and I found this callback: licenseCheckFailedEvent with "Fired when a license check fails" comment. When exactly this license check happens? Is it triggered automatically at some point?

    Thanks
     
  45. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @alessiant, Google does not specify when they will fire the event so its best to just wore up the listener at launch.
     
  46. Alessaint

    Alessaint

    Joined:
    Mar 21, 2011
    Posts:
    43
    I see... Thanks, Prime
     
  47. Burve

    Burve

    Joined:
    Feb 12, 2011
    Posts:
    139
    Hmm, I am effeminately doing something wrong, just no idea what .... :(

    I opened new project, imported PlayGameServicesAndroid_2013-07-29.unitypackage selected PlayGameServicesDemoScene scene and run in editor - I got lots of buttons on screen.

    Then I compiled for my Nexus 7 and I got "Unfortunately, app name has stopped."

    and nothing, app just not opening at all :(


    On a side note, I got same package in another project, that works fine, but when I try to call PlayGameServices.authenticate(); on device Nothing happens at all !!!
    I don't get any word from both events, no login screen opens, no errors in console, nothing.

    What am I doing wrong ?
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @burve, with the information you provided there is absolutely nothing we can do to assist. Please attempt to compile a proper bug report including all the basics: log cat logs, OS version, Play Store version, device make, model, etc
     
  49. Burve

    Burve

    Joined:
    Feb 12, 2011
    Posts:
    139
    hmm, awesome replay, I have now words ...


    however I will try to get some,

    so, for that empty scene not working on device:
    cat log:
    OS - 4.3
    your addon version (that I did mentioned) - was from 2013-07-29 and counts as latest for android
    device - Nexus 7 (2012), from Assus (obviously)

    Unity, that was used - 4.2.1 (fresh from todays Unity website)


    hard to add something else ...

    P.S. hmm, shall i assume, that if I add your plugin to my game, then my game will run only on few OS versions of Android and few devices, based on your question, and rest can't use it ? Sounds like awesome feature to me ...
     
    Last edited: Sep 5, 2013
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @burve, when using Play Game Services you are of course limited to the Android OS and Play requirements. That has nothing to do with our code, it is just the reality of using a new technology. We require a device model and Android OS version so that we an attempt to reproduce the issue.

    The logs you provided show no errors at all. There is no such thing as an application crash that does not provide a log cat log. Please provide us with at a bare minimum the log output. We can't just guess what is happening here.
     
    Last edited: Sep 5, 2013