List of usage examples for android.content IntentFilter setPriority
public final void setPriority(int priority)
From source file:org.videolan.vlc.AudioService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance try {/*from w w w .ja va 2s.co m*/ mLibVLC = Util.getLibVlcInstance(); } catch (LibVlcException e) { e.printStackTrace(); } Thread.setDefaultUncaughtExceptionHandler(new VlcCrashHandler()); mCallback = new HashMap<IAudioServiceCallback, Integer>(); mMediaList = new ArrayList<Media>(); mPrevious = new Stack<Media>(); mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(VLCApplication.SLEEP_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!Util.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } AudioUtil.prepareCacheFolder(this); }
From source file:org.videolan.myvlc.core.mediaController.AudioService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance // try { // mLibVLC = Util.getLibVlcInstance(); // } catch (LibVlcException e) { // e.printStackTrace(); // }//from w w w .j ava 2 s . c om // mCallback = new HashMap<IAudioServiceCallback, Integer>(); mMediaList = new ArrayList<Media>(); mPrevious = new Stack<Media>(); // mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(ACTION_WIDGET_INIT); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(MyVLCApp.SLEEP_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!Util.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } //AudioUtil.prepareCacheFolder(this); }
From source file:org.videolan.vlc.MediaService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance try {// w w w. ja v a 2s .com mLibVLC = Util.getLibVlcInstance(); } catch (LibVlcException e) { e.printStackTrace(); } Thread.setDefaultUncaughtExceptionHandler(new VlcCrashHandler()); mCallback = new HashMap<IMediaServiceCallback, Integer>(); mMediaList = new ArrayList<Media>(); mPrevious = new Stack<Media>(); mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(VLCApplication.SLEEP_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!Util.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } AudioUtil.prepareCacheFolder(this); }
From source file:com.lover.main.ResideMenu.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) { // ??home???appcrash // fragment?? DemoApplication.getInstance().logout(null); finish();//from www . jav a 2s . c o m startActivity(new Intent(this, LoginActivity.class)); return; } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) { // T??home???appcrash // fragment?? finish(); startActivity(new Intent(this, LoginActivity.class)); return; } setContentView(R.layout.activity_main); initView(); initMenu(); setListener(); // MobclickAgent.setDebugMode( true ); MobclickAgent.updateOnlineConfig(this); if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) { showConflictDialog(); } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) { showAccountRemovedDialog(); } inviteMessgeDao = new InviteMessgeDao(this); userDao = new UserDao(this); // fragment??? // chatHistoryFragment = new ChatHistoryFragment(); // ?fragment chatHistoryFragment = new MFirstFragment(); contactListFragment = new MSecondFragment(); settingFragment = new MThirdFragment(); fragments = new Fragment[] { chatHistoryFragment, contactListFragment, settingFragment }; // fragment getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, chatHistoryFragment) .add(R.id.fragment_container, contactListFragment).hide(contactListFragment) .show(chatHistoryFragment).commit(); // ?BroadcastReceiver msgReceiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); intentFilter.setPriority(3); registerReceiver(msgReceiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(3); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); //??BroadcastReceiver IntentFilter cmdMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getCmdMessageBroadcastAction()); cmdMessageIntentFilter.setPriority(3); registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter); // ?BroadcastReceiver // IntentFilter offlineMessageIntentFilter = new // IntentFilter(EMChatManager.getInstance() // .getOfflineMessageBroadcastAction()); // registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter); // setContactListener??? EMContactManager.getInstance().setContactListener(new MyContactListener()); // ??listener EMChatManager.getInstance().addConnectionListener(new MyConnectionListener()); // ?listener EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener()); // sdkUI ??receiverlistener, ??broadcast EMChat.getInstance().setAppInited(); }
From source file:com.givon.anhao.activity.AnhaoMainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mWL = getWindow().getAttributes();//from w ww.j a va2s . c o m initView(); mTitleBar = (AppTitleBar) findViewById(R.id.titlebar); mTitleBar.setBackOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mSlideMenu.isOpened()) { mSlideMenu.closeMenu(); } else { mSlideMenu.openMenu(); } } }); mTitleBar.setMoreIcon(R.drawable.back_icon); mTitleBar.setMoreOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (isGroup) { isGroup = false; FragmentTransaction trx = getSupportFragmentManager().beginTransaction(); trx.hide(fragments[0]); if (!fragments[1].isAdded()) { trx.add(R.id.fragment_container, fragments[1]); } trx.show(fragments[1]).commit(); } else { isGroup = true; FragmentTransaction trx = getSupportFragmentManager().beginTransaction(); trx.hide(fragments[1]); if (!fragments[0].isAdded()) { trx.add(R.id.fragment_container, fragments[0]); } trx.show(fragments[0]).commit(); } } }); // SDK ? IntentFilter iFilter = new IntentFilter(); iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR); iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR); mReceiver = new SDKReceiver(); registerReceiver(mReceiver, iFilter); inviteMessgeDao = new InviteMessgeDao(this); userDao = new UserDaoOld(this); chatHistoryFragment = new ChatHistoryFragment(); // contactListFragment = new ContactlistFragment(); groupFragment = new GroupFragment(); fragments = new Fragment[] { groupFragment, chatHistoryFragment }; // fragment getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, groupFragment) .add(R.id.fragment_container, chatHistoryFragment).hide(chatHistoryFragment).show(groupFragment) .commit(); mSlideMenu.clearIgnoredViewList(); // ?BroadcastReceiver msgReceiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); intentFilter.setPriority(3); registerReceiver(msgReceiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(3); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // setContactListener??? EMContactManager.getInstance().setContactListener(new MyContactListener()); // ??listener EMChatManager.getInstance().addConnectionListener(new MyConnectionListener()); // ?listener EMGroupManager.getInstance().addGroupChangeListener(new MyGroupChangeListener()); // sdkUI ??receiverlistener, ??broadcast EMChat.getInstance().setAppInited(); }
From source file:com.cpic.taylor.logistics.activity.HomeActivity.java
public void registerMessageReceiver() { mMessageReceiver = new MessageReceiver(); IntentFilter filter = new IntentFilter(); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); filter.addAction(MESSAGE_RECEIVED_ACTION); registerReceiver(mMessageReceiver, filter); }
From source file:com.cpic.taylor.logistics.activity.HomeActivity.java
public void registerConnectKickedReceive() { connectKickedReceiveBroadCast = new ConnectKickedReceiveBroadCast(); IntentFilter filter = new IntentFilter(); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); filter.addAction(KICKED_OFFLINE_BY_OTHER_CLIENT); registerReceiver(connectKickedReceiveBroadCast, filter); }
From source file:com.yamin.kk.service.AudioService.java
@Override public void onCreate() { super.onCreate(); // Get libVLC instance try {/*from w w w . ja va2s . c o m*/ mLibVLC = Util.getLibVlcInstance(); } catch (LibVlcException e) { e.printStackTrace(); } mCallback = new HashMap<IAudioServiceCallback, Integer>(); mCurrentIndex = -1; mPrevious = new Stack<Integer>(); mEventHandler = EventHandler.getInstance(); mRemoteControlClientReceiverComponent = new ComponentName(getPackageName(), RemoteControlClientReceiver.class.getName()); // Make sure the audio player will acquire a wake-lock while playing. If we don't do // that, the CPU might go to sleep while the song is playing, causing playback to stop. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); IntentFilter filter = new IntentFilter(); filter.setPriority(Integer.MAX_VALUE); filter.addAction(ACTION_REMOTE_BACKWARD); filter.addAction(ACTION_REMOTE_PLAYPAUSE); filter.addAction(ACTION_REMOTE_PLAY); filter.addAction(ACTION_REMOTE_PAUSE); filter.addAction(ACTION_REMOTE_STOP); filter.addAction(ACTION_REMOTE_FORWARD); filter.addAction(ACTION_REMOTE_LAST_PLAYLIST); filter.addAction(ACTION_WIDGET_INIT); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(VLCApplication.SLEEP_INTENT); registerReceiver(serviceReceiver, filter); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); boolean stealRemoteControl = pref.getBoolean("enable_steal_remote_control", false); if (!Util.isFroyoOrLater() || stealRemoteControl) { /* Backward compatibility for API 7 */ filter = new IntentFilter(); if (stealRemoteControl) filter.setPriority(Integer.MAX_VALUE); filter.addAction(Intent.ACTION_MEDIA_BUTTON); mRemoteControlClientReceiver = new RemoteControlClientReceiver(); registerReceiver(mRemoteControlClientReceiver, filter); } }
From source file:com.ysls.imhere.ChatActivity.java
private void setUpView() { activityInstance = this; iv_emoticons_normal.setOnClickListener(this); iv_emoticons_checked.setOnClickListener(this); // position = getIntent().getIntExtra("position", -1); clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); // ???/*from www . j a va2s. com*/ chatType = getIntent().getIntExtra("chatType", CHATTYPE_SINGLE); if (chatType == CHATTYPE_SINGLE) { // ?? toChatUsername = getIntent().getStringExtra("userId"); ((TextView) findViewById(R.id.name)).setText(toChatUsername); } else { // ? findViewById(R.id.container_to_group).setVisibility(View.VISIBLE); findViewById(R.id.container_remove).setVisibility(View.GONE); toChatUsername = getIntent().getStringExtra("groupId"); group = EMGroupManager.getInstance().getGroup(toChatUsername); ((TextView) findViewById(R.id.name)).setText(group.getGroupName()); } conversation = EMChatManager.getInstance().getConversation(toChatUsername); // ?0 conversation.resetUnsetMsgCount(); adapter = new MessageAdapter(this, toChatUsername, chatType); // ? listView.setAdapter(adapter); listView.setOnScrollListener(new ListScrollListener()); int count = listView.getCount(); if (count > 0) { listView.setSelection(count - 1); } listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { hideKeyboard(); more.setVisibility(View.GONE); iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); expressionContainer.setVisibility(View.GONE); btnContainer.setVisibility(View.GONE); return false; } }); // ? receiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); // Mainacitivity,??chat?????? intentFilter.setPriority(5); registerReceiver(receiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(5); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // show forward message if the message is not null String forward_msg_id = getIntent().getStringExtra("forward_msg_id"); if (forward_msg_id != null) { // ????? forwardMessage(forward_msg_id); } }
From source file:cn.kangeqiu.kq.activity.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent"); if (mContent == null) mContent = new FragmentMatch(R.color.red); // set the Above View setContentView(R.layout.content_frame); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mContent).commit(); // set the Behind View setBehindContentView(R.layout.menu_frame); menuFragment = new MenuFragment(); personFragment = new MineActivity(); getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, menuFragment).commit(); // customize the SlidingMenu getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); context = this; if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) { // ??home???appcrash // fragment?? BaseApplication.getInstance().logout(null); finish();/*from w w w . j av a2 s.co m*/ startActivity(new Intent(this, LoginActivity.class)); return; } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) { // T??home???appcrash // fragment?? finish(); startActivity(new Intent(this, LoginActivity.class)); return; } setContentView(R.layout.activity_main); initView(); // MobclickAgent.setDebugMode( true ); // --?-- // MobclickAgent.updateOnlineConfig(this); if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) { showConflictDialog(); } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) { showAccountRemovedDialog(); } inviteMessgeDao = new InviteMessgeDao(this); userDao = new UserDao(this); // fragment??? // chatHistoryFragment = new ChatHistoryFragment(); // ?fragment chatHistoryFragment = new ChatAllHistoryFragment(); // contactListFragment = new ContactlistFragment(); // settingFragment = new SettingsFragment(); teamFragment = new FragmentMatch(); dataFragment = new FragmentData(); // nearbyFragment = new FragmentNearbyNew(); // finderFragment = new FragmentFinder(); // fragments = new Fragment[] { chatHistoryFragment, // nearbyFragment,finderFragment, teamFragment, personFragment }; fragments = new Fragment[] { teamFragment, chatHistoryFragment, dataFragment, personFragment }; // fragment // getSupportFragmentManager().beginTransaction() // .add(R.id.fragment_container, teamFragment).show(teamFragment) // .commit(); // getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, // chatHistoryFragment) // .add(R.id.fragment_container, // contactListFragment).hide(contactListFragment).show(chatHistoryFragment).commit(); // ?BroadcastReceiver msgReceiver = new NewMessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction()); intentFilter.setPriority(3); registerReceiver(msgReceiver, intentFilter); // ack?BroadcastReceiver IntentFilter ackMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getAckMessageBroadcastAction()); ackMessageIntentFilter.setPriority(3); registerReceiver(ackMessageReceiver, ackMessageIntentFilter); // ??BroadcastReceiver IntentFilter cmdMessageIntentFilter = new IntentFilter( EMChatManager.getInstance().getCmdMessageBroadcastAction()); cmdMessageIntentFilter.setPriority(3); registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter); // ?BroadcastReceiver // IntentFilter offlineMessageIntentFilter = new // IntentFilter(EMChatManager.getInstance() // .getOfflineMessageBroadcastAction()); // registerReceiver(offlineMessageReceiver, offlineMessageIntentFilter); // setContactListener??? // EMContactManager.getInstance().setContactListener( // new MyContactListener()); // ??listener // EMChatManager.getInstance().addConnectionListener( // new MyConnectionListener()); // ?listener // EMGroupManager.getInstance().addGroupChangeListener( // new MyGroupChangeListener()); // sdkUI ??receiverlistener, ??broadcast EMChat.getInstance().setAppInited(); // ?? // initBaiduLocation(); }