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

Prime31 Android Plugins Officially Live!

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

  1. iRetrograde

    iRetrograde

    Joined:
    Oct 13, 2011
    Posts:
    93
    Hey Prime, thanks for the reply.
     
  2. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    @Prime31,

    Regarding Etcetera Android, would it possible update showAlert with 2+ button support? Similar to recent iOS update you did. Btw, thanks again for it!
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pixel, we'll look into adding it in the next update.
     
  4. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    That would be perfect, thanks!
     
  5. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    I had an android app that is using the Etc plugin, now i'm trying to add the admob plugin, first it built but didn't have internet access in the manifest, so I used the prime31 to build the android manifest, and now unity fails to build, with:
    Installation failed with the following output:
    pkg: /data/local/tmp/Package.apk
    Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

    The AndroidManifest is as follows:
    Code (csharp):
    1.  
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <manifest
    4.     xmlns:android="http://schemas.android.com/apk/res/android"
    5.     package="com.unity3d.player"
    6.     android:installLocation="preferExternal"
    7.     android:versionCode="1"
    8.     android:versionName="1.0">
    9.     <supports-screens
    10.         android:smallScreens="true"
    11.         android:normalScreens="true"
    12.         android:largeScreens="true"
    13.         android:xlargeScreens="true"
    14.         android:anyDensity="true"/>
    15.  
    16.     <application
    17.         android:icon="@drawable/app_icon"
    18.         android:label="@string/app_name"
    19.         android:debuggable="true">
    20.         <activity android:name="com.unity3d.player.UnityPlayerActivity"
    21.                   android:label="@string/app_name"
    22.                   android:configChanges="keyboard|keyboardHidden|orientation">
    23.                 <intent-filter>
    24.                     <action android:name="android.intent.action.MAIN" />
    25.                     <category android:name="android.intent.category.LAUNCHER" />
    26.                 </intent-filter>
    27.         </activity>
    28.         <activity android:name="com.unity3d.player.VideoPlayer"
    29.                   android:label="@string/app_name"
    30.                   android:configChanges="keyboard|keyboardHidden|orientation">
    31.         </activity>
    32.  
    33.  
    34.             <!-- ACTIVITIES -->
    35.         <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/>
    36.         <activity android:name="com.prime31.EtceteraProxyActivity"></activity>
    37.         <activity android:name="com.prime31.WebViewActivity" android:configChanges="orientation"></activity>
    38.         <activity android:name="com.prime31.P31VideoPlayerActivity" android:configChanges="keyboard|keyboardHidden|orientation"></activity>
    39.         <receiver android:name="com.urbanairship.CoreReceiver">
    40.             <intent-filter>
    41.               <action android:name="android.intent.action.BOOT_COMPLETED" />
    42.               <action android:name="android.intent.action.ACTION_SHUTDOWN" />
    43.             </intent-filter>
    44.         </receiver>
    45.        
    46.         <receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
    47.           <intent-filter>
    48.               <action android:name="com.google.android.c2dm.intent.RECEIVE" />
    49.               <category android:name="CURRENT_PACKAGE_NAME" />
    50.           </intent-filter>
    51.           <intent-filter>
    52.               <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    53.               <category android:name="CURRENT_PACKAGE_NAME" />
    54.           </intent-filter>
    55.         </receiver>
    56.         <service android:name="com.urbanairship.push.PushService" android:process=":com.urbanairship.push.process"/>
    57.  
    58.             <!-- META-DATA -->
    59.  
    60.         </application>
    61.  
    62.         <!-- PERMISSIONS -->
    63.     <uses-permission android:name="android.permission.INTERNET" />
    64.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    65.     <receiver android:name="com.google.ads.InstallReceiver" android:exported="true">
    66.         <intent-filter>
    67.             <action android:name="com.android.vending.INSTALL_REFERRER" />  
    68.         </intent-filter>
    69.     </receiver>
    70.     <uses-permission android:name="android.permission.INTERNET"/>
    71.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    72.     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    73.     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    74.     <uses-permission android:name="android.permission.VIBRATE"/>
    75.     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    76.    
    77.     <permission android:name="CURRENT_PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    78.     <uses-permission android:name="CURRENT_PACKAGE_NAME.permission.C2D_MESSAGE" />
    79.     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    80. <!-- FIND-REPLACE -->
    81.     <fr><find><![CDATA[<application]]></find><replace><![CDATA[$1 android:name="com.prime31.EtceteraApplication"]]></replace></fr>
    82.     <fr><find><![CDATA[ForwardNativeEventsToDalvik" android:value="false" />]]></find><replace><![CDATA[ForwardNativeEventsToDalvik" android:value="true" />]]></replace></fr>
    83. </manifest>
    84.  
    Am I supposed to type things in CURRENT_PACKAGE_NAME etc, or does that happen automatically? And if it is automatic what could be causing the malformed manifest?
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sol, it looks like you have an old version of the build system. Use the "update..." Menu item in the prime31 menu to get the latest then rebuild your manifest.
     
  7. SolInvictus212

    SolInvictus212

    Joined:
    Aug 10, 2011
    Posts:
    50
    Ha! It worked, thanks, I hadn't even noticed the Update option. Very convenient, this is why you're the best ;)
     
  8. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    @Mike,

    I'm not sure if it's me or that's a bug but here is the deal. I'm trying to use Etcetera + Amazon IAP in the following way:

    - showProgressDialog, Please wait
    - initiateItemDataRequest
    - initiatePurchaseReqeust
    - hideProgressDialog when IAP success/fail/cancel/etc

    That last step is not working. If there is an active progress dialog when IAP is launched (amazon's tester that is) app get's stuck at this point. When I return the app I just see the progress dialog, since IAP events are not called dialog is not hidden.

    Also in that situation, if I go to home screen and launch the app, I get purchase failed event right upon startup which is expected since it thinks IAP never completed...

    My current workaround is hiding the dialog before calling the purchase request. That somewhat provides the flow I wanted...

    - showProgressDialog, Please wait
    - initiateItemDataRequest
    - hideProgressDialog
    - initiatePurchaseReqeust

    So, is this a bug or me? :)
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pixel, Amazon uses their own Activity so the old one get removed along with the reference to the progress dialog. removing it before initiating the purchase should do the trick.
     
  10. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Gotcha! Thx...
     
  11. Grasshorse

    Grasshorse

    Joined:
    Jan 6, 2012
    Posts:
    3
    Hi Prime31,

    Great Plugins. I've got the Facebook, Admob and Etcetera plugins for Android. I have been searching to see if there is a way to customize the pop up menus. I would like to change out the background, font and put button textures in there. I've been tweaking the default GUI.skin "window" properties, with no results. Any tips on how to do that?

    Best,

    Steve
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Grass, I am not sure what popup menus you are referring to. If you are referring to the Etcetera prompts and other GUI features they are displayed in whatever flavor of Android is on the device. If you are referring to Unity's built in GUI please post in the appropriate forum.
     
  13. Grasshorse

    Grasshorse

    Joined:
    Jan 6, 2012
    Posts:
    3
    Thanks for the quick answer Prime31. I was indeed referring to the Etcetera Prompts. I understand now that they are not using the GUI.Window system, but the internal Android Device's Window system.

    Thanks!
    Steve
     
  14. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Is the one after todays? Not to rush but just trying to figure out if I should hold an update release a bit longer or not...
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pixel, the update for today was bug fixes for Urban Airship only.
     
  16. Byrondinho

    Byrondinho

    Joined:
    Jul 26, 2011
    Posts:
    19
    SOLVED
    -------------
    Hi Prime31,
    I have the same problem that other users with In-App Billing like flamy, cant shop my product items for check them.
    I followed the following steps:
    - Tested Ok with testPurchaseProduct
    - Added one test account in Google Play.
    - APK uploaded in Google Play.
    - I have the Keystore setup and Android Market Licensing (LVL) public key copied from Android Market.
    - Product item Published and using the ID in purchaseProduct( id )
    - Android device using test account like main.

    When i tried to call purchase product it says item unavailable, but the titles i gave for the product is there in the top of the purchase screen.
    Some help plz.

    EDITED:
    Now it works, had to wait a while to put an google it working.
    Another question:
    How do I check all purchases made ​​by the user?
    SOLVED TOO:
    1- Launch restoreTransactions() at the start of App
    2 - Later Listener purchaseSucceededEvent is Fired.
     
    Last edited: Jun 15, 2012
  17. will_jones

    will_jones

    Joined:
    Dec 20, 2011
    Posts:
    80
    I've got an issue with Android Etcetera using Play Video method on a youtube video url, nothing's showing up at all and YouTube video's don't work in WebView either.

    Similar problem as Lukas earlier.
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @wdj, playMovie requires a URL to an actual video file. A YouTube link is not a link to a video file. The web view requires you to write a proper HTML wrapper to play YouTube videos. You will have to use Google to get the details.
     
  19. Byrondinho

    Byrondinho

    Joined:
    Jul 26, 2011
    Posts:
    19
    Hi Prime31,
    Every time I start the application run "IABAndroid.restoreTransactions ()" but do not know if this is correct. Google is sending me "RestoreTransactions: RESULT_SERVICE_UNAVAILABLE" and as I have read is from overuse ( the game hasnt been published , is this ? ).
    I keep the result of "restoreTransactions" in an XML but use it only when the user does not have internet to prevent piracy.
    Any advice?

    Regards.
     
  20. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @byron, you should restore transactions only one time: the first time the app is launched. The method call requires internet access or else how would it retrieved the transactions?
     
  21. Byrondinho

    Byrondinho

    Joined:
    Jul 26, 2011
    Posts:
    19
    Hi Prime31,
    Each time you launch the application, ok. With the xml I meant that the user has bought something, be saved in an XML and if the user dont have internet can play with their purchases enabled .
    Thx for the support.
     
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @byron, I think you are asking about previous purchases on subsequent launches. If so, you need to store records of any purchases yourself. Neither the plugin nor Google will store that for you.
     
  23. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    I'm having an issue with the showWebView method, I'm getting an ANR ( Application Not Responding ) from the debug output and the users are getting the same message in a native message, asking to either force close or wait. When you wait for the application to respond and go back from the web view, it's completely fine and it doesn't crash. Here's some debug output:

    D/InputDispatcher( 1389): channel '408616e0 com.company.appname/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Synthesized 1 cancelation events to bring channel back in sync with reality: application not responding, options=0.
    I/InputDispatcher( 1389): Dropping event because the pointer is not down.
    I/InputDispatcher( 1389): Dropping event because the pointer is not down.
    E/ActivityManager( 1389): ANR in com.company.appname (com.company.appname/com.unity3d.player.UnityPlayerNativeActivity)
    E/ActivityManager( 1389): Reason: keyDispatchingTimedOut

    I'm not quite sure what's going on. Searching for the ANR Reason, here is what a website said:

    The solution is to run resource-expensive tasks on another thread, and then post, or update the main thread accordingly. A common use for this is network calls
     
  24. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @danny, that appears to be an issue with Unity. The web view is a totally separate Activity and from the looks of that log the Unity activity might not be pausing correctly.
     
  25. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    Are you calling Unity thread to pause yourself with your etcetera plugin? What you said makes sense, and here is another line earlier in the debug output:

    I/InputDispatcher( 1389): Application is not responding: Window{408616e0 com.company.appname/com.unity3d.player.UnityPlayerNativeActivity paused=false}. 5130.5ms since event, 5007.5ms since wait started

    So obviously, paused = false, but I don't have any control of that. Sometimes this error comes up, sometimes it doesn't when loading a webView from the etcetera plug-in.
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @danny, we dont touch Unity at all. All we do is call up a standard Android Activity with the web view. Unity should pause itself when it is no longer the active Activity.
     
  27. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    Alright, well I guess i'll submit a bug... Showing the webview is useless for me with this crash,... not of course saying it's anyone's fault but Unity's if this is the case.
     
  28. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Last edited: Jun 19, 2012
  29. Iamdain

    Iamdain

    Joined:
    Feb 3, 2010
    Posts:
    90
    Hi Prime31,

    I'm having a strange issue with the EtceteraManager.textureFromFileAtPath method.

    I call OpenCamera which triggers ImagePickerChooseImage which runs:

    Code (csharp):
    1.  
    2.     void imagePickerChoseImage( string imagePath )
    3.     {
    4.             applyImage(imagePath);
    5.     }
    6.  
    7.     public void applyImage(string imagePath)
    8.     {
    9.         StartCoroutine( EtceteraManager.textureFromFileAtPath( "file://" + imagePath, textureLoaded, textureLoadFailed ) );
    10.     }
    The retrieved texture is applied to a material. I then have a button to 'Re-start' the process which calls Application.LoadLevel to re-load the same scene. Upon running through the above process again I get the following error when reaching textureFromFileAtPath:

    Code (csharp):
    1. (Filename: /Applications/buildAgent/work/b0bcff80449a48aa/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 38)
    2.  
    3. NullReferenceException
    4.   at UnityEngine.MonoBehaviour.StartCoroutine (IEnumerator routine) [0x00000] in <filename unknown>:0
    5.   at InstructionsNGUI.applyImage (System.String imagePath) [0x00000] in <filename unknown>:0
    6.   at InstructionsNGUI.imagePickerChoseImage (System.String imagePath) [0x00000] in <filename unknown>:0
    7.   at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    8.   at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    9.   at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    10.   at EtceteraManager.imageSavedToDocuments (System.String filePath) [0x00000] in <filename unknown>:0
    11.  
    12. (Filename:  Line: -1)
    If I just run this entire process again WITHOUT reloading the scene it works correctly. Is there something that needs to be initialised / de-initialised in leaving and / or re-entering the scene?

    Thanks,
    O
     
  30. ExkeeDev

    ExkeeDev

    Joined:
    Jun 23, 2011
    Posts:
    6
    Hi lukas,

    I don't know if it will help you, but have you made an html wrapper (as advised by Mike) before trying to play youtube video on a webview ?
    If you don't you won't be able to play the video. If you have, good luck with your bug.
     
  31. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Yep, its just a website with an embedded youtube video. I'm not trying to stream the youtube video directly or something.
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @lukas, we have not been able to get a black screen with the error you are getting yet


    @oddap, the plugin doesn't store any state information at all. Are you sure the imagePath has a string value and not null? That appears to be what the issue is. It also seems from the stack trace that an NGUI button is calling the event handler instead of the event itself.
     
  33. Matkins

    Matkins

    Joined:
    Aug 24, 2009
    Posts:
    152
    Hey Prime,

    We have nearly got our app featured on the Google Play store. There are just a few little things that they want us to fix and something that they want us to clarify for them.

    Anyway, they want clarification for why there is a permission to "automatically start at boot"... now i've looked in the manifest and the only thing i can see that comes close in the permissions is "android.permission.RECEIVE_BOOT_COMPLETED". I'll need to get clarification that this is what they're talking about, but presumably this permission has been put in by one of your plugins, i could be wrong of course.

    The android plugins we use of yours are: IAB, Social Network, Flurry, Etcetera.

    Any light you can shed on it would be greatly appreciated.

    Thank you.

    EDIT: And chartboost.
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @matkins, if you arent using Urban Airship via the Etcetera Plugin you can remove the permission.
     
  35. Matkins

    Matkins

    Joined:
    Aug 24, 2009
    Posts:
    152
    @prime, thank you.
     
  36. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    We use the Chartboost android plugin. Whenever a chartboost AD pop up, it comes with a completely black background, instead of a semi-transparent one. It seems that the activity underneath the AD stops and its rendering stop as well. Could you give us advice on this?
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @akwok, that is how ChartBoosts SDK works: it shows ads in a new Activity.
     
  38. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    Thanks I see, however I observe the Chartboost AD on others' Android app is having a semi-transparent background, not a completely black one like mine. Is there anything I can do with it?
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @akwok, your creatives are setup in the ChartBoost web portal. Please consult ChartBoost's documentation for more information. Out plugin merely makes ChartBoost available to Unity. We do not modify their code in any way.
     
  40. junglemason

    junglemason

    Joined:
    Dec 30, 2010
    Posts:
    69
    @Prime31 can the Amazon IAP API be tested on non-Kindle devices or is a Kindle required?
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jungle, it will work on any device as long as the app is sold via Amazon's marketplace.
     
  42. junglemason

    junglemason

    Joined:
    Dec 30, 2010
    Posts:
    69
    @Prime31 Shoot. I tried on a Fire as well as an Evo. I can only get the onSdkAvailableEvent to fire, and I can't get the purchaseSuccessfulEvent or purchaseFailedEvent to fire after I've successfully purchased a test product. Don't know what to try next. I added debug lines to AmazonIAPManager.purchaseFailed() and that doesn't seem to be getting called either.
     
  43. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jungle, refer to Amazon's documentation for the proper way to setup your JSON file and their AmazonSDKTester.apk app. They are used to "fake" responses while testing an unreleased app.
     
  44. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    until today, I was able to build run my project perfectly for android platform, but now, I don't know why, I get this error :
    Any idea?
     
  45. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @risine, did you try regenerating the AndroidManifest? The error seems to indicate the second line of the manifest has some invalid declaration.
     
  46. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    Hi Prime,

    yes I did it. with no success.
    I looked at the line ( don't have the file in front of me now unfortunately ), and there does not seem to be anything wrong.
    I'm using a few of your plugins : social network, appbill, etcetera.
     
  47. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @risine, if you send over the first few lines we should be able to identify what it is.
     
  48. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    Thanks, I'll send you that tomorrow.
     
  49. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    Here we go, the manifest file :
    1/
    I tried with a few days old version of my project, and I have no pb building for Android.
    I checked the differences between the 2 projects, and folders files inside assets/editor and assets/plugins are strictly identical.
    That's just nonsense.

    2/
    I tried to reimport all, no success.
     
    Last edited: Jun 22, 2012
  50. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    ok, I found it. For those who may have the same problem :
    The problematic androidManifest.xml is not the one of the previous reply in assets\plugins\android, but the one in Temp\StagingArea.
    In this xml file, don't know why, my versionName value was something like "1.5%e..." ( don't remember the correct characters ) instead of just "1.5".
    the strange thing there is that despite all my attempts, and the multiple generations of androidmanifest.xml, this one was never modified apparently.