Java Code Examples for cn.jpush.android.api.JPushInterface#init()

The following examples show how to use cn.jpush.android.api.JPushInterface#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: MainActivity.java    From QuickNews with MIT License 6 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fresco.initialize(this);
        JPushInterface.init(this);
        System.out.println("JPushInterface.getRegistrationID");
        JPushInterface.init(getApplicationContext());
        String rid = JPushInterface.getRegistrationID(getApplicationContext());
        System.out.println("JPushInterface.getRegistrationID" + rid);
        setContentView(R.layout.activity_main);
        ActionBar actionBar = getSupportActionBar();
        actionBar.hide();


        initView();


        mNetReceiver = new NetWorkChangeReceiver();
        IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
        registerReceiver(mNetReceiver, filter);
        NetWorkState.mNetState = NetWorkState.isConn(MainActivity.this);


//        registerMessageReceiver();  // used for receive msg

    }
 
Example 2
Source File: GosPushManager.java    From gokit-android with MIT License 5 votes vote down vote up
/**
 * 此方法完成了初始化JPush SDK等功能 但仍需在MainActivity的onResume和onPause添加相应方法
 * JPushInterface.onResume(context); JPushInterface.onPause(context);
 * 
 * @param context
 */
public void jPush() {
	// 设置JPush调试模式
	JPushInterface.setDebugMode(true);

	// 初始化JPushSDK
	JPushInterface.init(context);

}
 
Example 3
Source File: GosPushManager.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
/**
 * 此方法完成了初始化JPush SDK等功能 但仍需在MainActivity的onResume和onPause添加相应方法
 * JPushInterface.onResume(context); JPushInterface.onPause(context);
 * 
 * @param context
 */
public void jPush() {
	// 设置JPush调试模式
	JPushInterface.setDebugMode(true);

	// 初始化JPushSDK
	JPushInterface.init(context);

}
 
Example 4
Source File: App.java    From phphub-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fresco.initialize(this);
    LeakCanary.install(this);
    JPushInterface.setDebugMode(BuildConfig.DEBUG);
    JPushInterface.init(this);

    initializeInjector();
    initializeInjectorApi();

    Iconify.with(new FontAwesomeModule());
}
 
Example 5
Source File: GosPushManager.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
/**
 * 此方法完成了初始化JPush SDK等功能 但仍需在MainActivity的onResume和onPause添加相应方法
 * JPushInterface.onResume(context); JPushInterface.onPause(context);
 * 
 * @param context
 */
public void jPush() {
	// 设置JPush调试模式
	JPushInterface.setDebugMode(true);

	// 初始化JPushSDK
	JPushInterface.init(context);

}
 
Example 6
Source File: JPushManager.java    From AndroidPush with Apache License 2.0 5 votes vote down vote up
@Override
public void register(Context context, boolean debug, PushInterface pushInterface) {
    if (pushInterface != null) {
        JPushReceiver.registerInterface(pushInterface);
    }
    JPushInterface.init(context);
    JPushInterface.setDebugMode(debug);
}
 
Example 7
Source File: BaseApplication.java    From QuickNews with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    Log.d(TAG, "[ExampleApplication] onCreate");
    super.onCreate();

    JPushInterface.setDebugMode(true); 	// 设置开启日志,发布时请关闭日志
    JPushInterface.init(this);     		// 初始化 JPush
}
 
Example 8
Source File: RLPushHelper.java    From Roid-Library with Apache License 2.0 5 votes vote down vote up
/**
 * @param isDebug
 */
public void init(boolean isDebug) {
    JPushInterface.setDebugMode(isDebug);
    JPushInterface.init(mContext);
    JPushInterface.setLatestNotifactionNumber(mContext, LASTEST_NOTIFICATION_NUMBER);
    BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(mContext);
    builder.notificationFlags = Notification.FLAG_AUTO_CANCEL;
    builder.notificationDefaults = Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE;
    builder.developerArg0 = "data";
    JPushInterface.setPushNotificationBuilder(1, builder);
}
 
Example 9
Source File: App.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();

        app = this;

        // 存放所有activity的集合
        mActivityList = new ArrayList<>();

        // 初始化app异常处理器 - 打包的时候开启
//        CrashHandler handler = CrashHandler.getInstance();
//        handler.init(getApplicationContext());

        // 初始化OkHttpUtils
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        OkHttpUtils.initClient(okHttpClient);

        // 初始化Fresco
        ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
                .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
                .build();
        Fresco.initialize(this, config);

        // 初始化ShareSDK
        ShareSDK.initSDK(this);

        // 初始化JPush
        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);

        // 更新用户登录状态
        UserBean.updateUserInfoFromNetwork(new UserBean.OnUpdatedUserInfoListener());

    }
 
Example 10
Source File: LetvApplication.java    From letv with Apache License 2.0 5 votes vote down vote up
public void init() {
    super.init();
    LogInfo.log("zhuqiao", "call init");
    initInMainProcess();
    JPushInterface.setDebugMode(false);
    JPushInterface.init(this);
    this.mLeBoxApp = LeBoxApp.getInstanced();
    this.mLeBoxApp.init((Application) this);
    if (NetworkUtils.isUnicom3G(true)) {
        ((IWoFlowManager) JarLoader.invokeStaticMethod(JarLoader.loadClass(this, JarConstant.LETV_WO_NAME, JarConstant.LETV_WO_PACKAGENAME, "WoFlowManager"), "getInstance", null, null)).initSDK(this, Boolean.valueOf(false));
        LogInfo.log("zhuqiao", "init wo");
        this.mUnicomFreeInfoCache = new UnicomFreeInfoCache();
    }
    initLetvMediaPlayerManager();
    setVType();
    LetvPushService.schedule(this);
    startCde();
    LetvHttpApiConfig.initialize(Global.PCODE, Global.VERSION);
    LeboxApiManager.getInstance().setLetvMediaPlayer(new LetvMediaPlayer(this) {
        final /* synthetic */ LetvApplication this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void doPlay(Context context, LeboxVideoBean video) {
            LogInfo.log("zhuqiao", "vid:" + video.vid + ";videoUrl:" + video.videoURL);
            LeMessageManager.getInstance().dispatchMessage(new LeMessage(1, new AlbumPlayActivityConfig(context).createLebox(video)));
        }
    });
}
 
Example 11
Source File: PushManager.java    From SimpleProject with MIT License 5 votes vote down vote up
public void initPush(Context context, String appId, String appKey, PushListener listener) {
	if (RomUtil.isMiui()) {
		MiPushClient.registerPush(context.getApplicationContext(), appId, appKey);
	} else if (RomUtil.isEmui()) {
		initHWPush(context.getApplicationContext());
	} else {
		JPushInterface.init(context.getApplicationContext());
	}
	mListener = listener;
}
 
Example 12
Source File: P2PApplication.java    From iMoney with Apache License 2.0 4 votes vote down vote up
private void initJPushSdk() {
    JPushInterface.setDebugMode(BuildConfig.DEBUG);
    JPushInterface.init(this);
}
 
Example 13
Source File: InitHelper.java    From AndroidAll with Apache License 2.0 4 votes vote down vote up
public static void initJPush(Context context) {
    JPushInterface.init(context.getApplicationContext());
    JPushInterface.setAlias(context.getApplicationContext(), 0, "deviceidxxxx000xxx");
}
 
Example 14
Source File: AppApplication.java    From fvip with Apache License 2.0 4 votes vote down vote up
private void initJpush() {
    JPushInterface.init(this);
    JPushInterface.setDebugMode(true);//如果时正式版就改成false
    JAnalyticsInterface.init(this);
}
 
Example 15
Source File: MainActivity.java    From HaiNaBaiChuan with Apache License 2.0 4 votes vote down vote up
private void init(){
	 JPushInterface.init(getApplicationContext());
}
 
Example 16
Source File: MyApplication.java    From MyHearts with Apache License 2.0 4 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();

        mInstance = this;

        dbManager = new DBManager(getApplicationContext());
        dbManager.openDatabase();

        NineGridView.setImageLoader(new PicassoImageLoader());

        Bmob.initialize(this, "6d7ed6a006f2606890427bf70345cdb9");

        if (flag == true) {
            flag = false;
            BmobUpdateAgent.initAppVersion();
        }

        JPushInterface.init(this);            // 初始化 JPush


        //短信验证

        SMSSDK.initSDK(this, ManifestUtil.getMetaDataValue(this, "mob_sms_appKey"),
                ManifestUtil.getMetaDataValue(this, "mob_sms_appSecrect"));


        OkGo.init(this);

        //以下设置的所有参数是全局参数,同样的参数可以在请求的时候再设置一遍,那么对于该请求来讲,请求中的参数会覆盖全局参数
        //好处是全局参数统一,特定请求可以特别定制参数
        try {
            //以下都不是必须的,根据需要自行选择,一般来说只需要 debug,缓存相关,cookie相关的 就可以了
            OkGo.getInstance()

                    //打开该调试开关,控制台会使用 红色error 级别打印log,并不是错误,是为了显眼,不需要就不要加入该行
                    .debug("OkGo")

                    //如果使用默认的 60秒,以下三行也不需要传
                    .setConnectTimeout(OkGo.DEFAULT_MILLISECONDS)  //全局的连接超时时间
                    .setReadTimeOut(OkGo.DEFAULT_MILLISECONDS)     //全局的读取超时时间
                    .setWriteTimeOut(OkGo.DEFAULT_MILLISECONDS)    //全局的写入超时时间

                    //可以全局统一设置缓存模式,默认是不使用缓存,可以不传,具体其他模式看 github 介绍 https://github.com/jeasonlzy0216/
                    .setCacheMode(CacheMode.NO_CACHE)

                    //可以全局统一设置缓存时间,默认永不过期,具体使用方法看 github 介绍
                    .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)

                    //如果不想让框架管理cookie,以下不需要
//                .setCookieStore(new MemoryCookieStore())                //cookie使用内存缓存(app退出后,cookie消失)
                    .setCookieStore(new PersistentCookieStore());        //cookie持久化存储,如果cookie不过期,则一直有效

            //可以设置https的证书,以下几种方案根据需要自己设置
//                    .setCertificates()                                  //方法一:信任所有证书(选一种即可)
//                    .setCertificates(getAssets().open("srca.cer"))      //方法二:也可以自己设置https证书(选一种即可)
//                    .setCertificates(getAssets().open("aaaa.bks"), "123456", getAssets().open("srca.cer"))//方法三:传入bks证书,密码,和cer证书,支持双向加密

            //可以添加全局拦截器,不会用的千万不要传,错误写法直接导致任何回调不执行
//                .addInterceptor(new Interceptor() {
//                    @Override
//                    public Response intercept(Chain chain) throws IOException {
//                        return chain.proceed(chain.request());
//                    }
//                })

            //这两行同上,不需要就不要传
            // .addCommonHeaders(headers)                                         //设置全局公共头
            // .addCommonParams(params);                                          //设置全局公共参数
        } catch (Exception e) {
            e.printStackTrace();
        }
        // initUser();
        //  Fresco.initialize(this);

//ID1105704769

        //    mTencent = Tencent.createInstance("1105704769", this);


    }
 
Example 17
Source File: MainActivityDrawerLayout.java    From MyHearts with Apache License 2.0 4 votes vote down vote up
private void init() {
    JPushInterface.init(getApplicationContext());
}
 
Example 18
Source File: LQBApp.java    From AndroidFrame with Apache License 2.0 4 votes vote down vote up
/**
 * 初始化极光推送sdk
 */
private void initJpushSDK() {
    JPushInterface.setDebugMode(true);
    JPushInterface.init(this);
}
 
Example 19
Source File: PerformanceApp.java    From android-performance with MIT License 4 votes vote down vote up
private void initJPush() {
    JPushInterface.init(this);
    JPushInterface.setAlias(this, 0, mDeviceId);
}
 
Example 20
Source File: CompatibilityDemoInit.java    From ans-android-sdk with GNU General Public License v3.0 4 votes vote down vote up
private static void initJPush() {
    JPushInterface.setDebugMode(true);
    JPushInterface.init(mContext);
}