Note that there are some explanatory texts on larger screens.

plurals
  1. POUnityPlayerActivity not getting onCreate() log
    primarykey
    data
    text
    <p>I am trying to extend UnityPlayerActivity with the help of docs.unity3d. I have a simple jar file with MainActivity class and also included the file classes.jar to the libs folder. My class file has following code.</p> <pre><code>package com.example.testactivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import com.unity3d.player.UnityPlayerActivity; public class MainActivity extends UnityPlayerActivity { @Override public void onCreate(Bundle savedInstanceState) { Log.i("Hiren","==============ON CREATE CALLED=============="); super.onCreate(savedInstanceState); } public static void callMe() { Log.i("Hiren","==============Function CALLED=============="); } } </code></pre> <p>I can call the static function callMe () through my c# script but my onCreate() is not called at the start of the activity. My C# script is</p> <pre><code>private static FBShare _instance; public static FBShare Instance { get { if(_instance == null) _instance = new FBShare(); return _instance; } } private AndroidJavaClass cls_Fb = new AndroidJavaClass("com.example.testactivity.MainActivity"); public void CallMe() { using(AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { using(AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic&lt;AndroidJavaObject&gt;("currentActivity")) { cls_Fb.CallStatic("callMe"); } } </code></pre> <p>When I call "CallMe" method, I get log of being called. but I didnt get any log from onCreate().</p> <p>AndroidMenifest.xml file contains</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.testactivity.MainActivity" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0"&gt; &lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/&gt; &lt;application android:label="@string/app_name" android:debuggable="true"&gt; &lt;activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"&gt; &lt;/activity&gt; &lt;activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"&gt; &lt;meta-data android:name="android.app.lib_name" android:value="unity" /&gt; &lt;meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" /&gt; &lt;/activity&gt; &lt;activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"&gt; &lt;/activity&gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation" &gt; &lt;meta-data android:name="android.app.lib_name" android:value="unity" /&gt; &lt;meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" /&gt; &lt;/activity&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_INTERNET" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload