@Override public void onCreate() { super.onCreate(); File cacheDir = new File(Environment.getExternalStorageDirectory(), "Midipile/Cache"); DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .showImageOnLoading(android.R.color.white) .showImageForEmptyUri(android.R.color.white) .displayer(new FadeInBitmapDisplayer(500)) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .diskCache(new UnlimitedDiscCache(cacheDir)) .build(); ImageLoader.getInstance().init(config); // set log to true Logger.DEBUG_WITH_STACKTRACE = true; // initialize facebook configuration Permission[] permissions = new Permission[] {Permission.PUBLIC_PROFILE, Permission.EMAIL}; SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder() .setAppId(getString(R.string.app_id)) .setNamespace("midipile") .setPermissions(permissions) .setDefaultAudience(SessionDefaultAudience.FRIENDS) .setAskForAllPermissionsAtOnce(true) .build(); SimpleFacebook.setConfiguration(configuration); }
@Override public void onCreate() { super.onCreate(); MMX.init(this, R.raw.whisper); SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder() .setAppId(getString(R.string.app_id)) .setNamespace(Constants.APP_NS) .setPermissions(Constants.permissions) .build(); SimpleFacebook.setConfiguration(configuration); Instance = this; applicationHandler = new Handler(getInstance().getMainLooper()); NativeLoader.initNativeLibs(App.getInstance()); MMX.registerWakeupBroadcast(new Intent("MY_WAKEUP_ACTION")); MMX.registerListener( new MMX.EventListener() { @Override public boolean onMessageReceived(MMXMessage mmxMessage) { // sendNotification(mmxMessage); return true; } @Override public boolean onLoginRequired(MMX.LoginReason reason) { if (reason == MMX.LoginReason.SERVICE_UNAVAILABLE) attemptLogin(); else if (reason == MMX.LoginReason.DISCONNECTED) attemptLogin(); else if (reason == MMX.LoginReason.SERVICE_AVAILABLE) {; } else if (reason == MMX.LoginReason.CREDENTIALS_EXPIRED) goToLoginActivity(); return true; } }); }