List of usage examples for android.content Intent getAction
public @Nullable String getAction()
From source file:com.projectgoth.mywebrtcdemo.ConnectActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get setting keys. PreferenceManager.setDefaultValues(this, R.xml.preferences, false); sharedPref = PreferenceManager.getDefaultSharedPreferences(this); keyprefVideoCallEnabled = getString(R.string.pref_videocall_key); keyprefResolution = getString(R.string.pref_resolution_key); keyprefFps = getString(R.string.pref_fps_key); keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_key); keyprefVideoBitrateType = getString(R.string.pref_startvideobitrate_key); keyprefVideoBitrateValue = getString(R.string.pref_startvideobitratevalue_key); keyprefVideoCodec = getString(R.string.pref_videocodec_key); keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key); keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key); keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key); keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key); keyprefAudioCodec = getString(R.string.pref_audiocodec_key); keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing_key); keyprefAecDump = getString(R.string.pref_aecdump_key); keyprefOpenSLES = getString(R.string.pref_opensles_key); keyprefDisplayHud = getString(R.string.pref_displayhud_key); keyprefTracing = getString(R.string.pref_tracing_key); keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key); keyprefRoom = getString(R.string.pref_room_key); keyprefRoomList = getString(R.string.pref_room_list_key); setContentView(R.layout.activity_connect); roomEditText = (EditText) findViewById(R.id.room_edittext); roomEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override//from w ww. j av a 2 s . c om public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == EditorInfo.IME_ACTION_DONE) { addRoomButton.performClick(); return true; } return false; } }); roomEditText.requestFocus(); roomListView = (ListView) findViewById(R.id.room_listview); roomListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); addRoomButton = (ImageButton) findViewById(R.id.add_room_button); addRoomButton.setOnClickListener(addRoomListener); removeRoomButton = (ImageButton) findViewById(R.id.remove_room_button); removeRoomButton.setOnClickListener(removeRoomListener); connectButton = (ImageButton) findViewById(R.id.connect_button); connectButton.setOnClickListener(connectListener); connectLoopbackButton = (ImageButton) findViewById(R.id.connect_loopback_button); connectLoopbackButton.setOnClickListener(connectListener); // If an implicit VIEW intent is launching the app, go directly to that URL. final Intent intent = getIntent(); if ("android.intent.action.VIEW".equals(intent.getAction()) && !commandLineRun) { commandLineRun = true; boolean loopback = intent.getBooleanExtra(CallActivity.EXTRA_LOOPBACK, false); int runTimeMs = intent.getIntExtra(CallActivity.EXTRA_RUNTIME, 0); String room = sharedPref.getString(keyprefRoom, ""); roomEditText.setText(room); connectToRoom(loopback, runTimeMs); return; } }
From source file:com.nextgis.mobile.DataSendService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(MainActivity.TAG, "Received start id " + startId + ": " + intent); super.onStartCommand(intent, flags, startId); if (intent == null) return START_STICKY; String action = intent.getAction(); if (action.equals(ACTION_STOP)) { //Toast.makeText(getApplicationContext(), "Send position service stoped", Toast.LENGTH_SHORT).show(); stopSelf();/*w w w . ja v a 2 s . c om*/ } else if (action.equals(ACTION_START)) { SharedPreferences prefs = getSharedPreferences(PreferencesActivity.SERVICE_PREF, MODE_PRIVATE | MODE_MULTI_PROCESS); boolean bStart = prefs.getBoolean(PreferencesActivity.KEY_PREF_SW_SENDPOS_SRV, false); if (bStart) new SendPositionDataTask().execute(getApplicationContext()); else //Toast.makeText(getApplicationContext(), "Send position service started", Toast.LENGTH_SHORT).show(); stopSelf(); } return START_STICKY; }
From source file:com.nadmm.airports.library.LibraryService.java
private void checkBooks(Intent intent) { String category = intent.getStringExtra(CATEGORY); ArrayList<String> books = intent.getStringArrayListExtra(BOOK_NAMES); cleanupBooks(category, books);//from ww w . ja va 2 s . com File categoryDir = getCategoryDir(category); for (String book : books) { File pdfFile = new File(categoryDir, book); sendResult(intent.getAction(), category, pdfFile); } }
From source file:com.battlelancer.seriesguide.api.SeriesGuideExtension.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) { return;//from w ww .j a v a 2 s . c om } String action = intent.getAction(); if (ACTION_SUBSCRIBE.equals(action)) { // just subscribing or unsubscribing handleSubscribe((ComponentName) intent.getParcelableExtra(EXTRA_SUBSCRIBER_COMPONENT), intent.getStringExtra(EXTRA_TOKEN)); } else if (ACTION_UPDATE.equals(action)) { // subscriber requests an updated action if (intent.hasExtra(EXTRA_ENTITY_IDENTIFIER) && intent.hasExtra(EXTRA_EPISODE)) { handleEpisodeRequest(intent.getIntExtra(EXTRA_ENTITY_IDENTIFIER, 0), intent.getBundleExtra(EXTRA_EPISODE)); } } }
From source file:com.polyvi.xface.extension.XAppExt.java
private void registerInstallerReceiver(final XCallbackContext callbackCtx) { if (null == mInstallerReceiver) { mInstallerReceiver = new BroadcastReceiver() { @Override//from w ww .j a va 2 s .c o m public void onReceive(Context context, Intent intent) { if (intent.getAction().equals("android.intent.action.PACKAGE_REMOVED") && (uninstallPackageName.equals(intent.getDataString().substring(8)))) { XExtensionResult result = new XExtensionResult(XExtensionResult.Status.OK); callbackCtx.sendExtensionResult(result); } if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) { XExtensionResult result = new XExtensionResult(XExtensionResult.Status.OK); callbackCtx.sendExtensionResult(result); } } }; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addDataScheme("package"); getContext().registerReceiver(mInstallerReceiver, filter); } }
From source file:air.com.snagfilms.cast.chromecast.notifications.VideoCastNotificationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand"); if (null != intent) { String action = intent.getAction(); if (ACTION_TOGGLE_PLAYBACK.equals(action) && mIsIcsOrAbove) { Log.d(TAG, "onStartCommand(): Action: ACTION_TOGGLE_PLAYBACK"); togglePlayback();/*from w w w . j a v a2 s .co m*/ } else if (ACTION_STOP.equals(action) && mIsIcsOrAbove) { Log.d(TAG, "onStartCommand(): Action: ACTION_STOP"); stopApplication(); } else if (ACTION_VISIBILITY.equals(action)) { mVisible = intent.getBooleanExtra("visible", false); // mVisible=true; Log.d(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible); if (mVisible && null != mNotification) { startForeground(NOTIFICATION_ID, mNotification); } else { stopForeground(true); } } else { Log.d(TAG, "onStartCommand(): Action: none"); } } else { Log.d(TAG, "onStartCommand(): Intent was null"); } return Service.START_REDELIVER_INTENT; }
From source file:ca.rmen.android.scrumchatter.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(TAG, "onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //StrictMode.setThreadPolicy(new ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().penaltyLog().penaltyDeath().build()); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/*from w w w .ja va 2 s. c om*/ public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } onTeamChanged(); // If our activity was opened by choosing a file from a mail attachment, file browser, or other program, // import the database from this file. Intent intent = getIntent(); if (intent != null) { if (Intent.ACTION_VIEW.equals(intent.getAction())) importDB(intent.getData()); } }
From source file:riddimon.android.asianetautologin.LoginService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); if (intent != null) { String action = intent.getAction(); Thread thread = new Thread(new ISPTask(this, action), "isp_worker"); thread.start();/* w w w . j a v a2 s . c o m*/ } return Service.START_STICKY; }
From source file:at.bitfire.davdroid.DavService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { String action = intent.getAction(); long id = intent.getLongExtra(EXTRA_DAV_SERVICE_ID, -1); switch (action) { case ACTION_ACCOUNTS_UPDATED: cleanupAccounts();/*from w w w .j a v a2 s.c om*/ break; case ACTION_REFRESH_COLLECTIONS: if (runningRefresh.add(id)) { new Thread(new RefreshCollections(id)).start(); for (WeakReference<RefreshingStatusListener> ref : refreshingStatusListeners) { RefreshingStatusListener listener = ref.get(); if (listener != null) listener.onDavRefreshStatusChanged(id, true); } } break; } } return START_NOT_STICKY; }
From source file:com.nextgis.firereporter.ReporterService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "Received start id " + startId + ": " + intent); super.onStartCommand(intent, flags, startId); if (intent == null) return START_STICKY; String action = intent.getAction(); if (action.equals(ACTION_STOP)) { this.stopSelf(); } else if (action.equals(ACTION_START)) { Log.d(TAG, "Action " + ACTION_START); Context c = this.getApplicationContext(); SharedPreferences prefs = getSharedPreferences(MainActivity.PREFERENCES, MODE_PRIVATE | MODE_MULTI_PROCESS); long nMinTimeBetweenSend = prefs.getLong(SettingsActivity.KEY_PREF_INTERVAL + "_long", DateUtils.MINUTE_IN_MILLIS); boolean bBattEconomy = prefs.getBoolean(SettingsActivity.KEY_PREF_SERVICE_BATT_SAVE, true); if (!HttpGetter.IsNetworkAvailible(c)) { ScheduleNextUpdate(c, nMinTimeBetweenSend, bBattEconomy); Log.d(TAG, "network not availible"); return START_NOT_STICKY; }/*from ww w .j a va 2s .co m*/ Cursor cursor = ReportsDB.query(ReportsDatabase.TABLE_POS, null, null, null, null, null, null); Log.d(TAG, "record count = " + cursor.getCount()); if (cursor.getCount() < 1) { this.stopSelf(); return START_NOT_STICKY; } if (fireDataSender == null) { Log.d(TAG, "new fireDataSender"); fireDataSender = new SendFireDataTask(); fireDataSender.execute(this.getApplicationContext()); ScheduleNextUpdate(c, nMinTimeBetweenSend, bBattEconomy); } else if (fireDataSender.getStatus() == AsyncTask.Status.FINISHED) { Log.d(TAG, "exist fireDataSender"); fireDataSender.execute(this.getApplicationContext()); ScheduleNextUpdate(c, nMinTimeBetweenSend, bBattEconomy); } else if (fireDataSender.getStatus() == AsyncTask.Status.PENDING || fireDataSender.getStatus() == AsyncTask.Status.RUNNING) { Log.d(TAG, "exist fireDataSender executing"); ScheduleNextUpdate(c, nMinTimeBetweenSend, bBattEconomy); } else { Log.d(TAG, "unexpected behaviour"); this.stopSelf(); } } return START_NOT_STICKY; }