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


Java IntentFilter.addCategory方法代码示例

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


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

示例1: initBluetooth

import android.content.IntentFilter; //导入方法依赖的package包/类
public void initBluetooth() {
	if (!ensureInit()) {
		Log.w("[Bluetooth] Manager tried to init bluetooth but LinphoneService not ready yet...");
		return;
	}
	
	IntentFilter filter = new IntentFilter();
	filter.addCategory(BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY + "." + BluetoothAssignedNumbers.PLANTRONICS);
	filter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
	filter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
	filter.addAction(BluetoothHeadset.ACTION_VENDOR_SPECIFIC_HEADSET_EVENT);
	mContext.registerReceiver(this,  filter);
	Log.d("[Bluetooth] Receiver started");
	
	startBluetooth();
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:17,代码来源:BluetoothManager.java

示例2: onCreate

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    preferencesHelper = PreferencesHelper.getInstance();
    IntentFilter filter = new IntentFilter(SyncContentReceiver.SYNC_RESPONSE_STATUS);
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    syncContentReceiver = new SyncContentReceiver();
    registerReceiver(syncContentReceiver, filter);
    setupToolBar();
    setupCalendarFab();
    setupDrawerLayout();
    if (savedInstanceState != null) {
        currentItem = savedInstanceState.getInt(STATE_SELECTED_POSITION);
        isSyncActive = savedInstanceState.getBoolean(STATE_SYNC_ACTIVE);
    }
    navigationView.getMenu().performIdentifierAction(currentItem, 0);//default main fragment
    TvGuideSyncAdapter.initializeSyncAdapter(this);//sync data now
}
 
开发者ID:graviton57,项目名称:TVGuide,代码行数:20,代码来源:MainActivity.java

示例3: testShowBasicShareDialog

import android.content.IntentFilter; //导入方法依赖的package包/类
public void testShowBasicShareDialog() {
  final WritableMap content = new WritableNativeMap();
  content.putString("message", "Hello, ReactNative!");
  final WritableMap options = new WritableNativeMap();

  IntentFilter intentFilter = new IntentFilter(Intent.ACTION_CHOOSER);
  intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
  ActivityMonitor monitor = getInstrumentation().addMonitor(intentFilter, null, true);

  getTestModule().showShareDialog(content, options);

  waitForBridgeAndUIIdle();
  getInstrumentation().waitForIdleSync();

  assertEquals(1, monitor.getHits());
  assertEquals(1, mRecordingModule.getOpened());
  assertEquals(0, mRecordingModule.getErrors());

}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:ShareTestCase.java

示例4: isPaperLauncherDefault

import android.content.IntentFilter; //导入方法依赖的package包/类
private boolean isPaperLauncherDefault() {
    final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);
    filter.addCategory(Intent.CATEGORY_HOME);

    List<IntentFilter> filters = new ArrayList<>();
    filters.add(filter);

    String paperLauncherPackageName = mLauncherActivity.getPackageName();
    List<ComponentName> activities = new ArrayList<>();

    PackageManager packageManager = mLauncherActivity.getPackageManager();
    packageManager.getPreferredActivities(filters, activities, null);

    for (ComponentName activity : activities) {
        if (paperLauncherPackageName.equals(activity.getPackageName())) {
            return true;
        }
    }

    return false;
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:22,代码来源:CustomizationDialog.java

示例5: onAttachedToWindow

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    IntentFilter filter = new IntentFilter();
    filter.addCategory(Intent.ACTION_TIME_TICK);
    filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
    getContext().registerReceiver(mReceiver, filter);
}
 
开发者ID:ceji-longquan,项目名称:ceji_android,代码行数:9,代码来源:TimeView.java

示例6: onCreate

import android.content.IntentFilter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    IntentFilter filter = new IntentFilter();
    filter.addCategory(Intent.CATEGORY_DEFAULT);
    filter.addAction(getResources().getString(R.string.activity_intent_filter_action));
    registerReceiver(myBroadcastReceiver, filter);
}
 
开发者ID:darryncampbell,项目名称:DataWedge-Intent-Example-1,代码行数:11,代码来源:MainActivity.java

示例7: startIntentService

import android.content.IntentFilter; //导入方法依赖的package包/类
public void startIntentService(){
    //intentService
    intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
    intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
    connect_receiver = new connect_receiver();
    registerReceiver(connect_receiver,intentFilter);
    Intent service = new Intent(getApplicationContext(), connection_service.class);
    startService(service);
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:10,代码来源:ViewOtherUserProfile.java

示例8: startIntentService

import android.content.IntentFilter; //导入方法依赖的package包/类
public void startIntentService(){
    //intentService
    connect_receiver = new connect_receiver();
    intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
    intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
    registerReceiver(connect_receiver,intentFilter);
    Intent service = new Intent(getApplicationContext(), connection_service.class);
    startService(service);
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:10,代码来源:ResetPasswordActivity.java

示例9: startIntentService

import android.content.IntentFilter; //导入方法依赖的package包/类
private void startIntentService(){
    //intentService
    intentFilter = new IntentFilter(connect_receiver.PROCESS_RESPONSE);
    intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
    connect_receiver = new connect_receiver();
    registerReceiver(connect_receiver,intentFilter);
    Intent service = new Intent(getApplicationContext(), connection_service.class);
    startService(service);
}
 
开发者ID:Socialate,项目名称:furry-sniffle,代码行数:10,代码来源:CreateProfileActivity.java

示例10: bindReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
private void bindReceiver(final T view) {
  receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

      handleIntent(view, intent);
    }
  };

  manager = LocalBroadcastManager.getInstance(context);

  final IntentFilter filter = new IntentFilter();
  filter.addAction(Intent.ACTION_VIEW);
  filter.addCategory(Intent.CATEGORY_DEFAULT);

  final Uri[] uris = new Uri[kolibriUris().length];

  for (int i = 0; i < uris.length; ++i) {
    uris[i] = Uri.parse(kolibriUris()[i]);

    final Uri uri = uris[i];

    filter.addDataScheme(uri.getScheme());
    filter.addDataAuthority(uri.getHost(), null);
  }

  manager.registerReceiver(receiver, filter);
}
 
开发者ID:azmedien,项目名称:kolibri-android,代码行数:29,代码来源:KolibriCoordinator.java

示例11: requestPushToken

import android.content.IntentFilter; //导入方法依赖的package包/类
void requestPushToken(Activity activity){
    if (activity!=null) {
        Intent service = new Intent(activity, RegistrationIntentService.class);
        service.putExtra(RegistrationIntentService.TOKEN, "token");
        activity.startService(service);

        IntentFilter intentFilter = new IntentFilter(RegistrationIntentService.ACTION_TOKEN);
        intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
        activity.registerReceiver(tokenBroadcastReceiver, intentFilter);

        //send back first
        sendBroatCast();
    }
}
 
开发者ID:afiqiqmal,项目名称:My-Android-Base-Code,代码行数:15,代码来源:SplashPresenter.java

示例12: initReceiver

import android.content.IntentFilter; //导入方法依赖的package包/类
private void initReceiver(){
    IntentFilter filter = new IntentFilter();
    filter.addAction("com.mpush.MESSAGE_RECEIVED");
    filter.addAction("com.mpush.KICK_USER");
    filter.addAction("com.mpush.CONNECTIVITY_CHANGE");
    filter.addAction("com.mpush.HANDSHAKE_OK");
    filter.addAction("com.mpush.BIND_USER");
    filter.addAction("com.mpush.UNBIND_USER");
    filter.addCategory(reactContext.getPackageName());
    reactContext.registerReceiver(this, filter);
}
 
开发者ID:stulip,项目名称:react-native-mpush,代码行数:12,代码来源:RCTMPushReceiver.java

示例13: OCastMediaRouteProvider

import android.content.IntentFilter; //导入方法依赖的package包/类
public OCastMediaRouteProvider(@NonNull Context context, List<String> searchTargets) {
    super(context);
    mContext = context.getApplicationContext();
    mHandler = new Handler(Looper.getMainLooper());
    mActiveDiscovery = new Discovery(searchTargets, callback, DiscoveryReliability.HIGH);
    mProcessDiscovery = new Discovery(searchTargets, callback, DiscoveryReliability.LOW);
    mCategoryIntentFilterList = new ArrayList<>();
    IntentFilter f = new IntentFilter();
    f.addCategory(CATEGORY_OCAST);
    mCategoryIntentFilterList.add(f);
    mConnectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
    mWifiMonitorIntentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
}
 
开发者ID:Orange-OpenSource,项目名称:OCast-Java,代码行数:14,代码来源:OCastMediaRouteProvider.java

示例14: getResponseFilter

import android.content.IntentFilter; //导入方法依赖的package包/类
IntentFilter getResponseFilter() {
    IntentFilter filter = new IntentFilter();
    filter.addAction(QueryUtil.createResponseAction(mDataType, mQueryId));
    filter.addCategory(QueryUtil.BBQ_CATEGORY);
    return filter;
}
 
开发者ID:openid,项目名称:OpenYOLO-Android,代码行数:7,代码来源:BroadcastQueryClient.java


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