@Override public void onReceive(Context context, Intent intent) { Log.d(LOGTAG, "BootReceiverr.onReceive()..."); String action = intent.getAction(); Log.d(LOGTAG, "action=" + action); // 启动推送服务 serviceManager = new ServiceManager(context); serviceManager.startService(); }
@Override public void onReceive(Context context, Intent intent) { // 判断用户是否勾选了开机自启 Toast.makeText(context, "推送已自动开启", 1).show(); SharedPreferences pref = context.getSharedPreferences(Constants.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); if (pref.getBoolean(Constants.SETTINGS_AUTO_START, true)) { ServiceManager serviceManager = new ServiceManager(context); serviceManager.setNotificationIcon(R.drawable.notification); serviceManager.startService(); } }