当前位置: 首页>>代码示例>>Java>>正文


Java IntentFilter.setPriority方法代码示例

本文整理汇总了Java中android.content.IntentFilter.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java IntentFilter.setPriority方法的具体用法?Java IntentFilter.setPriority怎么用?Java IntentFilter.setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.IntentFilter的用法示例。


在下文中一共展示了IntentFilter.setPriority方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import android.content.IntentFilter; //导入方法依赖的package包/类
private void init() {
    LogUtil.i("init service");
    /*
    * 动态注册广播
    * */
    mSmsReceiver = new SmsReceiver();
    IntentFilter intentFilter = new IntentFilter();
    //添加Action
    intentFilter.addAction(StaticClass.SMS_ACTION);
    //设置优先级,谷歌优先级最大值为1000,这里我设置为int的最大值
    intentFilter.setPriority(Integer.MAX_VALUE);
    //注册
    registerReceiver(mSmsReceiver, intentFilter);

    mHomeWatchReceiver = new HomeWatchReceiver();
    IntentFilter intentFilter1 = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    registerReceiver(mHomeWatchReceiver, intentFilter1);
}
 
开发者ID:Hultron,项目名称:LifeHelper,代码行数:19,代码来源:SmsService.java

示例2: registerReveicer

import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerReveicer() {
    registerReceiver(netWorkChangeReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    IntentFilter inf = new IntentFilter(Intent.ACTION_SCREEN_OFF);
    inf.addAction(Intent.ACTION_SCREEN_ON);
    registerReceiver(scrennReceiver, inf);
    registerReceiver(headSetInReceiver, new IntentFilter("android.intent.action.HEADSET_PLUG"));
    IntentFilter bit = new IntentFilter(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
    // bit.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
    //bit.addAction(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
    registerReceiver(blueConnectStateBroadcastReceiver, bit);
    IntentFilter smsFilter = new IntentFilter(SMS_RECEIVED_ACTION);
    smsFilter.setPriority(2147483647);
    smsFilter.addAction(GSM_SMS_RECEIVED_ACTION);
    registerReceiver(smsReceiver, smsFilter);
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:AssistantService.java

示例3: initReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
private void initReceiver() {
        IntentFilter intentFilter = new IntentFilter(Constant.NEW_MESSAGE_ACTION);
//                这里设置优先级要比ChatActivity低,聊天界面一旦接受到消息,这里就不需要再接受
        intentFilter.setPriority(10);
//                聊天消息的监听
        registerReceiver(mReceiver = new NewMessageReceiver(), new IntentFilter(Constant.NEW_MESSAGE_ACTION));
        IntentFilter filter = new IntentFilter();
//                说说消息接受
        filter.addAction(Constant.NEW_SHARE_MESSAGE_ACTION);
//                说说消息改变实时监听
        filter.addAction(Constant.NOTIFY_CHANGE_ACTION);
        registerReceiver(shareReceiver = new ShareMessageReceiver(), filter);
//                网络状态改变监听
        registerReceiver(netWorkReceiver = new NetWorkChangedReceiver(), new IntentFilter(Constant.NETWORK_CONNECTION_CHANGE));
        netWorkReceiver.registerListener(this);
//                单聊和系统推送消息监听
        PushMessageReceiver.registerListener(this);
    }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:19,代码来源:MainActivity.java

示例4: registerReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
/**
 * 去电时:
 * 未接:phone_state=OFFHOOK;
 * 挂断:phone_state=IDLE
 * 来电时:
 * 未接:phone_state=RINGING
 * 已接:phone_state=OFFHOOK;
 * 挂断:phone_state=IDLE
 */
//public void registerCallStateListener(Context context, PhoneStateListener listener) {
//    try {
//        //获取电话通讯服务
//        TelephonyManager tpm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//        tpm.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
//    } catch (Exception e) {
//        e.printStackTrace();
//    }
//}
public void registerReceiver(Context context, PhoneListener phoneListener) {
    try {
        IntentFilter filter = new IntentFilter();
        filter.addAction("android.intent.action.PHONE_STATE");
        filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
        filter.setPriority(Integer.MAX_VALUE);
        context.registerReceiver(this, filter);
        this.phoneListener = phoneListener;
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:androidDaniel,项目名称:treasure,代码行数:31,代码来源:PhoneReceiver.java

示例5: pairIntentFilter

import android.content.IntentFilter; //导入方法依赖的package包/类
private static IntentFilter pairIntentFilter() {
        final IntentFilter intentFilter = new IntentFilter();
       /* reserved for other usages */
/*
        intentFilter.addAction(BluetoothDevice.ACTION_FOUND);
        intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
        intentFilter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
        intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
        intentFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
        */
        intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
        intentFilter.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
        intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
        intentFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
        intentFilter.addAction("com.bluetooth.device.action.FOUND");
        intentFilter.setPriority(Integer.MAX_VALUE);

        return intentFilter;
    }
 
开发者ID:haoyifan,项目名称:BLE-PEPS,代码行数:20,代码来源:BleClientMainActivity.java

示例6: registerReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerReceiver(Context context, TimeListener timeListener) {
    try {
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_TIME_CHANGED);
        filter.addAction(Intent.ACTION_TIME_TICK);
        filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
        filter.setPriority(Integer.MAX_VALUE);
        context.registerReceiver(this, filter);
        this.timeListener = timeListener;
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:jqjm,项目名称:Liteframework,代码行数:14,代码来源:TimeReceiver.java

示例7: registerForCompletedNotification

import android.content.IntentFilter; //导入方法依赖的package包/类
private void registerForCompletedNotification() {
  IntentFilter filter = new IntentFilter();
  filter.addAction(ApplicationMigrationService.COMPLETED_ACTION);
  filter.setPriority(1000);

  registerReceiver(completedReceiver, filter);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:8,代码来源:DatabaseMigrationActivity.java

示例8: initData

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
        public void initData() {
                from = getIntent().getStringExtra("from");
                if (from.equals("person")) {
                        user = (User) getIntent().getSerializableExtra("user");
                        uid = user.getObjectId();
                } else if (from.equals("group")) {
                        groupId = getIntent().getStringExtra("groupId");
                        mGroupTableMessage = MessageCacheManager.getInstance().getGroupTableMessage(groupId);
                }
                initActionBar();
//                 声音音量变化图片资源
                voiceImageId = new int[]{R.mipmap.chat_icon_voice1, R.mipmap.chat_icon_voice2, R.mipmap.chat_icon_voice3, R.mipmap.chat_icon_voice4,
                        R.mipmap.chat_icon_voice5, R.mipmap.chat_icon_voice6};
                initRecordManager();
                initEmotionInfo();
                mLinearLayoutManager = new LinearLayoutManager(this);
                display.setLayoutManager(mLinearLayoutManager);
//                display.setHasFixedSize(true);
                display.setItemAnimator(new DefaultItemAnimator());
//                mAdapter = new ChatAdapter(this, null);
                mAdapter = new ChatMessageAdapter();
                mAdapter.setOnItemClickListener(this);
                display.addOnScrollListener(new RecyclerView.OnScrollListener() {
                        @Override
                        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                                if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
                                        hideSoftInpuutView();
                                }
                        }
                });
                display.setAdapter(mAdapter);
                IntentFilter intentFilter = new IntentFilter(Constant.NEW_MESSAGE_ACTION);
                intentFilter.setPriority(20);
                registerReceiver(mReceiver, intentFilter);
                refreshData();
                scrollToBottom();
                registerRxBus();
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:40,代码来源:ChatActivity.java

示例9: registerMessageReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerMessageReceiver() {
    mMessageReceiver = new MessageReceiver();
    IntentFilter filter = new IntentFilter();
    filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
    filter.addAction(MESSAGE_RECEIVED_ACTION);
    LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:8,代码来源:ActivityPresenter.java

示例10: registerSmsReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerSmsReceiver(Context context, SmsListener smsListener) {
    try {
        this.smsListener = smsListener;
        IntentFilter filter = new IntentFilter();
        filter.addAction("android.provider.Telephony.SMS_RECEIVED");
        filter.setPriority(Integer.MAX_VALUE);
        context.registerReceiver(this, filter);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:12,代码来源:SmsReceiver.java

示例11: onResume

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    mStateReceiver = new NetworkStateReceiver();
    registerReceiver(mStateReceiver, intentFilter);

    IntentFilter intentFilter1 = new IntentFilter();
    intentFilter1.addAction(UpdateService.ACTION_SHOW_NOTIFICATION);
    intentFilter1.setPriority(100);
    mNotificationReceiver = new NotificationReceiver();
    registerReceiver(mNotificationReceiver, intentFilter1, UpdateService.PERM_PRIVATE, null);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:15,代码来源:BaseActivity.java

示例12: init

import android.content.IntentFilter; //导入方法依赖的package包/类
private void init()
{
    //完成广播接收器要注册的广播
    IntentFilter intentFilter=new IntentFilter();
    intentFilter.addAction(StaticClass.SMS_ACTION);
    intentFilter.setPriority(Integer.MAX_VALUE);//设置优先级
    //为广播接收器注册广播
    smsReceiver= new SmsReceiver();
    registerReceiver(smsReceiver,intentFilter);
    L.i("广播接收器已注册");
}
 
开发者ID:WindFromFarEast,项目名称:SmartButler,代码行数:12,代码来源:SmsService.java

示例13: onResume

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    // Register broadcast receiver for notifications
    IntentFilter intentFilter = new IntentFilter(UpdateService.BROADCAST_UPDATE_FINISHED);
    intentFilter.setPriority(UpdateService.BROADCAST_PRIORITY_UI);
    registerReceiver(updateReceiver, intentFilter);
}
 
开发者ID:tbolender,项目名称:fefereader,代码行数:10,代码来源:DetailsActivity.java

示例14: ReceiverBluetooth

import android.content.IntentFilter; //导入方法依赖的package包/类
/*******蓝牙相关*********/

    public void ReceiverBluetooth() {
        IntentFilter filter = new IntentFilter();
        //发现设备
        filter.addAction(BluetoothDevice.ACTION_FOUND);
        //设备连接状态改变
        filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
        filter.addAction(ACTION_PAIRING_REQUEST);
        filter.setPriority(1000);
        //蓝牙设备状态改变
        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
        this.registerReceiver(mBluetoothReceiver, filter);
    }
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:16,代码来源:BindDeviceWiFiActivity.java

示例15: registerMessageReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
public void registerMessageReceiver() {
	mMessageReceiver = new MessageReceiver();
	IntentFilter filter = new IntentFilter();
	filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
	filter.addAction(MESSAGE_RECEIVED_ACTION);
	registerReceiver(mMessageReceiver, filter);
}
 
开发者ID:LuoLuo0101,项目名称:JPush,代码行数:8,代码来源:MainActivity.java


注:本文中的android.content.IntentFilter.setPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。