Java Code Examples for com.mob.MobSDK#init()

The following examples show how to use com.mob.MobSDK#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyApplication.java    From PoetryWeather with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    context = getApplicationContext();
    LitePal.initialize(context);
    LitePal.getDatabase();
    //初始化随机获取诗词
    JinrishiciClient.getInstance().init(this);
    QMUISwipeBackActivityManager.init(this);
    //注册Mob
    MobSDK.init(this);
    //注册和风天气
    HeConfig.init("HE1808181021011344","c6a58c3230694b64b78facdebd7720fb");
    HeConfig.switchToFreeServerNode();
    QMUISwipeBackActivityManager.init(this);

}
 
Example 2
Source File: TestActivity.java    From BBSSDK-for-Android with Apache License 2.0 6 votes vote down vote up
@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MobSDK.init(this);
		setContentView(ResHelper.getLayoutRes(this, "layout_test"));
		cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView"));
		btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest"));
		btnTest.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
//                cleverImageView.setOval(false);
				cleverImageView.setBorderColor(Color.BLUE);
				cleverImageView.setBorderWidthDP(2);
				cleverImageView.setCornerRadiiDP(10, 5, 20, 30);
				cleverImageView.setImageUrl(IMAGE_URL);
			}
		});
	}
 
Example 3
Source File: EnjoyshopApplication.java    From enjoyshop with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mInstance = this;
    // 通过代码注册你的AppKey和AppSecret
    MobSDK.init(this, "201f8a7a91c30", "c63ec5c1eeac1f873ec78c1365120431");

    sContext = getApplicationContext();
    initUser();
    Utils.init(this);

    locationService = new LocationService(getApplicationContext());
    mVibrator = (Vibrator) getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);

    setDatabase();

}
 
Example 4
Source File: OnekeyShare.java    From YiZhi with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	if (!(context instanceof MobApplication)) {
		MobSDK.init(context.getApplicationContext());
	}

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
Example 5
Source File: InitActivity.java    From BBSSDK-for-Android with Apache License 2.0 5 votes vote down vote up
private boolean initAndStartMainActivity(String key, String secret) {
	if (StringUtils.isEmpty(key) || !key.matches(REGREX_KEY)) {
		ToastUtils.showToast(InitActivity.this, getStringByResName("bbs_init_illegalkey"));
		return false;
	}

	if (StringUtils.isEmpty(secret) || !secret.matches(REGREX_SECRET)) {
		ToastUtils.showToast(InitActivity.this, getStringByResName("bbs_init_illegalsecret"));
		return false;
	}

	MobSDK.init(InitActivity.this, key, secret);
	registerMainThreadUncaughtExceptioinHandler();
	if (initTheme != null) {
		if (initTheme == 0) {
			BBSTheme0.init();
		} else {
			BBSTheme1.init();
		}
	}
	//init success or fail?
	finish();
	Intent intent = new Intent(InitActivity.this, MainActivity.class);
	startActivity(intent);

	//open web link page if valid
	if (!StringUtils.isEmpty(strFid) && !StringUtils.isEmpty(strTid)) {
		final PageForumThreadDetail details = BBSViewBuilder.getInstance().buildPageForumThreadDetail();
		details.setForumThread(Long.parseLong(strFid), Long.parseLong(strTid), "");
		UIHandler.sendMessageDelayed(null, 300, new Handler.Callback() {
			@Override
			public boolean handleMessage(Message msg) {
				details.show(InitActivity.this);
				return false;
			}
		});
	}
	return true;
}
 
Example 6
Source File: OnekeyShare.java    From enjoyshop with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	if (!(context instanceof MobApplication)) {
		MobSDK.init(context.getApplicationContext());
	}

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
Example 7
Source File: OnekeyShare.java    From LQRWeChat with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void show(Context context) {
	HashMap<String, Object> shareParamsMap = new HashMap<String, Object>();
	shareParamsMap.putAll(params);

	MobSDK.init(context.getApplicationContext());
	ShareSDK.initSDK(context);

	// 打开分享菜单的统计
	ShareSDK.logDemoEvent(1, null);

	int iTheme = 0;
	try {
		iTheme = ResHelper.parseInt(String.valueOf(shareParamsMap.remove("theme")));
	} catch (Throwable t) {}
	OnekeyShareTheme theme = OnekeyShareTheme.fromValue(iTheme);
	OnekeyShareThemeImpl themeImpl = theme.getImpl();

	themeImpl.setShareParamsMap(shareParamsMap);
	themeImpl.setDialogMode(shareParamsMap.containsKey("dialogMode") ? ((Boolean) shareParamsMap.remove("dialogMode")) : false);
	themeImpl.setSilent(shareParamsMap.containsKey("silent") ? ((Boolean) shareParamsMap.remove("silent")) : false);
	themeImpl.setCustomerLogos((ArrayList<CustomerLogo>) shareParamsMap.remove("customers"));
	themeImpl.setHiddenPlatforms((HashMap<String, String>) shareParamsMap.remove("hiddenPlatforms"));
	themeImpl.setPlatformActionListener((PlatformActionListener) shareParamsMap.remove("callback"));
	themeImpl.setShareContentCustomizeCallback((ShareContentCustomizeCallback) shareParamsMap.remove("customizeCallback"));
	if (shareParamsMap.containsKey("disableSSO") ? ((Boolean) shareParamsMap.remove("disableSSO")) : false) {
		themeImpl.disableSSO();
	}

	themeImpl.show(context.getApplicationContext());
}
 
Example 8
Source File: P2PApplication.java    From iMoney with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mContext = this.getApplicationContext();
    LeakCanary.install(this);
    CommonApplication.initialize(this);
    OklaClient.getInstance().init(this);
    // 设置出现未捕获异常时的处理类
    //CrashHandler.getInstance().init();
    changeAppLanguage();

    // 初始化MobSDK
    MobSDK.init(this, "266ce6392d6fe", "6d4da648f3c2eef26eb682641d414c1c");

    /*
     * 第三个参数为SDK调试模式开关,调试模式的行为特性如下:
     * 输出详细的Bugly SDK的Log;
     * 每一条Crash都会被立即上报;
     * 自定义日志将会在Logcat中输出。
     * 建议在测试阶段建议设置成true,发布时设置为false。
     */
    CrashReport.initCrashReport(getApplicationContext(), "c84e7e9ad7", BuildConfig.DEBUG);

    initUETool();

    initGrowingIO();

    initJPushSdk();
}
 
Example 9
Source File: HApp.java    From styT with Apache License 2.0 4 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();
        BGASwipeBackHelper.init(this, null);
        if (isMainProcess()) {
            OpenInstall.init(this);
            OpenInstall.setDebug(true);
        }

        context = getApplicationContext();
/*
        Context context = getApplicationContext();
// 获取当前包名
        String packageName = context.getPackageName();
// 获取当前进程名
        String processName = getProcessName(android.os.Process.myPid());
// 设置是否为上报进程
        CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
        strategy.setUploadProcess(processName == null || processName.equals(packageName));
// 初始化Bugly
        CrashReport.initCrashReport(context, "34c3176b4a", false, strategy);
 */


        CrashReport.initCrashReport(getApplicationContext(), "34c31", false);
        SharedPreferencesUtil.getInstance(this, "TestBILI");
        Bmob.initialize(this, "", "dio");
        //Bmob.initialize(this, nico.GetPathFromUri4kitkat.jk("~#~~~……~、~_•%~~•~•&•%~&•%•&~&~~~¥~、~#~~~>•#~&~>~、~、~#~#~>~、•&•~•_"));
        // 使用推送服务时的初始化操作
        BmobInstallationManager.getInstance().initialize(new InstallationListener<BmobInstallation>() {
            @Override
            public void done(BmobInstallation bmobInstallation, BmobException e) {
                // if (e == null) {
                //Logger.i(bmobInstallation.getObjectId() + "-" + bmobInstallation.getInstallationId());
                // } else {
                // Logger.e(e.getMessage());
                // }
            }
        });
// 启动推送服务
        BmobPush.startWork(this);
        MobSDK.init(this, this.a(), this.b());
        //初始化辅助功能基类
        BaseAccessibilityService.getInstance().init(getApplicationContext());
        SettingConfig.getInstance().init(getApplicationContext());
        //Exce handler = Exce.getInstance(this);
        //Thread.setDefaultUncaughtExceptionHandler(handler);

        // 异常处理,不需要处理时注释掉这两句即可!
        //CrashHandler crashHandler = CrashHandler.getInstance();
        // 注册crashHandler
        //crashHandler.init(getApplicationContext());
    }