Eflatun Android Manifest Hook by starikcetin - 5

Mobile

Utilites for hooking into AndroidManifest.xml generation in Unity.

Unknown VersionMIT LicenseUpdated 17 days agoCreated on October 25th, 2019
Go to source

Eflatun.AndroidManifestHook

Utilites for hooking into AndroidManifest.xml generation in Unity.

Installation

  1. Get this: https://github.com/mob-sakai/UpmGitExtension

  2. Install this repo from Unity Package Manager window, inside Unity.

Usage

using Eflatun.AndroidManifestHook;

public class TestManifestHook : AndroidManifestHooker
{
    protected override void Modify(AndroidManifest androidManifest)
    {
        var value = androidManifest.SetAttributeWithAndroidNamespace(androidManifest.ApplicationElement, "foo", "bar");
    }
}

The code above will result in this:

...
    <application ... android:foo="bar">
...

You need to create an asmdef file with:

  1. only Editor platform selected
  2. a reference to Eflatun.AndroidManifestHook asmdef

for your manifest hooker scripts. Otherwise you will get build errors.

It should look like this:

asmdef screenshot

License

MIT license. Refer to the LICENSE file.

Copyright © 2019 S. Tarık Çetin.

This library is basically a convinience wrapper around this StackOverflow answer by pale bone.

Show all projects by starikcetin