Search Unity

Prime31 Android Plugins Officially Live!

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

  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @todd, the included *EventListener script has examples of all the events:

    Code (csharp):
    1. void productPurchasedEvent( string productId, string purchaseType )
    2. void productPurchaseFailedEvent( string productId, string purchaseType )
    3. void productPurchaseCancelledEvent( string productId, string purchaseType )
     
  2. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    Ah, I didn't even think to look at that script. Thanks!
     
  3. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    @prime31

    I have another issue now. I keep getting APK Repackaging Failed each time I try to repackage for MoVend. Here is the error message from the console, any ideas?

    jarsigner -verbose -keystore "F:/Codebase_Unity/Android/user.keystore" -storepass *correct password* "F:/Codebase_Unity/Omega Sector iPhone/p31Unsigned.apk" lucidvisiongames
    UnityEngine.Debug:Log(Object)
    P31APKPackager:logCommand(String, String)
    P31APKPackager:signApk(String)
    P31APKPackager:processApk()
    P31AndroidMoVendMenuItem:repackageAPK() (at Assets/Editor/Prime31Android/P31AndroidMoVendMenuItem.cs:39)


    ApplicationName='jarsigner', CommandLine='-verbose -keystore "F:/Codebase_Unity/Android/user.keystore" -storepass *correct password* "F:/Codebase_Unity/Omega Sector iPhone/p31Unsigned.apk" lucidvisiongames', CurrentDirectory=''
    UnityEngine.Debug:LogError(Object)
    P31AndroidMoVendMenuItem:repackageAPK() (at Assets/Editor/Prime31Android/P31AndroidMoVendMenuItem.cs:47)

    I'm running 64 windows 7 so the Java JDK is installed at the following path:

    C:\Program Files (x86)\Java\jdk1.6.0_26

    I tried creating an environment variable called "PATH" with the "C:\Program Files (x86)\" and still get the error.
     
    Last edited: Apr 23, 2012
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @todd, the jarsigner executable can't be found. That almost always means your PATH is not properly set. If you have a Mac handy it is a lot easier requiring no path setup or configuration. If not, make sure you can open a command prompt and run jarsigner from it which will ensure your PATH is set properly.
     
  5. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    I'm not familiar with jarsigner, is that part of the android adk? I've searched the android SDK and no files are coming up with that name.
     
  6. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    I found it in the Java JDK bin folder. Can you give me an example of the command I need to type to set the path?
     
  7. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @todd, to test the PATH open a command prompt to any directory beside te one the jarsigner file is in an just type "jarsigner" and hit enter.
     
  8. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    'jarsigner' is not recognized as an internal or external command,
    operable program or batch file.

    It's not configured right, any idea what the command is to change it?
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @todd, sometimes after changing the PATH a reboot is required on Windows.
     
  10. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    Ok, but I still don't know how to change it, maybe I'm missing something? Any idea how I can change the path?
     
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @todd, if you Google it you will find many step by step guides on changing it. It helps to see the images in the guides because it is pretty well hidden on Windows.
     
  12. toddw

    toddw

    Joined:
    May 9, 2010
    Posts:
    130
    Here's the solution in windows 7:
    - click start
    - right click computer
    - click properties
    - click Environment Variables
    - locate the "Path" variable under "system Variables"
    - double click the row to edit it
    - leave the existing contents of the Variable value field intact and append a ; then the full path to the JDK(version)\bin folder
    - restart your computer
    - pen command prompt and type jarsigner then press enter (at this point the jarsigner command list should come up, if so then your good)
     
  13. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    Just picked up your FlurryAndroid plugin and i had a quick q. Alls in and no bugs/crashes but when i went to update the manifest it really destroyed our previous manifest... there's just a lot of stuff in there that might be conflicting. Anyways, i was just going to manually add the manifest items in but which do i use? There's the Manifest under FlurryAndroid and there are also 2 (Manifest34 and Manifest35) under Android/.. could you point me in the right direction on which to use?

    Cheers
    Bryan
     
  14. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bryan, each of our plugins that requires manifest changes has a file called Manifest.xml that details the changes required for the particular plugin.
     
  15. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Ok got it. Thanks! Also wrt to starting flurry, i noticed that setContinueSettionMillis is required before onStartSession.. so we need to run that and set it so something arbitrary before we start up flurry? How does that effect the closing out of sessions for submitting to Flurry (and reopening)?
     
  16. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bryan, in almost all cases you will never need that method. See Flurrys docs for the details of how their session system does its reporting.
     
  17. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Ahh yeah, i read the comment before that function wrong. :)
    Thanks!
     
  18. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    Ok just so i'm clear on the events (because i'm getting nada via flurry currently)..

    1) Application Start -> FlurryAndroid.onStartSession(flurry id string)
    2) To submit a string -> FlurryAndroid.logEvent(string name);
    3) and to submit all the events to the actual server whenever we either load a new level or quit the app we need to run onEndSession()

    Looking at the docs that seems to be the way it should be implemented, but for the life of me i'm not getting anything on the server. Also i'm not getting any issues at build or run.. and its definitely getting into the function i'm calling ... I mean i use the Flurry for iOS plugins and I have no issues w/them. Android and i don't tend to get along sometimes tho'.

    Cheers
    Bryan
     
  19. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Bryan, events take some time to show up. The initial batch will take a day or more sometimes.
     
  20. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    ok, thanks Prime. We'll let it stew overnight and see if there are any updates.
     
  21. devGuillaume

    devGuillaume

    Joined:
    Feb 10, 2012
    Posts:
    23
    @prime31 Do you plan on releasing an Android version of the AdWhirl plugin?
     
  22. chishti

    chishti

    Joined:
    May 21, 2009
    Posts:
    188
    @prime31 can we send .obj file from one device to another using bluetooth?

    thanks in advance
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dev, we have no plans of making an AdWhirl Android plugin. AdWhirl is a huge mess and trying to make a no compile solution and remain full features isn't happening.


    @boy, we do not yet have a Bluetooth plugin for Android.
     
  24. devGuillaume

    devGuillaume

    Joined:
    Feb 10, 2012
    Posts:
    23
    Ok thanks!
     
  25. chishti

    chishti

    Joined:
    May 21, 2009
    Posts:
    188
    @prime31 I was asking about using iphone bluetooth to transfer a file, not android bluetooth.
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @unity, that should work fine as long as the file isn't too big. I wouldn't recommend trying to send anything larger than ~500k without breaking it up into smaller chunks.
     
  27. chsir2000

    chsir2000

    Joined:
    Apr 26, 2012
    Posts:
    3
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @chsir, with your test the pushes are coming through but I am getting the same result of them not opening the app. You may want to check googled docs on push to see if anything needs to be sent with the packet to open the main Activity.
     
  29. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @prime31

    Heya Prime.. we're seeing an issue happen in multiple situations where we're using the ProgressCircle to show loading or whatnot. Basically if the device goes to sleep at any point in time, the progress circle will never go away (and pretty much soft locks the device). It only happens if we are putting the device to sleep.. otherwise it works fine. Also, if we use OnApplicationPause and tell it to hide the progress dialog it will continue with whatever it was doing but unfortunately can lead to dead times in between loads (if something wasn't truly loaded).

    have you run across this before? Is there an update that perhaps i've missed?
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bpritchard, I am assuming you are referring to the showProgressDialog method. You should be able to call hideProgress dialog either before sleeping or after awakening. The method has no effect with regard to pausing Unity so it isn't possible for it to interfere with Unity's thread.
     
  31. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @prime31

    Yes, sorry my mind was somewhere else when i was typing this.

    Its interesting because it is causing an issue, although i'm not entirely sure where. The issue occurred whenever we were loading in levels (its a multipart deal, but no requirements are set related to the progressDialog), and when we went to sleep the game would come back with only the progress dialog spinning. We did add that pause check and shut down the progress dialog which fixed it but i was curious if maybe there was something new i was missing or if there was a new version that i needed to perhaps update to.
     
  32. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    Hello Prime! We picked up the Amazon IAP plugin yesterday and are integrating it and i had a few q's. So we've got it integrating and building, and spewing info so thats good (as always.. seamless) but i don't seem to be getting a valid purchase request. In the sequence i initiate AmazonIAP.initiateItemDataRequest(new string[] { ProductUpgrade }); (where product upgrade is the upgrade id), and then have all the event listeners setup and are responding as follows...

    Code (csharp):
    1.  
    2. 05-03 14:02:12.882: I/Unity(2309): Submitting Event Initiated a purchase
    3. 05-03 14:02:12.882: I/Unity(2309):  
    4. 05-03 14:02:12.882: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    5. 05-03 14:02:12.882: D/bfgReportEvent(2309): Initiated a purchase
    6. 05-03 14:02:12.882: V/bfgReporting(2309): report event: Initiated a purchase
    7. 05-03 14:02:12.890: I/Unity(2309): Initiating purchase of heamazon_fullversion_unlock
    8. 05-03 14:02:12.890: I/Unity(2309):  
    9. 05-03 14:02:12.890: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    10. 05-03 14:02:12.921: I/Prime31(2309): item: heamazon_fullversion_unlock
    11. 05-03 14:02:12.921: D/PurchasingManager(2309): In App Purchasing SDK - Sandbox Mode: PurchasingObserver registered: com.prime31.AmazonIAPPlugin@4055b100
    12. 05-03 14:02:12.929: I/Prime31(2309): found saved offset: 1336071530474
    13. 05-03 14:02:12.929: D/SandboxRequestHandler(2309): In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest
    14. 05-03 14:02:12.937: D/SandboxRequestHandler(2309): In App Purchasing SDK - Sandbox Mode: sendPurchaseUpdatesRequest
    15. 05-03 14:02:12.937: D/SandboxRequestHandler(2309): In App Purchasing SDK - Sandbox Mode: sendItemDataRequest
    16. 05-03 14:02:12.937: I/Unity(2309): onSdkAvailableEvent. isTestMode: True
    17. 05-03 14:02:12.937: I/Unity(2309):  
    18. 05-03 14:02:12.937: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    19. 05-03 14:02:12.960: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: handleResponse
    20. 05-03 14:02:12.960: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: Running Runnable for userIdResponse with requestId: 68d1b319-d316-4fb2-bb86-ae45b6700e0b
    21. 05-03 14:02:12.968: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: handleResponse
    22. 05-03 14:02:12.968: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: Running Runnable for purchaseUpdatesResponse with requestId: 3256b155-d0a2-4493-9924-6193b4e2bd3e
    23. 05-03 14:02:13.007: I/Unity(2309): onGetUserIdResponseEvent: DefaultTestUser
    24. 05-03 14:02:13.007: I/Unity(2309):  
    25. 05-03 14:02:13.007: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    26. 05-03 14:02:13.007: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: handleResponse
    27. 05-03 14:02:13.007: D/SandboxResponseHandler(2309): In App Purchasing SDK - Sandbox Mode: Running Runnable for itemDataResponse with requestId: 3262a5bf-4772-46a1-bf58-bd93e8c557b5
    28. 05-03 14:02:13.124: I/Unity(2309): purchaseUpdatesRequestSuccessfulEvent. revoked skus: 0
    29. 05-03 14:02:13.124: I/Unity(2309):  
    30. 05-03 14:02:13.124: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    31. 05-03 14:02:13.132: I/Unity(2309): itemDataRequestFailedEvent
    32. 05-03 14:02:13.132: I/Unity(2309):  
    33. 05-03 14:02:13.132: I/Unity(2309): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 43)
    34.  
    I'm never getting into the purchase successful event, but i do get into the purchaseUpdatesRequestSuccessful event. Right now i have it setup so that i call the actual purchase in itemDataRequestFinishedEvent but it looks like i never get in there either. What are the factors that would cause that assuming i'm passing in the correct upgrade name? Do i have to have my account as a test account on the portal? Or having the json files installed locally on the device enough?

    Cheers
    Bryan
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Bryan, did you install the AmazonSDKTester apk yet? That app is where you configure all your test responses. It lets you pick the specific response for each request while testing.
     
  34. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    I do have it installed, sadly i didn't even realize it was something you had to go into and configure. :) I guess I'm a little unclear on how it works. everything is setup as default in the Amazon config, so i would think it would be returning valid responses to a purchase? I don't see an entry for "Purchase successful".. is there any more detailed documentation on how the flow of this should work and what kind of responses i should be expecting?
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bryan, Amazons documentation has a section dedicated to setting up and using the AmazonSDKTester app.
     
  36. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @prime

    Ok i'll give that a once over... nothing is as easy as it seems. ;) Thanks for the help! Everything seems to be working otherwise.

    Cheers
    Bryan
     
  37. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    All fixed. :) Thanks for the help earlier!
     
    Last edited: May 4, 2012
  38. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    @Prime31:

    Saw that you support now Flurry Clips with the iOS flurry plugin. Does this also apply to the android plugin?
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pahe, there is no such thing as Clips on Android at this time.
     
  40. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @prime31

    Heya Prime.. quick q on the Amazon IAP. Is there anyway within the plugin to link directly to the app in the Amazon app store? Right now i'm just directly going to the app store through a web browser but was wondering if there was any support for the deep linking stuff listed on their site?
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bpritchard, you can most likely just use Application.OpenURL but you would need to check to see what Amazon's App Store url schemes are.
     
  42. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    That was it. I was using EceteraAndroid's web browser and it wasn't loading up the store properly. Very good, thanks for the pointer!
     
  43. Keryu

    Keryu

    Joined:
    Aug 24, 2010
    Posts:
    13
    @Prime31, I've been toying around with the AmazonIAP plugin. Integration was seamless and easy! I may be confusing myself a little on the flow of purchasing an item. Currently, I call initiateItemDataRequest() first, passing in an array of my product IDs. Then, when itemDataRequestFinishedEvent() returns, I attempt to purchase a product that is returned as an availableItem.

    However, in my tests, neither itemDataRequestFinishedEvent() nor itemDataRequestFailedEvent() seem to call. I see that onSdkAvailableEvent() is returning that test mode is true, but that's where the execution stops.

    Are there any criteria that determines your app is in "test mode"? Is the AmazonSDKTester required to have those itemDataRequests fail or finish? I thought that having Development Build true in my settings may have caused the app to be in test mode, but changing the setting seemed to have no effect. I have not yet installed the AmazonSDKTester.apk on my device, but was hoping I could see the flow of purchasing a product if I could force my app to not be in test mode.
     
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Keryu, the AmazonSDKTester is absolutely required. It is used to configure which response you should receive allowing you to test failed and successful purchases and any other available responses. Unity's development build setting has absolutely nothing to do with what happens in native code.
     
  45. Keryu

    Keryu

    Joined:
    Aug 24, 2010
    Posts:
    13
    @Prime31, the quick response is appreciated, as always! I didn't realize the AmazonSDKTester was absolutely required.
     
  46. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    @Prime31

    On that same thread.. i wanted to say outstanding job w/the Amazon IAP! We're 98% up and running! :) Just one quick question... whats the best way to check for previous purchases, or moreover which method is the one to use if we're not looking for any user interaction (aka first launch).
     
  47. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bpritchard, previous purchase checking is all handled for you. If you listen to the purchaseUpdatesRequestSuccessfulEvent it will return any previously purchased items. You will want to store that data either on your server or locally somewhere so that you know what the user has purchased.
     
  48. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Ahh so its not a simple as the Google IAP? When you say store locally does that mean we basically need to store the data in a separate location from the application since the application can be uninstalled and all relevant data uninstalled w/it?
     
  49. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bpritchard, in the app is fine. If they uninstall the purchases will again be restored on the first launch after reinstallation.
     
  50. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    ok i see.. looking at their documentation they don't make that very clear. Essentially then on first launch i can run my purchase update event, check for previous purchases by name or key i assume and then unlock there... seems simple enough. :)