Java Code Examples for cn.bmob.v3.Bmob#initialize()

The following examples show how to use cn.bmob.v3.Bmob#initialize() . 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: BasicActivity.java    From ToDoList with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bmob.initialize(getApplication(), APP_ID);
    //注册网络状态监听广播
    networkReceiver = new NetworkReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
    filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    registerReceiver(networkReceiver, filter);
    isRegistered = true;

    Toasty.Config.getInstance()
            .setSuccessColor(getResources().getColor(R.color.toastSuccess))
            .setErrorColor(getResources().getColor(R.color.toastError))
            .setInfoColor(getResources().getColor(R.color.toastInfo))
            .apply();

}
 
Example 2
Source File: ManagerApplication.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Bmob.initialize(this, "06cefecaee1c01cac71cb2f7de18dc9c");
    BmobInstallationManager.getInstance().initialize(new InstallationListener<BmobInstallation>() {
        @Override
        public void done(BmobInstallation bmobInstallation, BmobException e) {
            if (e == null) {
                CommonLogger.e("初始化成功");
            }else {
                CommonLogger.e("初始化失败"+e.toString());
            }
        }
    });
    BmobPush.startWork(this);
}
 
Example 3
Source File: ChatApplication.java    From NewFastFrame with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Application application) {
    chatMainComponent = DaggerChatMainComponent.builder().appComponent(BaseApplication.getAppComponent())
            .chatMainModule(new ChatMainModule()).build();
    Bmob.initialize(application, ConstantUtil.KEY);
    //        AppStat.i(ConstantUtil.KEY, null);
    LogUtil.e("1服务器端初始化完成");
    CustomInstallation customInstallation = new CustomInstallation();
    customInstallation.save();
    LogUtil.e("设备ID在这里上传了" + customInstallation.getInstallationId());
    BmobPush.startWork(application);
    LogUtil.e("推送服务初始化完成");
    RandomData.initAllRanDomData();
    initRouter();
    initRxBus();
}
 
Example 4
Source File: CustomApplication.java    From TestChat with Apache License 2.0 6 votes vote down vote up
@Override
        public void onCreate() {
                super.onCreate();
//                if (LeakCanary.isInAnalyzerProcess(this)) {
//                        // This process is dedicated to LeakCanary for heap analysis.
//                        // You should not init your app in this process.
//                        return;
//                }
//                LeakCanary.install(this);
                setINSTANCE(this);
                Bmob.initialize(this, Constant.KEY);
                AppStat.i(Constant.KEY, null);
                LogUtil.e("1服务器端初始化完成");
                CustomInstallation.getCurrentInstallation(this).save();
                LogUtil.e("设备ID在这里上传了");
                BmobPush.startWork(this);
                LogUtil.e("推送服务初始化完成");
                initOkHttp();
                initSmallVideo();
                initLocationClient();
//                CrashHandler.getInstance().init(this);
        }
 
Example 5
Source File: NetworkReceiver.java    From ToDoList with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    //**判断当前的网络连接状态是否可用*/
    ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo info = connectivityManager.getActiveNetworkInfo();
    if ( info != null && info.isAvailable()){
        //当前网络状态可用
        Bmob.initialize(context, APP_ID);
        Log.i("网络状态", "网络已连接");
    }else {
        //当前网络不可用
        Log.i("网络状态", "无网络连接");
    }
}
 
Example 6
Source File: SettingActivity.java    From AirFree-Client with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);
    Bmob.initialize(this, "ede7c3d347a0c094bd335bde06c57962");
    init();
}
 
Example 7
Source File: SprintNBA.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
private void initBmob() {
    BmobConfig config = new BmobConfig.Builder(this)
            .setApplicationId("e47d1b58418a7db9bc0f66c3628f11dc")//设置appkey
            .setConnectTimeout(30)//请求超时时间(单位为秒):默认15s
            .setUploadBlockSize(1024 * 1024)//文件分片上传时每片的大小(单位字节),默认512*1024
            .setFileExpiration(2500)//文件的过期时间(单位为秒):默认1800s
            .build();
    Bmob.initialize(config);
}
 
Example 8
Source File: ZfsoftCampusAsstApp.java    From ZfsoftCampusAssit with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Log.d(tag,"CampusAsstApp is initializing...");
    PreferenceUtil.init(getApplicationContext());

    LeakCanary.install(this);
    Bmob.initialize(this, Config.BMOB_APP_ID);
}
 
Example 9
Source File: LoginActivity.java    From SmartOrnament with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_login);
        register = (TextView) findViewById(R.id.txt_register);
//        remember= (CheckBox) findViewById(R.id.cb_remember);
//        auto= (CheckBox) findViewById(R.id.cb_auto);
        prefs = getSharedPreferences("UserData", MODE_PRIVATE);//这玩意不能放在定义全局变量时初始化,否则没用
        //默认初始化
        Bmob.initialize(this, "3a8ad9521be563002de06fcd49efdbc4");//3a8ad9521be563002de06fcd49efdbc4
        initView();
//       if (prefs.getBoolean("remeberPsd",false)){
//
//                usrName.setText(prefs.getString("usr",""));
//                psd.setText(prefs.getString("psd",""));
//              if (prefs.getBoolean("autoLogin",false)){
//
//                    Toast.makeText(MainActivity.this, "登陆成功", Toast.LENGTH_SHORT).show();
//                    Intent intent=new Intent(this,GameActivity.class);
//                    startActivity(intent);
//                }
//        }

        register.setOnClickListener(registerListener);

        login.setOnClickListener(loginListener);

        iv_exit.setOnClickListener(exitListener);
    }
 
Example 10
Source File: LoginActivity.java    From Swface with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_login);
	//第一:默认初始化
	Bmob.initialize(this, "6e64317b6509bb503f7d9ab8404bf54c");
	findView();
	initOnClick();
	initDate();
}
 
Example 11
Source File: MyApplication.java    From Swface with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
	super.onCreate();
	//第一:默认初始化
	Bmob.initialize(this, "6e64317b6509bb503f7d9ab8404bf54c");
	Log.i("onCreate: ","bmob!!!!");
}
 
Example 12
Source File: MainApplication.java    From SuperNote with GNU General Public License v3.0 4 votes vote down vote up
private void initBmob(){
    Bmob.initialize(this,getResources().getString(R.string.bmob_app_id));
}
 
Example 13
Source File: DatabaseAdapter.java    From Swface with Apache License 2.0 4 votes vote down vote up
public DatabaseAdapter(Context context) {
	this.context = context;
	databaseHelper = new DatabaseHelper(context);
	//第一:默认初始化
	Bmob.initialize(context, "6e64317b6509bb503f7d9ab8404bf54c");
}
 
Example 14
Source File: BmobDataHelper.java    From Swface with Apache License 2.0 4 votes vote down vote up
public BmobDataHelper(Context context, Handler myHandler) {
	this.context = context;
	this.myHandler = myHandler;
	//第一:默认初始化
	Bmob.initialize(context, "6e64317b6509bb503f7d9ab8404bf54c");
}
 
Example 15
Source File: PigeonApplication.java    From Pigeon with MIT License 4 votes vote down vote up
@Override
public void initConfigs() {
    initSophix();
    Bmob.initialize(this, BmobConfig.APPID);
}
 
Example 16
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());
    }
 
Example 17
Source File: SplashActivity.java    From Conquer with Apache License 2.0 4 votes vote down vote up
private void initBmob() {
    // 可设置调试模式,当为true的时候,会在logcat的BmobChat下输出一些日志,包括推送服务是否正常运行,如果服务端返回错误,也会一并打印出来。方便开发者调试
    BmobChat.DEBUG_MODE = true;
    Bmob.initialize(getApplicationContext(), Constants.BMOB_KEY);
    BmobChat.getInstance(getApplicationContext()).init(Constants.BMOB_KEY);
}
 
Example 18
Source File: BaseActivity.java    From ZhihuDaily with MIT License 4 votes vote down vote up
protected void initVariables() {
    mDBManager = DBManager.getInstance(getApplicationContext());
    Bmob.initialize(getApplicationContext(), Constant.APPLICATION_ID);
}
 
Example 19
Source File: MHApplicaiton.java    From mhzs with MIT License 4 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Bmob.initialize(this, "0053ab880ceb939700414994235c4adf");
}
 
Example 20
Source File: BmobHelper.java    From Jide-Note with MIT License 4 votes vote down vote up
/**
 * 初始化Bmob
 * @param context
 */
public static void initBmob(Context context){
    String bmobId = context.getResources().getString(R.string.bmob_id);
    Bmob.initialize(context,bmobId);
}