Skip to content

Commit

Permalink
Merge branch 'master' of github.com:swisscodemonkeys/appbrain-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mathijs81 committed Jun 5, 2013
2 parents 9771bfe + d10ab0e commit b66e6d4
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
10 changes: 10 additions & 0 deletions unity/Assets/Plugins/Android/AppBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public static Ads GetAds() {
return new Ads(null);
}
}

public static RemoteSettings GetSettings() {
try {
return new RemoteSettings(appbrain.CallStatic<AndroidJavaObject>("getSettings"));
} catch (Exception e) {
Debug.LogError(e);
return new RemoteSettings(null);
}
}


public static AndroidJavaObject GetCurrentActivity() {
try {
Expand Down
61 changes: 61 additions & 0 deletions unity/Assets/Plugins/Android/RemoteSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (C) 2013 AppBrain
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using UnityEngine;
using System;
using System.Collections;
using System.Runtime.InteropServices;

namespace AppLift {
#if UNITY_ANDROID
public class RemoteSettings
{
private AndroidJavaObject settings;

public RemoteSettings(AndroidJavaObject settings) {
this.settings = settings;
}

public String Get(String key) {
try {
return settings.Call<String>("get", key);
} catch (Exception e) {
Debug.LogError(e);
}
}

public String Get(String key, String defaultValue) {
try {
return settings.Call<String>("get", key, defaultValue);
} catch (Exception e) {
Debug.LogError(e);
}
}

}
#else
public class RemoteSettings {

public String Get(String key) {
return "";
}

public String Get(String key, String defaultValue) {
return "";
}
}
#endif
}

0 comments on commit b66e6d4

Please sign in to comment.