當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。