public static void UpdateManifest()
    {
        if (!GoogleMobileAdSettings.Instance.KeepManifestClean)
        {
            return;
        }

        AN_ManifestManager.Refresh();

        AN_ManifestTemplate    Manifest         = AN_ManifestManager.GetManifest();
        AN_ApplicationTemplate application      = Manifest.ApplicationTemplate;
        AN_ActivityTemplate    launcherActivity = application.GetLauncherActivity();

        AN_ActivityTemplate AdActivity = application.GetOrCreateActivityWithName("com.google.android.gms.ads.AdActivity");

        AdActivity.SetValue("android:configChanges", "keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize");


        if (launcherActivity != null)
        {
            AN_PropertyTemplate ForwardNativeEventsToDalvik = launcherActivity.GetOrCreatePropertyWithName("meta-data", "unityplayer.ForwardNativeEventsToDalvik");
            ForwardNativeEventsToDalvik.SetValue("android:value", "true");
        }



        AN_PropertyTemplate games_version = application.GetOrCreatePropertyWithName("meta-data", "com.google.android.gms.version");

        games_version.SetValue("android:value", GoogleMobileAdSettings.PLAY_SERVICE_VERSION);


        AN_ManifestManager.SaveManifest();
    }
示例#2
0
    private void OnAddPermissionClick(string permission)
    {
        AN_PropertyTemplate property = new AN_PropertyTemplate("uses-permission");

        property.SetValue("android:name", permission);
        AN_ManifestManager.GetManifest().AddPermission(property);
    }
示例#3
0
    private void SelectPermission(object data)
    {
        AN_PropertyTemplate newPermission = new AN_PropertyTemplate("uses-permission");

        newPermission.SetValue("android:name", data.ToString());
        AN_ManifestManager.GetManifest().AddPermission(newPermission);
    }
示例#4
0
	public AN_PropertyTemplate GetOrCreatePropertyWithName(string tag, string name) {
		AN_PropertyTemplate p =  GetPropertyWithName(tag, name);
		if(p == null) {
			p = new AN_PropertyTemplate(tag);
			p.SetValue("android:name", name);
			AddProperty(p);
		}

		return p;
	}
示例#5
0
	public AN_PropertyTemplate GetOrCreateIntentFilterWithName(string name) {
		AN_PropertyTemplate filter = GetIntentFilterWithName(name);
		if(filter == null) {
			filter =  new AN_PropertyTemplate("intent-filter");
			AN_PropertyTemplate action = new AN_PropertyTemplate("action");
			action.SetValue("android:name", name);
			filter.AddProperty(action);
			AddProperty(filter);
		}

		return filter;
	}
示例#6
0
	public static AN_PropertyTemplate GetLauncherPropertyTemplate() {
		AN_PropertyTemplate launcher = new AN_PropertyTemplate ("intent-filter");

		AN_PropertyTemplate prop = new AN_PropertyTemplate ("action");
		prop.SetValue ("android:name", "android.intent.action.MAIN");
		launcher.AddProperty ("action", prop);

		prop = new AN_PropertyTemplate ("category");
		prop.SetValue ("android:name", "android.intent.category.LAUNCHER");
		launcher.AddProperty ("category", prop);

		return launcher;
	}
示例#7
0
    public AN_PropertyTemplate GetOrCreatePropertyWithName(string tag, string name)
    {
        AN_PropertyTemplate p = GetPropertyWithName(tag, name);

        if (p == null)
        {
            p = new AN_PropertyTemplate(tag);
            p.SetValue("android:name", name);
            AddProperty(p);
        }

        return(p);
    }
    public static AN_PropertyTemplate GetLauncherPropertyTemplate()
    {
        AN_PropertyTemplate launcher = new AN_PropertyTemplate("intent-filter");

        AN_PropertyTemplate prop = new AN_PropertyTemplate("action");

        prop.SetValue("android:name", "android.intent.action.MAIN");
        launcher.AddProperty("action", prop);

        prop = new AN_PropertyTemplate("category");
        prop.SetValue("android:name", "android.intent.category.LAUNCHER");
        launcher.AddProperty("category", prop);

        return(launcher);
    }
示例#9
0
    public AN_PropertyTemplate GetOrCreateIntentFilterWithName(string name)
    {
        AN_PropertyTemplate filter = GetIntentFilterWithName(name);

        if (filter == null)
        {
            filter = new AN_PropertyTemplate("intent-filter");
            AN_PropertyTemplate action = new AN_PropertyTemplate("action");
            action.SetValue("android:name", name);
            filter.AddProperty(action);
            AddProperty(filter);
        }

        return(filter);
    }
    private static AN_PropertyTemplate ParseProperty(XmlNode node)
    {
        AN_PropertyTemplate property = new AN_PropertyTemplate(node.Name);

        //Get Values
        foreach (XmlAttribute attr in node.Attributes)
        {
            property.SetValue(attr.Name, attr.Value);
        }
        //Get Properties
        foreach (XmlNode n in node.ChildNodes)
        {
            property.AddProperty(n.Name, ParseProperty(n));
        }

        return(property);
    }
示例#11
0
	private static void ReadManifest(string manifestPath) {

#if !(UNITY_WP8 || UNITY_METRO)
		//Read XML file
		_manifestTemplate = new AN_ManifestTemplate ();
			
		XmlDocument doc = new XmlDocument ();
		doc.Load (Application.dataPath + manifestPath);
		XmlNode rootNode = doc.DocumentElement;
			
		foreach (XmlAttribute attr in rootNode.Attributes) {				
			_manifestTemplate.SetValue(attr.Name, attr.Value);
		}
			
		foreach (XmlNode childNode in rootNode.ChildNodes) {
			if (!childNode.Name.Equals("application")
			    && !childNode.Name.Equals("uses-permission")
			    && !childNode.Name.Equals("#comment")) {
				_manifestTemplate.AddProperty(childNode.Name, ParseProperty(childNode));
			}
		}
			
		XmlNode applicationNode = null;
		foreach (XmlNode childNode in rootNode.ChildNodes) {
			if (childNode.Name.Equals("application")) {
				applicationNode = childNode;
				break;
			}
		}
			
		foreach (XmlAttribute attr in applicationNode.Attributes) {
			_manifestTemplate.ApplicationTemplate.SetValue(attr.Name, attr.Value);
		}
		foreach (XmlNode childNode in applicationNode.ChildNodes) {
			if(!childNode.Name.Equals("#comment")
			   && !childNode.Name.Equals("activity")) {
				_manifestTemplate.ApplicationTemplate.AddProperty(childNode.Name, ParseProperty(childNode));
			}
		}
			
		foreach (XmlNode childNode in applicationNode.ChildNodes) {
			if(childNode.Name.Equals("activity")
			   && !childNode.Name.Equals("#comment")) {

				string activityName = "";
				if(childNode.Attributes["android:name"] != null) {
					activityName = childNode.Attributes["android:name"].Value;
				} else {
					Debug.LogWarning("Android Manifest contains activity tag without android:name attribute.");
				}
					
				XmlNode launcher = null;
				bool isLauncher = false;
				foreach (XmlNode actNode in childNode.ChildNodes) {
					if (actNode.Name.Equals("intent-filter")) {
						foreach (XmlNode intentNode in actNode.ChildNodes) {
							if (intentNode.Name.Equals("category")) {
								if (intentNode.Attributes["android:name"].Value.Equals("android.intent.category.LAUNCHER")) {
									isLauncher = true;
									launcher = actNode;
								}
							}
						}
					}
				}
					
				AN_ActivityTemplate activity = new AN_ActivityTemplate(isLauncher, activityName);
				foreach (XmlAttribute attr in childNode.Attributes) {
					activity.SetValue(attr.Name, attr.Value);
				}

				foreach (XmlNode actNode in childNode.ChildNodes) {
					if (!actNode.Name.Equals("#comment")) {
						if (actNode != launcher) {
							activity.AddProperty(actNode.Name, ParseProperty(actNode));
						}
					}
				}
					
				_manifestTemplate.ApplicationTemplate.AddActivity(activity);
			}
		}
			
		//Load Manifest Permissions
		foreach (XmlNode node in rootNode.ChildNodes) {
			if (node.Name.Equals("uses-permission")) {
				AN_PropertyTemplate permission = new AN_PropertyTemplate("uses-permission");
				permission.SetValue("android:name", node.Attributes["android:name"].Value);
				_manifestTemplate.AddPermission(permission);
			}
		}
#endif

	}
	private void OnAddPermissionClick(string permission) {
		AN_PropertyTemplate property = new AN_PropertyTemplate ("uses-permission");
		property.SetValue ("android:name", permission);
		AN_ManifestManager.GetManifest ().AddPermission(property);
	}
    public static void UpdateManifest()
    {
        if (!SocialPlatfromSettings.Instance.KeepManifestClean)
        {
            return;
        }

        AN_ManifestManager.Refresh();

        AN_ManifestTemplate    Manifest         = AN_ManifestManager.GetManifest();
        AN_ApplicationTemplate application      = Manifest.ApplicationTemplate;
        AN_ActivityTemplate    launcherActivity = application.GetLauncherActivity();

        AN_ActivityTemplate AndroidNativeProxy = application.GetOrCreateActivityWithName("com.androidnative.AndroidNativeProxy");

        AndroidNativeProxy.SetValue("android:launchMode", "singleTask");
        AndroidNativeProxy.SetValue("android:label", "@string/app_name");
        AndroidNativeProxy.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen");
        AndroidNativeProxy.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar");

        // Remove VIEW intent filter from AndroidNativeProxy activity
        if (AndroidNativeProxy != null)
        {
            AN_PropertyTemplate intent_filter = AndroidNativeProxy.GetOrCreateIntentFilterWithName("android.intent.action.VIEW");
            AndroidNativeProxy.RemoveProperty(intent_filter);
        }

        AN_ActivityTemplate SocialProxyActivity = application.GetOrCreateActivityWithName("com.androidnative.features.social.common.SocialProxyActivity");

        SocialProxyActivity.SetValue("android:launchMode", "singleTask");
        SocialProxyActivity.SetValue("android:label", "@string/app_name");
        SocialProxyActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen");
        SocialProxyActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar");

        if (launcherActivity.Name == "com.androidnative.AndroidNativeBridge")
        {
            launcherActivity.SetName("com.unity3d.player.UnityPlayerNativeActivity");
        }


        ////////////////////////
        //TwitterAPI
        ////////////////////////


        foreach (KeyValuePair <int, AN_ActivityTemplate> entry in application.Activities)
        {
            //TODO get intents array
            AN_ActivityTemplate act    = entry.Value;
            AN_PropertyTemplate intent = act.GetIntentFilterWithName("android.intent.action.VIEW");
            if (intent != null)
            {
                AN_PropertyTemplate data = intent.GetOrCreatePropertyWithTag("data");
                if (data.GetValue("android:scheme") == "oauth")
                {
                    act.RemoveProperty(intent);
                }
            }
        }

        if (SocialPlatfromSettings.Instance.TwitterAPI)
        {
            if (SocialProxyActivity != null)
            {
                AN_PropertyTemplate intent_filter = SocialProxyActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW");
                intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.DEFAULT");
                intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.BROWSABLE");
                AN_PropertyTemplate data = intent_filter.GetOrCreatePropertyWithTag("data");
                data.SetValue("android:scheme", "oauth");
                data.SetValue("android:host", PlayerSettings.bundleIdentifier);
            }
        }
        else
        {
            if (SocialProxyActivity != null)
            {
                AN_PropertyTemplate intent_filter = SocialProxyActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW");
                SocialProxyActivity.RemoveProperty(intent_filter);
            }
        }

        ////////////////////////
        //FB API
        ////////////////////////
        AN_PropertyTemplate ApplicationId_meta         = application.GetOrCreatePropertyWithName("meta-data", "com.facebook.sdk.ApplicationId");
        AN_ActivityTemplate LoginActivity              = application.GetOrCreateActivityWithName("com.facebook.LoginActivity");
        AN_ActivityTemplate FBUnityLoginActivity       = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityLoginActivity");
        AN_ActivityTemplate FBUnityDeepLinkingActivity = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityDeepLinkingActivity");
        AN_ActivityTemplate FBUnityDialogsActivity     = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityDialogsActivity");


        if (IsFacebookInstalled)
        {
            ApplicationId_meta.SetValue("android:value", "\\ " + FBSettings.AppId);

            LoginActivity.SetValue("android:label", "@string/app_name");
            LoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar");
            LoginActivity.SetValue("android:configChanges", "keyboardHidden|orientation");


            FBUnityLoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen");
            FBUnityLoginActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen");

            FBUnityDialogsActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen");
            FBUnityDialogsActivity.SetValue("android:configChanges", "fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen");

            FBUnityDeepLinkingActivity.SetValue("android:exported", "true");
        }
        else
        {
            application.RemoveProperty(ApplicationId_meta);
            application.RemoveActivity(LoginActivity);
            application.RemoveActivity(FBUnityLoginActivity);
            application.RemoveActivity(FBUnityDeepLinkingActivity);
            application.RemoveActivity(FBUnityDialogsActivity);
        }


        ////////////////////////
        //NativeSharingAPI
        ////////////////////////
        AN_PropertyTemplate provider = application.GetOrCreatePropertyWithName("provider", "android.support.v4.content.FileProvider");

        if (SocialPlatfromSettings.Instance.NativeSharingAPI)
        {
#if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6)
            //Remove FileProvider description from AndroidManifest.xml in Unity 5
            application.RemoveProperty(provider);
#else
            provider.SetValue("android:authorities", PlayerSettings.bundleIdentifier + ".fileprovider");
            provider.SetValue("android:exported", "false");
            provider.SetValue("android:grantUriPermissions", "true");
            AN_PropertyTemplate provider_meta = provider.GetOrCreatePropertyWithName("meta-data", "android.support.FILE_PROVIDER_PATHS");
            provider_meta.SetValue("android:resource", "@xml/file_paths");
#endif
        }
        else
        {
            application.RemoveProperty(provider);
        }


        List <string> permissions = GetRequiredPermissions();
        foreach (string p in permissions)
        {
            Manifest.AddPermission(p);
        }

        AN_ManifestManager.SaveManifest();
    }
    private static void ReadManifest(string manifestPath)
    {
#if !(UNITY_WP8 || UNITY_METRO)
        //Read XML file
        _manifestTemplate = new AN_ManifestTemplate();

        XmlDocument doc = new XmlDocument();
        doc.Load(Application.dataPath + manifestPath);
        XmlNode rootNode = doc.DocumentElement;

        foreach (XmlAttribute attr in rootNode.Attributes)
        {
            _manifestTemplate.SetValue(attr.Name, attr.Value);
        }

        foreach (XmlNode childNode in rootNode.ChildNodes)
        {
            if (!childNode.Name.Equals("application") &&
                !childNode.Name.Equals("uses-permission") &&
                !childNode.Name.Equals("#comment"))
            {
                _manifestTemplate.AddProperty(childNode.Name, ParseProperty(childNode));
            }
        }

        XmlNode applicationNode = null;
        foreach (XmlNode childNode in rootNode.ChildNodes)
        {
            if (childNode.Name.Equals("application"))
            {
                applicationNode = childNode;
                break;
            }
        }

        foreach (XmlAttribute attr in applicationNode.Attributes)
        {
            _manifestTemplate.ApplicationTemplate.SetValue(attr.Name, attr.Value);
        }
        foreach (XmlNode childNode in applicationNode.ChildNodes)
        {
            if (!childNode.Name.Equals("#comment") &&
                !childNode.Name.Equals("activity"))
            {
                _manifestTemplate.ApplicationTemplate.AddProperty(childNode.Name, ParseProperty(childNode));
            }
        }

        foreach (XmlNode childNode in applicationNode.ChildNodes)
        {
            if (childNode.Name.Equals("activity") &&
                !childNode.Name.Equals("#comment"))
            {
                string activityName = "";
                if (childNode.Attributes["android:name"] != null)
                {
                    activityName = childNode.Attributes["android:name"].Value;
                }
                else
                {
                    Debug.LogWarning("Android Manifest contains activity tag without android:name attribute.");
                }

                XmlNode launcher   = null;
                bool    isLauncher = false;
                foreach (XmlNode actNode in childNode.ChildNodes)
                {
                    if (actNode.Name.Equals("intent-filter"))
                    {
                        foreach (XmlNode intentNode in actNode.ChildNodes)
                        {
                            if (intentNode.Name.Equals("category"))
                            {
                                if (intentNode.Attributes["android:name"].Value.Equals("android.intent.category.LAUNCHER"))
                                {
                                    isLauncher = true;
                                    launcher   = actNode;
                                }
                            }
                        }
                    }
                }

                AN_ActivityTemplate activity = new AN_ActivityTemplate(isLauncher, activityName);
                foreach (XmlAttribute attr in childNode.Attributes)
                {
                    activity.SetValue(attr.Name, attr.Value);
                }

                foreach (XmlNode actNode in childNode.ChildNodes)
                {
                    if (!actNode.Name.Equals("#comment"))
                    {
                        if (actNode != launcher)
                        {
                            activity.AddProperty(actNode.Name, ParseProperty(actNode));
                        }
                    }
                }

                _manifestTemplate.ApplicationTemplate.AddActivity(activity);
            }
        }

        //Load Manifest Permissions
        foreach (XmlNode node in rootNode.ChildNodes)
        {
            if (node.Name.Equals("uses-permission"))
            {
                AN_PropertyTemplate permission = new AN_PropertyTemplate("uses-permission");
                permission.SetValue("android:name", node.Attributes["android:name"].Value);
                _manifestTemplate.AddPermission(permission);
            }
        }
#endif
    }
示例#15
0
    public static void UpdateManifest()
    {
        if (!SocialPlatfromSettings.Instance.KeepManifestClean)
        {
            return;
        }

        AN_ManifestManager.Refresh();

        AN_ManifestTemplate    Manifest         = AN_ManifestManager.GetManifest();
        AN_ApplicationTemplate application      = Manifest.ApplicationTemplate;
        AN_ActivityTemplate    launcherActivity = application.GetLauncherActivity();


        ////////////////////////
        //TwitterAPI
        ////////////////////////
        foreach (KeyValuePair <int, AN_ActivityTemplate> entry in application.Activities)
        {
            //TODO get intents array
            AN_ActivityTemplate act    = entry.Value;
            AN_PropertyTemplate intent = act.GetIntentFilterWithName("android.intent.action.VIEW");
            if (intent != null)
            {
                AN_PropertyTemplate data = intent.GetPropertyWithTag("data");
                if (data.GetValue("android:scheme") == "oauth")
                {
                    act.RemoveProperty(intent);
                }
            }
        }

        if (SocialPlatfromSettings.Instance.TwitterAPI)
        {
            if (launcherActivity != null)
            {
                AN_PropertyTemplate intent_filter = launcherActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW");
                intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.DEFAULT");
                intent_filter.GetOrCreatePropertyWithName("category", "android.intent.category.BROWSABLE");
                AN_PropertyTemplate data = intent_filter.GetOrCreatePropertyWithTag("data");
                data.SetValue("android:scheme", "oauth");
                data.SetValue("android:host", PlayerSettings.bundleIdentifier);
            }
        }
        else
        {
            if (launcherActivity != null)
            {
                AN_PropertyTemplate intent_filter = launcherActivity.GetOrCreateIntentFilterWithName("android.intent.action.VIEW");
                launcherActivity.RemoveProperty(intent_filter);
            }
        }

        ////////////////////////
        //FB API
        ////////////////////////
        AN_PropertyTemplate ApplicationId_meta         = application.GetOrCreatePropertyWithName("meta-data", "com.facebook.sdk.ApplicationId");
        AN_ActivityTemplate LoginActivity              = application.GetOrCreateActivityWithName("com.facebook.LoginActivity");
        AN_ActivityTemplate FBUnityLoginActivity       = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityLoginActivity");
        AN_ActivityTemplate FBUnityDeepLinkingActivity = application.GetOrCreateActivityWithName("com.facebook.unity.FBUnityDeepLinkingActivity");

        if (IsFacebookInstalled)
        {
            ApplicationId_meta.Value = "fb_app_id";
            LoginActivity.SetValue("android:label", "@string/app_name");
            LoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar");
            FBUnityLoginActivity.SetValue("android:theme", "@android:style/Theme.Translucent.NoTitleBar.Fullscreen");
            FBUnityDeepLinkingActivity.SetValue("android:exported", "true");
        }
        else
        {
            application.RemoveProperty(ApplicationId_meta);
            application.RemoveActivity(LoginActivity);
            application.RemoveActivity(FBUnityLoginActivity);
            application.RemoveActivity(FBUnityDeepLinkingActivity);
        }


        ////////////////////////
        //NativeSharingAPI
        ////////////////////////
        AN_PropertyTemplate provider = application.GetOrCreatePropertyWithName("provider", "android.support.v4.content.FileProvider");

        if (SocialPlatfromSettings.Instance.NativeSharingAPI)
        {
            provider.SetValue("android:authorities", PlayerSettings.bundleIdentifier + ".fileprovider");
            provider.SetValue("android:exported", "false");
            provider.SetValue("android:grantUriPermissions", "true");
            AN_PropertyTemplate provider_meta = provider.GetOrCreatePropertyWithName("meta-data", "android.support.FILE_PROVIDER_PATHS");
            provider_meta.SetValue("android:resource", "@xml/file_paths");
        }
        else
        {
            application.RemoveProperty(provider);
        }



        List <string> permissions = GetRequiredPermissions();

        foreach (string p in permissions)
        {
            Manifest.AddPermission(p);
        }

        AN_ManifestManager.SaveManifest();
    }
示例#16
0
    public static void UpdateManifest()
    {
        if (!AndroidNativeSettings.Instance.KeepManifestClean)
        {
            return;
        }

        AN_ManifestManager.Refresh();

        int UpdateId = 0;
        AN_ManifestTemplate    Manifest         = AN_ManifestManager.GetManifest();
        AN_ApplicationTemplate application      = Manifest.ApplicationTemplate;
        AN_ActivityTemplate    launcherActivity = application.GetLauncherActivity();



        ////////////////////////
        //Google Play Service API
        ////////////////////////
        AN_PropertyTemplate games_version = application.GetOrCreatePropertyWithName("meta-data", "com.google.android.gms.version");

        if (AndroidNativeSettings.Instance.EnablePSAPI)
        {
            games_version.SetValue("android:value", "@integer/google_play_services_version");
        }
        else
        {
            application.RemoveProperty(games_version);
        }

        ////////////////////////
        //GooglePlayServicesAPI
        ////////////////////////

        UpdateId++;
        AN_PropertyTemplate games_APP_ID = application.GetOrCreatePropertyWithName("meta-data", "com.google.android.gms.games.APP_ID");

        if (!AndroidNativeSettings.Instance.GooglePlayServicesAPI)
        {
            application.RemoveProperty(games_APP_ID);
        }
        else
        {
            games_APP_ID.SetValue("android:value", "@string/app_id");
        }



        ////////////////////////
        //GoogleCloudSaveAPI
        ////////////////////////
        UpdateId++;
        AN_PropertyTemplate appstate_APP_ID = application.GetOrCreatePropertyWithName("meta-data", "com.google.android.gms.appstate.APP_ID");

        if (AndroidNativeSettings.Instance.GoogleCloudSaveAPI)
        {
            appstate_APP_ID.SetValue("android:value", "@string/app_id");
            AndroidNativeSettings.Instance.EnableAppStateAPI = true;
        }
        else
        {
            AndroidNativeSettings.Instance.EnableAppStateAPI = false;
            application.RemoveProperty(appstate_APP_ID);
        }


        ////////////////////////
        //AnalyticsAPI
        ////////////////////////
        UpdateId++;
        if (AndroidNativeSettings.Instance.AnalyticsAPI)
        {
            //Nothing to do
        }


        ////////////////////////
        //PushNotificationsAPI
        ////////////////////////
        UpdateId++;
        AN_PropertyTemplate GcmBroadcastReceiver   = application.GetOrCreatePropertyWithName("receiver", "com.androidnative.gcm.GcmBroadcastReceiver");
        AN_PropertyTemplate GcmIntentService       = application.GetOrCreatePropertyWithName("service", "com.androidnative.gcm.GcmIntentService");
        AN_PropertyTemplate permission_C2D_MESSAGE = Manifest.GetOrCreatePropertyWithName("permission", "com.example.gcm.permission.C2D_MESSAGE");

        if (AndroidNativeSettings.Instance.PushNotificationsAPI)
        {
            GcmBroadcastReceiver.SetValue("android:permission", "com.google.android.c2dm.permission.SEND");

            AN_PropertyTemplate intent_filter = GcmBroadcastReceiver.GetOrCreateIntentFilterWithName("com.google.android.c2dm.intent.RECEIVE");
            AN_PropertyTemplate category      = intent_filter.GetOrCreatePropertyWithTag("category");
            category.SetValue("android:name", PlayerSettings.bundleIdentifier);

            permission_C2D_MESSAGE.SetValue("android:protectionLevel", "signature");
        }
        else
        {
            application.RemoveProperty(GcmBroadcastReceiver);
            application.RemoveProperty(GcmIntentService);
            Manifest.RemoveProperty(permission_C2D_MESSAGE);
        }



        ////////////////////////
        //GoogleMobileAdAPI
        ////////////////////////
        UpdateId++;
        AN_ActivityTemplate AdActivity = application.GetOrCreateActivityWithName("com.google.android.gms.ads.AdActivity");



        if (AndroidNativeSettings.Instance.GoogleMobileAdAPI)
        {
            if (launcherActivity != null)
            {
                AN_PropertyTemplate ForwardNativeEventsToDalvik = launcherActivity.GetOrCreatePropertyWithName("meta-data", "unityplayer.ForwardNativeEventsToDalvik");
                ForwardNativeEventsToDalvik.SetValue("android:value", "true");
            }

            AdActivity.SetValue("android:configChanges", "keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize");
        }
        else
        {
            application.RemoveActivity(AdActivity);
        }



        ////////////////////////
        //GoogleButtonAPI
        ////////////////////////
        UpdateId++;
        if (AndroidNativeSettings.Instance.GoogleButtonAPI)
        {
            //Nothing to do
        }



        ////////////////////////
        //LocalNotificationsAPI
        ////////////////////////
        AN_PropertyTemplate LocalNotificationReceiver = application.GetOrCreatePropertyWithName("receiver", "com.androidnative.features.notifications.LocalNotificationReceiver");

        if (AndroidNativeSettings.Instance.LocalNotificationsAPI)
        {
        }
        else
        {
            application.RemoveProperty(LocalNotificationReceiver);
        }

        ////////////////////////
        //ImmersiveModeAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.ImmersiveModeAPI)
        {
            //Nothing to do
        }


        ////////////////////////
        //ApplicationInformationAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.ApplicationInformationAPI)
        {
            //Nothing to do
        }

        ////////////////////////
        //ExternalAppsAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.ExternalAppsAPI)
        {
            //Nothing to do
        }


        ////////////////////////
        //PoupsandPreloadersAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.PoupsandPreloadersAPI)
        {
            //Nothing to do
        }

        ////////////////////////
        //InAppPurchasesAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.InAppPurchasesAPI)
        {
            //Nothing to do
        }


        ////////////////////////
        //CameraAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.CameraAPI)
        {
            //Nothing to do
        }


        ////////////////////////
        //GalleryAPI
        ////////////////////////
        if (AndroidNativeSettings.Instance.GalleryAPI)
        {
            //Nothing to do
        }

        List <string> permissions = GetRequiredPermissions();

        foreach (string p in permissions)
        {
            Manifest.AddPermission(p);
        }

        AN_ManifestManager.SaveManifest();

        SocialPlatfromSettingsEditor.UpdateManifest();
    }
	private void SelectPermission(object data) {
		AN_PropertyTemplate newPermission = new AN_PropertyTemplate ("uses-permission");
		newPermission.SetValue ("android:name", data.ToString ());
		AN_ManifestManager.GetManifest ().AddPermission (newPermission);
	}
示例#18
0
	private static AN_PropertyTemplate ParseProperty(XmlNode node) {
		AN_PropertyTemplate property = new AN_PropertyTemplate (node.Name);
		//Get Values
		foreach (XmlAttribute attr in node.Attributes) {
			property.SetValue(attr.Name, attr.Value);
		}
		//Get Properties
		foreach (XmlNode n in node.ChildNodes) {
			if (!n.Name.Equals("#comment")) {
				property.AddProperty(n.Name, ParseProperty(n));
			}
		}

		return property;
	}