Search Unity

Modifying Android Manifest

Discussion in 'Android' started by supernat, Nov 24, 2011.

  1. supernat

    supernat

    Joined:
    May 3, 2011
    Posts:
    45
    Hi Everyone,

    I just recently released a game on the Android market using a competitor's game engine with good success, but I didn't like their use of LUA, so I decided to try Unity Android this time. However, I need full control over the Android Manifest which is provided by the competitor. Their game engine generates an android project zip file that you just pull into Eclipse and modify as needed. I haven't found this option or even the ability to change the Manifest with Unity. Is this possible? I have read many posts that say it used to be but was removed. I have Unity 3.4. I really need to know this before starting my next project.

    Thanks,
    Chris
     
  2. Deleted User

    Deleted User

    Guest

  3. supernat

    supernat

    Joined:
    May 3, 2011
    Posts:
    45
    Great, this is exactly what I was looking for. I don't have an Assets/Plugins/Android folder, although I do have just an Assets folder. Do you have to create this folder yourself? What version of Unity are you running?
     
  4. Deleted User

    Deleted User

    Guest

    Yes, you can just create the directory yourself. If you use any third-party plugins (like the prime31 plugins or the AdMob or OpenFeint plugins provided free on these forums), you'll see they are deposited in that directory and include a manifest file. I'm using the latest version of Unity.
     
  5. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    I know this thread is a bit dated, but I could use some assistance on getting this to work. I can't figure out how to change the manifest file properly for OpenFeint integration + Prime31 plugins.

    If I use the manifest file that is included in the OpenFeint package in my current project, OF works, but when I try to integrate the activities from OpenFeint into my own manifest file, I can't get it to work.

    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.unity3d.player"
    5.     android:installLocation="preferExternal"
    6.     android:versionCode="1"
    7.     android:versionName="1.0">
    8.     <supports-screens
    9.         android:smallScreens="true"
    10.         android:normalScreens="true"
    11.         android:largeScreens="true"
    12.         android:xlargeScreens="true"
    13.         android:anyDensity="true"/>
    14.  
    15.     <application
    16.         android:icon="@drawable/app_icon"
    17.         android:label="@string/app_name"
    18.         android:debuggable="true">
    19.         <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    20.                   android:label="@string/app_name"
    21.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    22.             <intent-filter>
    23.                 <action android:name="android.intent.action.MAIN" />
    24.                 <category android:name="android.intent.category.LAUNCHER" />
    25.             </intent-filter>
    26.         </activity>
    27.         <activity android:name="com.unity3d.player.UnityPlayerActivity"
    28.                   android:label="@string/app_name"
    29.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    30.         </activity>
    31.         <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    32.                   android:label="@string/app_name"
    33.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    34.             <meta-data android:name="android.app.lib_name" android:value="unity" />
    35.             <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    36.         </activity>
    37.         <activity android:name="com.unity3d.player.VideoPlayer"
    38.                   android:label="@string/app_name"
    39.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    40.         </activity>
    41.        
    42.         <!-- OpenFeint Activities -->
    43.        
    44.         <activity android:name="com.gree.giraffe.DialogActivity" android:theme="@android:style/Theme.Dialog"/>
    45.        
    46.         <activity android:name="com.openfeint.internal.ui.IntroFlow"
    47.                   android:label="IntroFlow"
    48.                   android:configChanges="orientation|keyboardHidden"
    49.                   android:theme="@style/OFNestedWindow" />
    50.         <activity android:name="com.openfeint.api.ui.Dashboard"
    51.                   android:label="Dashboard"
    52.                   android:configChanges="orientation|keyboardHidden"
    53.                   android:theme="@style/OFNestedWindow"/>
    54.         <activity android:name="com.openfeint.internal.ui.Settings"
    55.                   android:label="Settings"
    56.                   android:configChanges="orientation|keyboardHidden"
    57.                   android:theme="@style/OFNestedWindow"/>
    58.         <activity android:name="com.openfeint.internal.ui.NativeBrowser"
    59.                   android:label="NativeBrowser"
    60.                   android:configChanges="orientation|keyboardHidden"
    61.                   android:theme="@style/OFNestedWindow"/>
    62.        
    63.         <!-- META-DATA -->
    64.        
    65.         <service android:name="com.prime31.billing.BillingService" />
    66.         <receiver android:name="com.prime31.billing.BillingReceiver">
    67.             <intent-filter>
    68.                 <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
    69.                 <action android:name="com.android.vending.billing.RESPONSE_CODE" />
    70.                 <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
    71.             </intent-filter>
    72.         </receiver>
    73.     </application>
    74.    
    75.  
    76.     <!-- PERMISSIONS -->
    77.         <uses-permission android:name="android.permission.INTERNET" />
    78.         <uses-permission android:name="com.android.vending.BILLING" />
    79.         <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    80.         <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    81.         <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    82.    
    83. </manifest>
    can you spot what I'm doing wrong?
     
  6. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    I can't see anything immediately obvious. It might help if you go into a little more detail as to what actually goes wrong, with any error messages you get.
     
  7. bigcheese_

    bigcheese_

    Joined:
    Sep 6, 2011
    Posts:
    31
    I'm going through the same problem right now, I can't find whats going wrong! but it seems to be a problem in conflict between
    Code (csharp):
    1.  
    2. <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    3.                   android:label="@string/app_name"
    4.                   android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    5.             <intent-filter>
    6.                 <action android:name="android.intent.action.MAIN" />
    7.                 <category android:name="android.intent.category.LAUNCHER" />
    8.             </intent-filter>
    9.         </activity>
    10.  

    AND the
    Code (csharp):
    1.  
    2. <activity android:name="com.gree.giraffe.BaseActivity">
    3.             <intent-filter>
    4.                 <action android:name="android.intent.action.MAIN" />
    5.                 <category android:name="android.intent.category.LAUNCHER" />
    6.             </intent-filter>
    7.         </activity>
    8.  
    If you keep the later Openfeint will work properly but if you keep the default unity one it won't.
    However if you remove the default unity one, the game won't start on big screen galaxy tab and such.
     
  8. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87

    That is pretty much what I'm trying to figure out as well. Seeing as how you replied to my answer.unity3D post, would you happen to know what we need to do HazeTI? I've tried all sorts of things, to setting the BaseActivity with an intent-filter using the unity3d.LAUNCH as the action, but still no dice.

    As to what goes wrong, it just doesn't work. I don't see the OpenFeint dialog banner showing i'm logged in, etc. I'll try to post a logcat if that will help, but for some reason my macbook isn't recognizing my device anymore, and neither is any other computer for that fact. I think I need to flash a different ROM as my current custom one is not working entirely properly.
     
  9. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    So, let me make sure I'm completely understanding the situation. If you use the Manifest that s included with the OpenFeint package OF works correctly? Then when you try to change your original manifest to work with OF you can't get it to work. So the only difference between the two version is the manifest file? Nothing else is changed?

    If that's the case then we need to compare the two versions and find out what is different between them. Post them both here (I guess you've already posted one above?) and we'll see if we can spot anything wrong.
     
  10. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    OpenFeint included Manifest:

    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    3.     package="com.gree.giraffe" android:versionCode="1" android:versionName="1.0">
    4.     <uses-sdk android:minSdkVersion="7" />
    5.  
    6. <uses-permission android:name="android.permission.INTERNET" />
    7. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    8. <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    9. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    10. <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    11.  
    12.  
    13. <application>
    14.     <activity android:name="com.gree.giraffe.BaseActivity">
    15.        <intent-filter>
    16.          <action android:name="android.intent.action.MAIN" />
    17.          <category android:name="android.intent.category.LAUNCHER" />
    18.        </intent-filter>
    19.     </activity>
    20.  
    21.     <activity android:name="com.gree.giraffe.DialogActivity" android:theme="@android:style/Theme.Dialog"/>
    22.  
    23.     <!-- OpenFeint Activities -->
    24.     <activity android:name="com.openfeint.internal.ui.IntroFlow"
    25.               android:label="IntroFlow"
    26.               android:configChanges="orientation|keyboardHidden"
    27.               android:theme="@style/OFNestedWindow" />
    28.     <activity android:name="com.openfeint.api.ui.Dashboard"
    29.               android:label="Dashboard"
    30.               android:configChanges="orientation|keyboardHidden"
    31.               android:theme="@style/OFNestedWindow"/>
    32.     <activity android:name="com.openfeint.internal.ui.Settings"
    33.               android:label="Settings"
    34.               android:configChanges="orientation|keyboardHidden"
    35.               android:theme="@style/OFNestedWindow"/>
    36.     <activity android:name="com.openfeint.internal.ui.NativeBrowser"
    37.               android:label="NativeBrowser"
    38.               android:configChanges="orientation|keyboardHidden"
    39.               android:theme="@style/OFNestedWindow"/>
    40.  
    41. </application>
    Unity Manifest with OpenFeint activities and Prime31 changes:

    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.unity3d.player"
    5.     android:installLocation="preferExternal"
    6.     android:versionCode="1"
    7.     android:versionName="1.0">
    8.     <supports-screens
    9.         android:smallScreens="true"
    10.         android:normalScreens="true"
    11.         android:largeScreens="true"
    12.         android:xlargeScreens="true"
    13.         android:anyDensity="true"/>
    14.  
    15. <application
    16.     android:icon="@drawable/app_icon"
    17.     android:label="@string/app_name"
    18.     android:debuggable="true">
    19.     <activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
    20.               android:label="@string/app_name"
    21.               android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    22.         <intent-filter>
    23.             <action android:name="android.intent.action.MAIN" />
    24.             <category android:name="android.intent.category.LAUNCHER" />
    25.         </intent-filter>
    26.     </activity>
    27.     <activity android:name="com.unity3d.player.UnityPlayerActivity"
    28.               android:label="@string/app_name"
    29.               android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    30.     </activity>
    31.     <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
    32.               android:label="@string/app_name"
    33.               android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    34.         <meta-data android:name="android.app.lib_name" android:value="unity" />
    35.         <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
    36.     </activity>
    37.     <activity android:name="com.unity3d.player.VideoPlayer"
    38.               android:label="@string/app_name"
    39.               android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
    40.     </activity>
    41.  
    42.     <!-- OpenFeint Activities -->
    43.  
    44.     <activity android:name="com.openfeint.internal.ui.IntroFlow"
    45.               android:label="IntroFlow"
    46.               android:configChanges="orientation|keyboardHidden"
    47.               android:theme="@style/OFNestedWindow" />
    48.     <activity android:name="com.openfeint.api.ui.Dashboard"
    49.               android:label="Dashboard"
    50.               android:configChanges="orientation|keyboardHidden"
    51.               android:theme="@style/OFNestedWindow"/>
    52.     <activity android:name="com.openfeint.internal.ui.Settings"
    53.               android:label="Settings"
    54.               android:configChanges="orientation|keyboardHidden"
    55.               android:theme="@style/OFNestedWindow"/>
    56.     <activity android:name="com.openfeint.internal.ui.NativeBrowser"
    57.               android:label="NativeBrowser"
    58.               android:configChanges="orientation|keyboardHidden"
    59.               android:theme="@style/OFNestedWindow"/>
    60.  
    61.     <!-- META-DATA -->
    62.  
    63.     <service android:name="com.prime31.billing.BillingService" />
    64.     <receiver android:name="com.prime31.billing.BillingReceiver">
    65.        <intent-filter>
    66.          <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
    67.          <action android:name="com.android.vending.billing.RESPONSE_CODE" />
    68.          <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
    69.        </intent-filter>
    70.     </receiver>
    71. </application>
    72.  
    73.  
    74. <!-- PERMISSIONS -->
    75.     <uses-permission android:name="android.permission.INTERNET" />
    76.     <uses-permission android:name="com.android.vending.BILLING" />
    77.     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    78.     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    79.     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     
  11. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
    Hey, sorry for the delayed reply.
    I noticed that the activities between the two version are completely different. The OF version has com.gree.giraffe.BaseActivity as the main activity but this isn't mentioned at all in the second manifest, does any of your openfeint stuff run from this activity?
     
  12. dannyskim

    dannyskim

    Joined:
    Jul 20, 2011
    Posts:
    87
    I'm honestly not sure, I'm trying to integrate the official OpenFeint plug-in for Unity from their developer portal. No where in their documentation does it say to require those activities, but I'm assuming that which you mentioned is the exact problem. I have no idea how to properly edit the manifest file, and I've been researching for days but still can't figure it out.

    there is a .jar file named Giraffe.jar inside of the plug-in contents, in which BaseActivity and DialogActivity are classes of, but I have no idea how to properly declare those in the manifest with an existing Unity Project.
     
  13. HazeTI

    HazeTI

    Joined:
    Jan 12, 2012
    Posts:
    83
  14. lutfianasari

    lutfianasari

    Joined:
    Feb 12, 2015
    Posts:
    1
    did you try moving permission tag before application tag?