Add AppCenter SDK

This commit is contained in:
Grishka
2022-02-15 23:09:39 +03:00
parent 6a35d78f99
commit 006fde1686
4 changed files with 56 additions and 2 deletions

View File

@@ -4,6 +4,8 @@ import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import java.lang.reflect.InvocationTargetException;
import me.grishka.appkit.imageloader.ImageCache;
import me.grishka.appkit.utils.NetworkUtils;
@@ -21,5 +23,10 @@ public class MastodonApp extends Application{
ImageCache.setParams(params);
NetworkUtils.setUserAgent("MastodonAndroid/"+BuildConfig.VERSION_NAME);
context=getApplicationContext();
// Call the appcenter SDK wrapper through reflection because it is only present in beta builds
try{
Class.forName("org.joinmastodon.android.AppCenterWrapper").getMethod("init", Application.class).invoke(null, this);
}catch(ClassNotFoundException|NoSuchMethodException|IllegalAccessException|InvocationTargetException ignore){}
}
}