Search Unity

uLiveWallpaper - Develop Android Live Wallpapers with Unity!

Discussion in 'Assets and Asset Store' started by ZimM, Dec 20, 2015.

  1. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    I'm not quite sure I understand what you mean. The "PreferenceActivityGameObjectTrigger" script posted above only enables/disables a single object. So what list are you talking about? And what "another" list?
     
  2. 1skription

    1skription

    Joined:
    May 28, 2014
    Posts:
    7
    Hi Zim,

    I'm talking about android studio list ( pref list, etc... ), i think it's a wrong way.

    You said this script is only for one object, can you add one with the possibility to choose from multiple object please or give us how to do that. I'm sure this help a looooooooot of people. ;) ;) ;)

    Thank you for your help !
     
    Last edited: Oct 4, 2016
    ArthurUS83 likes this.
  3. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
    That will be great........ Will be very helpful :)
     
    Last edited: Oct 5, 2016
  4. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @1skription
    @ArthurUS83
    Really guys, that script is just an example thrown together in 1 minute without even testing it :) At least basic C# knowledge is a requirement to use uLiveWallpaper (or, well, Unity). Or, you might want to use the built-in PlayMaker integration, if you are into that.
    But anyway, here's the improved version of the script that allows to control an array of GameObject or even other script:
    Code (CSharp):
    1.  
    2. public class PreferenceActivityObjectTrigger : MonoBehaviour {
    3.     [SerializeField]
    4.     private Behaviour[] _controlledBehaviours;
    5.  
    6.     [SerializeField]
    7.     private GameObject[] _controlledGameObjects;
    8.  
    9.     private void OnEnable() {
    10.         LiveWallpaper.PreferenceActivityTriggered += LiveWallpaperOnPreferenceActivityTriggered;
    11.     }
    12.  
    13.     private void OnDisable() {
    14.         LiveWallpaper.PreferenceActivityTriggered -= LiveWallpaperOnPreferenceActivityTriggered;
    15.     }
    16.  
    17.     private void LiveWallpaperOnPreferenceActivityTriggered() {
    18.         for (int i = 0; i < _controlledBehaviours.Length; i++) {
    19.             Behaviour controlledBehaviour = _controlledBehaviours[i];
    20.             if (controlledBehaviour == null)
    21.                 continue;
    22.  
    23.             controlledBehaviour.enabled = !controlledBehaviour.enabled;
    24.         }
    25.  
    26.         for (int i = 0; i < _controlledGameObjects.Length; i++) {
    27.             GameObject controlledGameObject = _controlledGameObjects[i];
    28.             if (controlledGameObject == null)
    29.                 return;
    30.  
    31.             controlledGameObject.SetActive(controlledGameObject.activeSelf);
    32.         }
    33.     }
    34. }
    35.  
     
  5. 1skription

    1skription

    Joined:
    May 28, 2014
    Posts:
    7
    Thank you very much ZIM !:):):):):), for you it's about 1 minute to do that, for us it's about 1 year !
     
  6. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    Hi Zimm, thank you for making this plugin and being active in the forum. I need help,though. I want to change the public variables within a Unity script after its exported to Android Studio using Java. For Example, I have a flower created in Unity.It has a public Variable that holds an INT for the size of the flower. Now I exported this using ulivewallpaper to android studio. Inside Android Studio I want to edit the preference menu so it will change the Public variable within
    Unity.How would I do that?I been searching and cant find the answer.
     
  7. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    Hi,

    I've been struggling for the past few days to setup AdMob with Mediation running. I managed to show Interstitial ads, and I thought that banner ads would be simpler, but no! They are more complicated!

    With Interstitials I placed the relevant example code inside the
    SettingsActivity and it it worked fine. I didn't even call MobileAds.initialize(), as there was no mention of this in the examples, and I started getting Interstitials.

    By following the examples for Banner ads, I soon realized that there is no official documentation for adding banner ads to live wallpapers. The official examples refer to adding banner ads in the MainActivity, which uses the relevant layout activity_main.xml.

    The problem is that you cannot add the code that you add in activity_main.xml, per the official examples, into preferences.xml.

    I found a workaround in stackoverflow:

    http://stackoverflow.com/questions/...w-in-the-settings-screen-for-a-live-wallpaper

    However, this uses LinearLayout, whereas official documentation uses RelativeLayout for banner ads, and I'm unsure on the proper usage.

    Additionally, we have to initialize the Mobile ads SDK. In accordance with the official documentation:

    "To initialize the Google Mobile Ads SDK at app launch, call MobileAds.initialize() in the onCreate() method of the MainActivity class."

    "Initializing the Google Mobile Ads SDK at app launch allows the SDK to fetch app-level settings and perform configuration tasks as early as possible, which can help reduce latency for the initial ad request."

    "public static void initialize (Context context, String applicationCode)

    Initialize the Mobile Ads SDK. The SDK will configure itself.

    This method should be called as early as possible, and only once per application launch."

    So, where do we have to call MobileAds.initialize() for a Live Wallpaper, so that it's only called once per application launch? i.e. should we consider LiveWallpaperService or SettingsActivity as "the application", and how do we make sure that it's only called once?

    For example, if we call it inside SettingsActivity.onCreate() and the user goes in and out of Settings multiple times, then MobileAds.initialize() will also be called multiple times, not once.

    Additionally, I'm not sure why the official examples don't mention at all calling MobileAds.initialize() for Interstitial ads, which I do find odd, but it works.

    Lastly, I have some undesirable behavior with the Interstitial ads. After the Interstitial is closed by the user, the Settings screen closes, and the Home Screen is shown. It seems that this is due to the finish() inside onPause() in the SettingsActivity.

    Is there a way around this? I prefer for the user to return to the Settings screen after closing the Interstitial, to make it possible to change multiple settings, before going to the Home screen.

    Although I respect ZimM's argument in other posts, that adding ads to the LWP is quite different from the task of creating a Live Wallpaper, and that ads don't work very well for LWPs, I think it will be very useful for many users, if a simple tutorial was available, especially because there is no OFFICIAL documentation on the subject for LWPs.

    Without such a tutorial someone would need to become very familiar with coding in Android, and even then, not all problems would be solved.
     
  8. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    Since I have not received any response to my previous post for so many days, it seems reasonable to assume that this product is not supported. This is a petty, because the product itself is of high quality, but it becomes almost unusable without good support.
     
  9. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Sorry for making you think this product is not supported, as it's definitely not the case. I am on a trip, and will only return tomorrow. It is not possible for me to investigate such a broad question from my mobile phone and give a definitive answer, especially on the forum. I'll do some research as soon as I'll be back. For the future - if you want some quick response, contact via email.
    For now I'll just say that the biggest reason I'm not that fond of the idea about providing a tutorial for ad integration is that, well, everyone needs different things, and there are a lot of advertisement providers - Google AdMob, Facebook App Ads, Unity Ads, you name it. I can't possibly make tutorials to cover all possible cases - that might be a whole project on its own, barely relevant to the plugin itself. So at the moment the assumption is that you must know Android SDK if you want to implement any custom stuff like advertisements.
    However, I guess it won't be a bad idea to make a tutorial for Google AdMob as an example of "this can be done". So that is what I will be doing.
     
  10. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    This is good news! I had lost hope that I'd be getting a response. I have purchased many assets from the Asset Store over the years and typically, if I don't get a response to a support question within a day or two, I start worrying. I guess I should have used e-mail.

    After my post I tried for 2 more days to get the banner working with no success. I tried every possible solution I found on stackoverflow. All solutions were basically a different version of the same thing: Create a custom preference "AdmobPreference" and just add it to preferences.xml. I managed to display a banner in Settings by using a combination of the stackoverflow solutions and a tutorial I had from good' ol Uni2LWP last Wednesday night. While I thought I nailed it, strangely enough, it wasn't working any more when I fired up Android Studio Thursday morning... ...just after I had allowed the latest Android Studio Update to install... (or was it something else?)

    Of course you don't have to cover all possible ad networks! In my opinion AdMob is enough. You are the expert in Android programming, and it will make the life easier for many developers who are not. Speaking for myself, I am not an expert with Android SDK. I am very experienced with C#, not very experienced with Java, and "flying blind" with Android SDK, with which I took some methodical baby steps this past week, in order to try to solve this problem. I have a feeling that many other live wallpaper developers using this plugin are in more or less the same situation as I am. Hence the need for a tutorial.

    Lastly, I have 2 live wallpapers ready to publish with interstitials, and I would really appreciate some quick guidance, if possible, on the following part of my post:

    QUOTE
    So, where do we have to call MobileAds.initialize() for a Live Wallpaper, so that it's only called once per application launch? i.e. should we consider LiveWallpaperService or SettingsActivity as "the application", and how do we make sure that it's only called once?

    Lastly, I have some undesirable behavior with the Interstitial ads. After the Interstitial is closed by the user, the Settings screen closes, and the Home Screen is shown. It seems that this is due to the finish() inside onPause() in the SettingsActivity.

    Is there a way around this? I prefer for the user to return to the Settings screen after closing the Interstitial, to make it possible to change multiple settings, before going to the Home screen.

    UNQUOTE

    Thank you in Advance!
     
  11. Andre555544445555

    Andre555544445555

    Joined:
    Jul 27, 2016
    Posts:
    4
    Hello!
    I have six android devices. demo "virtual box" normal worked on the three devices. but other three devices battery quickly discharged!! ( when devices off ). help !!
     
  12. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @pako
    While I might know a thing or two about Android SDK, AdMob SDK is not part of it :) And I've never used or integrated any ad network into anything, so it's probably going to be a lot of struggle for me as well...
    I'm not sure, but from the sounds of it, you can just put a public static boolean variable, that you can set to "true" when calling MobileAds.initialize() and then checking it's value if needed. The only thing that matters is that this method gets called as early as possible.
    Well, just remove the finish() inside onPause() in the SettingsActivity, and it should be fine. The SettingsActivity that uLiveWallpaper generates is just an example for you to modify and expand, not a definitive solution that covers all cases.
    Please see the included VirtualBox demo scene. "VirtualBox_Android_Studio.zip" also contains the corresponding Android Studio. Basically, you must edit "app\src\main\res\xml\preferences.xml" file in your Android Studio project, and then use LiveWallpaper.Preferences class to read your values, and LiveWallpaper.PreferenceChanged event to get notified about preference changes.
    Hi. How can I help you if you haven't provided any information? I am not a telepathist, unfortunately...
    What are your devices? What Android OS version do they have? Do you have any strong evidence that it is the wallpaper that drained the battery, and not something else?
    The only thing comes to my mind, is an issue with MIUI devices, basically, the Android there is broken and doesn't reports some live wallpaper events correctly. But that was a while ago, and I've already implemented a workaround.
     
    pako likes this.
  13. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    @ZimM Thank you for your response!
     
  14. pako

    pako

    Joined:
    Nov 21, 2012
    Posts:
    111
    I published two live wallpapers a couple of days ago and got some crashes. I wonder if others are having similar issues, and if there is something I can do about these. The stack traces are almost the same:

    Live Wallpaper 1:

    java.lang.NullPointerException
    at com.lostpolygon.unity.livewallpaper.UnityWallpaperService$UnityWallpaperEngine.onDestroy(Unknown Source)
    at android.service.wallpaper.WallpaperService$Engine.detach(WallpaperService.java:926)
    at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1051)
    at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:40)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5692)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)
    -----------------------------------------------

    Live Wallpaper 2:

    java.lang.NullPointerException
    at com.lostpolygon.unity.livewallpaper.UnityWallpaperService$UnityWallpaperEngine.onDestroy(Unknown Source)
    at android.service.wallpaper.WallpaperService$Engine.detach(WallpaperService.java:975)
    at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:1106)
    at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:40)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5299)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
    at dalvik.system.NativeStart.main(Native Method)
     
    Last edited: Oct 21, 2016
  15. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    Hey Zimm, Thank you for the reply. There seem to be a bug that I cant figure out. I selected the wallpaper and set it. I then open my music app from the homescreen with the livewallpaper active. The music app plays but as soon as I leave it, it shuts down, not allowing me to play music in the background. I have tested it many times, and its caused by the Wallpaper. Without the wallpaper the music works. What is it that could be causing music from being played in the background?Could it be taking too much resources from the phone?
     
  16. Breathtaker

    Breathtaker

    Joined:
    May 21, 2015
    Posts:
    22
    Workaround and Reason in Message #327
    Maybe fixed in new Unity versions.
     
  17. Mebsoftware

    Mebsoftware

    Joined:
    Dec 21, 2015
    Posts:
    13
    Hi Zimm. I want the button to open after clicking on the website. so I tried but I could not. I opened the manifest file internet access. Can you help?
     
    Last edited: Oct 26, 2016
  18. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    OMG i feel like such a noob, Thanks Zimm I found the answers to all my questions in the package examples and demos. Now i can make some amazing wallpapers!
     
  19. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Interesting. I honestly have no idea how can there be a NullPointerException there, but without a way to reproduce this crash I can't do much. I'll try to add some safeguards for the next release.
    If you are trying to use the standard Application.OpenURL(), then it won't work. Try this method instead:
    Code (CSharp):
    1.         public static void OpenURL(string url) {
    2.             if (String.IsNullOrEmpty(url))
    3.                 throw new ArgumentNullException("url");
    4.  
    5. #if UNITY_EDITOR
    6.             Application.OpenURL(url);
    7. #else
    8.             if (!_isFacadeObjectAvailable)
    9.                 return;
    10.  
    11.             Debug.LogFormat("Attempting to open URL '{0}'", url);
    12.  
    13.             const string ACTION_VIEW = "android.intent.action.VIEW";
    14.             const int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
    15.             using (AndroidJavaObject context = GetApplicationContext()) {
    16.                 using (AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri")) {
    17.                     using (AndroidJavaObject uriUrl = uriClass.CallStatic<AndroidJavaObject>("parse", url)) {
    18.                         using (AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", ACTION_VIEW, uriUrl)) {
    19.                             intent.Call<AndroidJavaObject>("setFlags", FLAG_ACTIVITY_NEW_TASK);
    20.                             context.Call("startActivity", intent);
    21.                         }
    22.                     }
    23.                 }
    24.             }
    25.  
    26.             /*
    27.  
    28.             // Equivalent Java code
    29.             Uri uriUrl = Uri.parse( url );
    30.             Intent myIntent = new Intent(Intent.ACTION_VIEW, uriUrl);
    31.             myIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
    32.             startActivity( myIntent );
    33.  
    34.             */
    35. #endif
    36.         }

    Heh, you're welcome! :D
     
  20. Mebsoftware

    Mebsoftware

    Joined:
    Dec 21, 2015
    Posts:
    13

    Hi Zimm. I tried the code you gave above, but you can not update project.
    unity console gives the following error. :
    * Error building Player because scripts had compiler errors
    * Assets/playstore.cs(28,52): error CS0103: The name `GetApplicationContext' does not exist in the current context
    * Assets/playstore.cs(21,22): error CS0103: The name `_isFacadeObjectAvailable' does not exist in the current context

    I made the C# script below:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System;
    4.  
    5. namespace LostPolygon.uLiveWallpaper.Demos {
    6. public class playstore : MonoBehaviour {
    7.  
    8.    
    9.     void Start () {
    10.             OpenURL ("www.google.com");
    11.     }
    12.  
    13.  
    14.     public static void OpenURL(string url) {
    15.         if (String.IsNullOrEmpty(url))
    16.             throw new ArgumentNullException("url");
    17.  
    18.         #if UNITY_EDITOR
    19.         Application.OpenURL(url);
    20.         #else
    21.         if (!_isFacadeObjectAvailable)
    22.         return;
    23.  
    24.         Debug.LogFormat("Attempting to open URL '{0}'", url);
    25.  
    26.         const string ACTION_VIEW = "android.intent.action.VIEW";
    27.         const int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
    28.         using (AndroidJavaObject context = GetApplicationContext()) {
    29.         using (AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri")) {
    30.         using (AndroidJavaObject uriUrl = uriClass.CallStatic<AndroidJavaObject>("parse", url)) {
    31.         using (AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", ACTION_VIEW, uriUrl)) {
    32.         intent.Call<AndroidJavaObject>("setFlags", FLAG_ACTIVITY_NEW_TASK);
    33.         context.Call("startActivity", intent);
    34.         }
    35.         }
    36.         }
    37.         }
    38.  
    39.         /*
    40.  
    41.         // Equivalent Java code
    42.         Uri uriUrl = Uri.parse( url );
    43.         Intent myIntent = new Intent(Intent.ACTION_VIEW, uriUrl);
    44.         myIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
    45.         startActivity( myIntent );
    46.  
    47.         */
    48.         #endif
    49.     }
    50.  
    51.  
    52.  
    53.  
    54.  
    55.  
    56.  
    57.  
    58.  
    59.  
    60.     // Update is called once per frame
    61.     void Update () {
    62.    
    63.     }
    64. }
    65. }
    Thank you in advance for your help.
     
    Last edited: Oct 30, 2016
  21. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    Im glad we are on this subject, just ran into this problem .Why wont Application.OpenUrl() work?I hope you guys can come up with a solid solution.
     
  22. maxnoru

    maxnoru

    Joined:
    Sep 26, 2015
    Posts:
    2
    Hi, ZimM i have an interesting bug (or not a bug). Few days ago, i think after Android Studio updated, i've several strings in AndroidManifest.xml appears after i connect LP_uLiveWallpaper module and gradle rebuilds the project.

    Code (JavaScript):
    1. <activity
    2.             android:name="com.lostpolygon.unity.androidintegration.UnityPlayerInstantiatorActivity"
    3.             android:configChanges="mcc|mnc|locale|touchscreen|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"
    4.             android:excludeFromRecents="true"
    5.             android:label=""
    6.             android:launchMode="singleInstance"
    7.             android:theme="@style/uLiveWallpaper.Translucent" />
    8.         <activity
    9.             android:name="com.lostpolygon.unity.livewallpaper.activities.StartWallpaperPreviewActivity"
    10.             android:configChanges="mcc|mnc|locale|touchscreen|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"
    11.             android:excludeFromRecents="true"
    12.             android:label=""
    13.             android:theme="@android:style/Theme.NoDisplay" />
    14.     </application>
    I still can run project on android device, but manifest file always have highlighted strings with "Attribute ... is not allowed here".
     
  23. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    @Mebans
    @Tonismo
    Try this:
    Code (CSharp):
    1.         public static void OpenURL(string url) {
    2.             if (String.IsNullOrEmpty(url))
    3.                 throw new ArgumentNullException("url");
    4.  
    5. #if UNITY_EDITOR
    6.             Application.OpenURL(url);
    7. #else
    8.             Debug.LogFormat("Attempting to open URL '{0}'", url);
    9.  
    10.             const string ACTION_VIEW = "android.intent.action.VIEW";
    11.             const int FLAG_ACTIVITY_NEW_TASK = 0x10000000;
    12.             using (AndroidJavaObject context = LiveWallpaper.GetApplicationContext()) {
    13.                 using (AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri")) {
    14.                     using (AndroidJavaObject uriUrl = uriClass.CallStatic<AndroidJavaObject>("parse", url)) {
    15.                         using (AndroidJavaObject intent = new AndroidJavaObject("android.content.Intent", ACTION_VIEW, uriUrl)) {
    16.                             intent.Call<AndroidJavaObject>("setFlags", FLAG_ACTIVITY_NEW_TASK);
    17.                             context.Call("startActivity", intent);
    18.                         }
    19.                     }
    20.                 }
    21.             }
    22.  
    23.             /*
    24.  
    25.             // Equivalent Java code
    26.             Uri uriUrl = Uri.parse( url );
    27.             Intent myIntent = new Intent(Intent.ACTION_VIEW, uriUrl);
    28.             myIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
    29.             startActivity( myIntent );
    30.  
    31.             */
    32. #endif
    33.         }
    The reason Application.OpenURL doesn't works is because it uses the current Activity as a context to start the URL Intent, and there is no Activity in a live wallpaper, just a Service.
    Um, which lines are highlighted?.. Anyway, as long as it builds fine - ignore it, it's likely just a minor Android Studio bug.
     
  24. jack021457

    jack021457

    Joined:
    Mar 18, 2015
    Posts:
    22
    Hi, @ZimM
    I used your asset, It's amazing. But I have a question. I want create a select wall paper Scene. Use NGUI and make some button on screen.when I click a button one of the. then open the preview screen. At first it look OK, but when I click back button on the phone bottom. the application was dead. the wallpaper was not live. some minute later it's ANR. Where is wrong.
    11-26 11:13:49.326 18611-18611/com.ulive.wallpaper E/ActivityThread: Activity com.ulive.wallpaper.UnityPlayerActivity has leaked ServiceConnection <native proxy object> that was originally bound here
    android.app.ServiceConnectionLeaked: Activity com.ulive.wallpaper.UnityPlayerActivity has leaked ServiceConnection <native proxy object> that was originally bound here
    at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1092)
    at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:986)
    at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1303)
    at android.app.ContextImpl.bindService(ContextImpl.java:1286)
    at android.content.ContextWrapper.bindService(ContextWrapper.java:604)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.a(Unknown Source)
    at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
     
    Last edited: Nov 24, 2016
  25. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Thanks, I was able to reproduce the issue. I'll see what can be done about this. Looks like a Unity issue at the first glance...
     
  26. badgerCopter

    badgerCopter

    Joined:
    Sep 3, 2015
    Posts:
    6
    ZimM, sorry to bother you with this, but was trying to get Virtual Box Android demo working, but the included Android Studio project won't build (basic project following along with steps in manual worked fine, however). Assume it's some form of silly user error as I'm a complete Android newb. After update, build fails, saying 'VirtualBoxWallpaper\libs\unity-classes.jar' is missing. Wasn't sure if this was something that was supposed to be generated by the plugin or included in zip, but could use some help either way. Thanks!
     
  27. ArturMaciag

    ArturMaciag

    Joined:
    Oct 30, 2010
    Posts:
    4
    Hi, any chances to got it working on Unity 5.5?

    Generate initial project (VirtualBox scene) on 5.5 throws warning:

    Code (csharp):
    1. Assets/uLiveWallpaper/Source/Exposed/WallpaperOffsetEmulatorBase.cs(41,41): warning CS0252: Possible unintended reference comparison. Consider casting the left side expression to type `LostPolygon.uLiveWallpaper.Internal.WallpaperOffsetEmulatorBase<T>' to get value comparison
    and error:

    Code (csharp):
    1. UnityException: Unknown project type: 0
    2. UnityEditor.Android.PostProcessor.Tasks.ExportProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    3. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    4. UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    5. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    6. UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)
    7. UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
    8. LostPolygon.uLiveWallpaper.Editor.BuildPipelineUtilities:BuildAndroidEclipseAdtProject(String, String[], BuildOptions, String, String&) (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/BuildPipeline/BuildPipelineUtilities.cs:31)
    9. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperEclipseAdtProjectBuilder:BuildInitialProject() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/BuildPipeline/LiveWallpaperEclipseAdtProjectBuilder.cs:138)
    10. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperEclipseAdtProjectBuilder:BuildProject() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/BuildPipeline/LiveWallpaperEclipseAdtProjectBuilder.cs:100)
    11. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildGuiUtility:CreateLiveWallpaperProject(ProjectSettingsContainer) (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildGuiUtility.cs:130)
    12. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildWindow:CreateLiveWallpaperProject() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildWindow.cs:647)
    13. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildWindow:DrawCreateProject() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildWindow.cs:324)
    14. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildWindow:DrawContent() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildWindow.cs:68)
    15. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildWindow:DrawGUI() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildWindow.cs:53)
    16. LostPolygon.uLiveWallpaper.Editor.LiveWallpaperBuildWindow:OnGUI() (at G:/PROGRAMMING/Repos/BitBucket/uLiveWallpaper/UnityProject/Assets/uLiveWallpaper/Source/Internals/Editor/LiveWallpaperBuildWindow.cs:41)
    17. UnityEditor.HostView:OnGUI()
     
  28. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    I'll re-check the demo files. Thanks for reporting! Meanwhile, you can just grab that file from "<Unity installation>\Data\PlaybackEngines\AndroidPlayer\Variations\mono\Release\Classes\classes.jar"
    Unity 5.5 support is on its way, should be out in a few days - still got a few unrelated bugs to fix. If you want, you can PM me with your email, and I'll send you the beta with Unity 5.5 support.
     
  29. ethanwgross

    ethanwgross

    Joined:
    Jun 25, 2014
    Posts:
    83
    Just stepped in to say that I really have been enjoying creating live wallpapers with this asset. It has made a lot possible in a simple way. Great job on this.
     
    Last edited: Dec 5, 2016
  30. ethanwgross

    ethanwgross

    Joined:
    Jun 25, 2014
    Posts:
    83
    Just a fyi, the included android studio project of the playmaker uLiveWallpaper demo is throwing exception in latest version of android studio... unless this is my mistake.. in which case I apologize.

    Error:A problem was found with the configuration of task ':app: preparePlayMakerRotatingObjectsLP_uLiveWallpaperUnspecifiedLibrary'.
    > File '/StudioProjects/PlayMakerRotatingObjects/LP_uLiveWallpaper/LP_uLiveWallpaper.aar' specified for property 'bundle' does not exist.
     
    Last edited: Dec 5, 2016
  31. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Thank you!
    Demo Android Studio projects have no Unity content to reduce the download size. As mentioned in the manual:
     
  32. ethanwgross

    ethanwgross

    Joined:
    Jun 25, 2014
    Posts:
    83
    (doh!) ... thanks. must have missed that piece of doc.
     
  33. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Good news everyone!

    uLiveWallpaper 1.4.0 is now live on Asset Store!

    Change log:

    New features
    • Unity 5.5 support.
    • Added LiveWallpaper.OpenURL method as a substitute for Application.OpenURL, since it doesn't work without an Activity.
    • Gradle build system is now used when running on Unity 5.5. No need for an intermediate Eclipse ADT project anymore.
    Improvements and fixes
    • Fixed Unity player hanging when LiveWallpaperCompatibleUnityPlayerActivity was being closed.
    • Fixed a regression that lead to Unity player not pausing when wallpaper went to background on some devices.
    • LiveWallpaperCompatibleUnityPlayerActivity now quits the Unity player if it is not required anymore.
    • Updated .zip Android Studio demo projects to reflect changes in uLiveWallpaper.
    • General fixes and improvements.
     
  34. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    Awesome! thank you for making the OpenUrl easier to use!I found a bug! The uLivewallpaper doesnt export the Icon into Android Studio for some strange reason.I manually have to do it....I thought it was a 5.5 bug ,but when I build just a regular app with Unity3d the Android Icon works fine. Heres my
    Livewallpaper
    https://play.google.com/store/apps/details?id=com.tonismo.flamingskull
     
    Last edited: Dec 8, 2016
    ArthurUS83 likes this.
  35. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
    Very nice done !!!!:) I Like it
     
    Last edited: Dec 8, 2016
  36. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
  37. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,056
    Noob question, can you have ads on live wallpapers, if so how does the user click on them?
     
  38. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I would like to the keep the whole settings aspect of the app inside Unity and I'm going thru the manual under Invisible Self Closing which looks like what I need: "You might want to avoid using native Android Activity for the settings screen, and
    instead implement the settings screen yourself, for example, by using Unity UI. To do that, set “Settings Activity” to “Invisible Self-Closing” and create your project."

    What I don't understand is the "set Settings Activity to Invisible Self Closing". I have no idea where I do this.

    Do you have an example of doing this? I saw some of the example scripts using the LiveWallpaper.PreferenceActivityTriggered event but nothing about the Settings Activity.

    Many Thanks!
     
  39. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
  40. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
  41. rshmel

    rshmel

    Joined:
    Jan 23, 2016
    Posts:
    2
    Code (CSharp):
    1.  private void OnEnable() {
    2.             LiveWallpaper.PreferenceActivityTriggered += Unity_UI_Setting ;// Subscribe to the click event "Setting" button in Preview mode
    3.             LiveWallpaper.CustomEventReceived += LiveWallpaperOnCustomEventReceived;// Subscribe to the  event from uLiveWallpaper UnityActivity (in Adroid Studio UnityPlayerActivity.java)
    4.         }
    5.  
    6. private void OnDisable() {
    7.              LiveWallpaper.PreferenceActivityTriggered -= Unity_UI_Setting; //Unsubscribe from the event
    8.              LiveWallpaper.CustomEventReceived -= LiveWallpaperOnCustomEventReceived;
    9.         }
    10.  
    11. private void Unity_UI_Setting()
    12.         {
    13.             LiveWallpaper.StartActivity (_settingsActivityClassName);   // _settingsActivityClassName  is the full name uLiveWallpaper Unity Activity (like "com.company.productname.UnityPlayerActivity")
    14.         }
    15.  
    16. private void LiveWallpaperOnCustomEventReceived(string eventName, string eventData)
    17.         {
    18.             if (eventName == "UnityActivityOnStart") {   // It occurs when uLiveWallpaper UnityActivity start
    19.                 // Load you GUI
    20.             }
    21.             if (eventName == "UnityActivityOnStop") { // It occurs when uLiveWallpaper UnityActivity stop
    22.                 // Destroy you  GUI
    23.             }
    24.         }
    25.  

    When you create a project build set the following values
     
    Last edited: Dec 10, 2016
  42. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    Last edited: Dec 10, 2016
  43. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Just tried it. This is indeed a bug of Unity 5.5. This version introduced the support for building projects using Gradle build system, which uLiveWallpaper utilises. This allows for much simpler live wallpaper project export - just open it in Android Studio and you're done. Well, except the icon... I'll report this bug to Unity.
    The wallpaper is quite simple, but looks nice! :)
    Pretty cool as well!
    Pretty much the only place you can realistically place ads is the settings screen. In general, ads really don't work very well with live wallpapers, since live wallpaper is something that the user sees constantly, and in background, so most of the time your ad will be occluded by the icons anyway. I'd recommend using in-app purchases or free/paid version model instead.
    Particularly cool one :)
    "Settings Activity" and "Preferences Activity" is the same thing. @rshmel in the post above is doing something strange. You just need to set the "Settings Activity" option to "Invisible self-closing" when creating the project, and that's it:
    upload_2016-12-11_2-59-50.png
    You don't need "Create Unity Activity" enabled for this. Basically, when the user clicks "Settings..." in the wallpaper preview screen, the Settings Activity is started. When it is started, a LiveWallpaper.PreferenceActivityTriggered event is triggered. You can subscribe to that event and just show/hide your settings UI.
    I'm really not sure I understand what you are doing here. Why are you starting a Unity player Activity when the user taps "Settings..."?
     
  44. ArthurUS83

    ArthurUS83

    Joined:
    Jan 13, 2016
    Posts:
    25
    Thank You for comments :).. for icons, i'm using just Photoshop.
     
  45. Deleted User

    Deleted User

    Guest

    Hi, I've started a project to get back into this - Great to see the much simpler setup allowed with Unity 5.5!

    I just wanted to check as something doesn't seem right - maybe I have done something wrong?

    I've got a completely blank scene, just one camera with the default blue background, and pushed a build to my Android device. This takes 41.53 MB of internal storage, which is rather surprising for an empty scene, especially as I checked out the 3D Earth live wallpaper someone posted in this thread, and this takes only 36.66 MB.

    Is this normal behaviour before working through the "Reducing APK size" points in the documentation?

    Anyway, I shall continue with it as I have a half-baked project ready to go;
    Thanks for the great asset! :)
     
  46. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    You're welcome! :) Yes, that's normal if no wteps to reduce the size were taken. Even in an empty scene, most space is taken by the native Unity libraries, which take roughly 20 MB gor ARM and x86 platforms combined. When the .apk is installed, those libraries also have to be unpacked, which basically doubles the final size on the device, so 41 MB sounds about correct :) This isn't anything specific to uLiveWallpaper, but to Unity in general.
     
  47. Tonismo

    Tonismo

    Joined:
    Oct 7, 2016
    Posts:
    29
    You can reduce the size by going into Build Settings and select ARMs as the architecture from the inspector menu instead of using Arms and x86. Most phones use ARMs architectures so youre not going to miss anything.
     
  48. Deleted User

    Deleted User

    Guest

    Ah thanks for clarifying; I will have to apply as many tweaks and size adjustments as possible then to try and reduce the large default Unity bulk - guess that's the trade-off for being able to create live wallpapers with such ease and power.

    I just now figured out how to add custom settings and link them between the Android Studio prefs and Unity code, so happy right now as I know I can complete this project with the desired functionality I was after! thanks again for this amazing asset; Will leave a store review shortly for you

    Thanks for the tip! I will be sure to do that to help reduce size :)
     
  49. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    How do you open the settings screen by multi tapping on the wallpaper? I have tried using the MultiTap but just can't seem to figure it out.

    Another question: in the Android SettingsActivity.java, when the "LiveWallpaperUnityFacade.getEventsProxy().preferencesActivityTriggered();" is returned how does it know to open the OpenSettingsActivityClicked() function? I assumed it would open the LiveWallpaperPreferenceActivityTriggered() function but it always appears to open the OpenSettingsActivityClicked() function when I click on the Settings Button.
     
  50. Zerofield

    Zerofield

    Joined:
    Jul 26, 2014
    Posts:
    19
    Hey, the asset is really awesome. I want to add some Admob Ad to the Activity. I want to ask which Activity can I add ads.