Back to project page welcome-android.
The source code is released under:
Copyright (c) 2014 FeedHenry Ltd, All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
If you think the Android project welcome-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.feedhenry.android; /* www . ja v a 2 s .c om*/ import android.app.Activity; import android.app.Application; import android.content.Context; import android.util.Log; import com.feedhenry.android.server.FHAgent; import com.feedhenry.android.utilities.MyToast; import com.feedhenry.sdk.FHActCallback; import com.feedhenry.sdk.FHResponse; public class MyApplication extends Application { private static Context context; private static boolean isInitialised = false; public void onCreate() { super.onCreate(); MyApplication.context = getApplicationContext(); } // Initialize application by connecting to FeedHenry Cloud public static boolean initApp(final Activity activity) { Log.i("FEEDHENRY", "In initApp"); if (FHAgent.isOnline()) { if (activity == null) { initFH(activity); } else { activity.runOnUiThread(new Runnable() { @Override public void run() { initFH(activity); } }); } isInitialised = true; return true; } return false; } // Use FH Agent to connect protected static void initFH(final Activity activity) { FHAgent.init(new FHActCallback() { @Override public void success(FHResponse fhResponse) { activity.runOnUiThread(new Runnable() { @Override public void run() { MyToast.showToast("Connected to FeedHenry"); } }); } @Override public void fail(FHResponse fhResponse) { activity.runOnUiThread(new Runnable() { @Override public void run() { MyToast.showToast("Server connection failed"); } }); } }); } public static boolean initApp() { return initApp(); } public static boolean isInitialised() { return isInitialised; } public static Context getAppContext() { return MyApplication.context; } }