List of usage examples for android.content Intent getAction
public @Nullable String getAction()
From source file:cl.iluminadoschile.pako.floatingdiv.CustomOverlayService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent == null || null == intent.getAction()) { Log.i(LOG_TAG, "Received null Foreground Intent "); if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { if (activation_method.equals(Constants.SETTINGS.ACTIVATION_METHOD_ALONGWITHINGRESS)) { startMonitorIngressRunning(); }/*from w w w . java 2s. c o m*/ } } else if (intent.getAction().equals(Constants.ACTION.STARTFOREGROUND_ACTION)) { Log.i(LOG_TAG, "Received Start Foreground Intent "); overlayView.setVisible(); if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { if (activation_method.equals(Constants.SETTINGS.ACTIVATION_METHOD_ALONGWITHINGRESS)) { startMonitorIngressRunning(); } } } else if (intent.getAction().equals(Constants.ACTION.SETTINGS_ACTION)) { Log.i(LOG_TAG, "Received Settings Intent"); Intent settingsIntent = new Intent(Intent.ACTION_MAIN); settingsIntent.setClassName(Constants.ACTION.prefix, Constants.ACTION.prefix + ".SettingsActivity"); settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(settingsIntent); } else if (intent.getAction().equals(Constants.ACTION.PAUSEFOREGROUND_ACTION)) { Log.i(LOG_TAG, "Received Pause Foreground Intent"); overlayView.setInvisible(); } else if (intent.getAction().equals(Constants.ACTION.STOPFOREGROUND_ACTION)) { Log.i(LOG_TAG, "Received Stop Foreground Intent"); overlayView.setInvisible(); stopForeground(true); stopSelf(); } return START_STICKY; }
From source file:org.klnusbaum.udj.network.EventCommService.java
@Override public void onHandleIntent(Intent intent) { Log.d(TAG, "In Event Comm Service"); AccountManager am = AccountManager.get(this); final Account account = (Account) intent.getParcelableExtra(Constants.ACCOUNT_EXTRA); if (intent.getAction().equals(Intent.ACTION_INSERT)) { enterEvent(intent, am, account, true); } else if (intent.getAction().equals(Intent.ACTION_DELETE)) { //TODO handle if userId is null shouldn't ever be, but hey... leaveEvent(am, account, true);//from w w w . j a va 2 s .c om } else { Log.d(TAG, "ACTION wasn't delete or insert, it was " + intent.getAction()); } }
From source file:org.openbmap.activities.DialogPreferenceMaps.java
/** * Initialises download manager for GINGERBREAD and newer */// www . j a v a2s . c om @SuppressLint("NewApi") private void initDownloadManager() { mDownloadManager = (DownloadManager) getContext().getSystemService(Context.DOWNLOAD_SERVICE); mReceiver = new BroadcastReceiver() { @SuppressLint("NewApi") @Override public void onReceive(final Context context, final Intent intent) { final String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { final long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); final DownloadManager.Query query = new DownloadManager.Query(); query.setFilterById(downloadId); final Cursor c = mDownloadManager.query(query); if (c.moveToFirst()) { final int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { // we're not checking download id here, that is done in handleDownloads final String uriString = c .getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); handleDownloads(uriString); } else { final int reason = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_REASON)); Log.e(TAG, "Download failed: " + reason); } } } } }; getContext().registerReceiver(mReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); }
From source file:ansteph.com.beecabfordrivers.view.CabResponder.JobsBoard.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jobs_board); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from ww w .j a va 2 s .c o m*/ sessionManager = new SessionManager(getApplicationContext()); mGlobalRetainer = (GlobalRetainer) getApplicationContext(); HashMap<String, String> user = sessionManager.getUserDetails(); // String id, String name, String companyname, String email, String mobile, String licence, String year, String apikey, int companyid mGlobalRetainer.set_grDriver(new Driver(user.get(SessionManager.KEY_ID), user.get(SessionManager.KEY_NAME), user.get(SessionManager.KEY_COMNAME), user.get(SessionManager.KEY_EMAIL), user.get(SessionManager.KEY_MOBILE), user.get(SessionManager.KEY_LICENSE), user.get(SessionManager.KEY_YEAR), user.get(SessionManager.KEY_APIKEY), Integer.parseInt(user.get(SessionManager.KEY_COMPANY_ID)))); //Try to register the firebase messaging token FirebaseMessaging.getInstance().subscribeToTopic("BeeCab"); String token = FirebaseInstanceId.getInstance().getToken(); /* if(!token.isEmpty()) { FirebaseServerRegistration fbRegistration = new FirebaseServerRegistration (getApplicationContext(), mGlobalRetainer.get_grDriver(),token); fbRegistration.registerFBToken(); }*/ viewPager = (ViewPager) findViewById(R.id.view_pager); adapterViewPager = new JobCatAdapter(getSupportFragmentManager()); viewPager.setAdapter(adapterViewPager); tabLayout = (TabLayout) findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); final ViewAnimator viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator); final Animation inAmin = AnimationUtils.loadAnimation(getApplication(), android.R.anim.slide_in_left); final Animation outAmin = AnimationUtils.loadAnimation(getApplication(), android.R.anim.slide_out_right); viewAnimator.setInAnimation(inAmin); viewAnimator.setOutAnimation(outAmin); viewAnimator.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewAnimator.showNext(); } }); try { Glide.with(getApplication()).load(R.drawable.denys).into((ImageView) findViewById(R.id.imgadvplace2)); Glide.with(getApplication()).load(R.drawable.auto).into((ImageView) findViewById(R.id.imgadvplace3)); } catch (Exception e) { e.printStackTrace(); } Button btnCaller = (Button) findViewById(R.id.btnCaller); btnCaller.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplication(), JoRPickupBoard.class); startActivity(i); } }); mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //Checking for the type of intent filter if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) { //gcm successful reg //now subscribe to the topic beecab topic to receive app wide notifications FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL); } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) { String message = intent.getStringExtra("message"); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } } }; updateRegIDonServer(); }
From source file:ch.citux.td.ui.TDActivity.java
@Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); if (searchFragment == null) { searchFragment = new SearchFragment(); }/*from w ww .j av a 2s.c o m*/ searchFragment.setQuery(query); searchFragment.loadData(); replaceFragment(searchFragment); Log.d(this, query); } }
From source file:com.scrachx.foodfacts.checker.ui.main.MainActivity.java
@Override protected void onNewIntent(Intent intent) { setIntent(intent);//from w ww .java2 s. c om if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Bundle args = new Bundle(); args.putString("query", query); if (EAN13CheckDigit.EAN13_CHECK_DIGIT.isValid(query) && (!query.substring(0, 3).contains("977") || !query.substring(0, 3).contains("978") || !query.substring(0, 3).contains("979"))) { mPresenter.loadProduct(query); } else { mSearchView.clearFocus(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, SearchFragment.newInstance(args), SearchFragment.TAG) .commit(); } } }
From source file:de.bahnhoefe.deutschlands.bahnhofsfotos.MyDataActivity.java
private void receiveUploadToken(Intent intent) { if (intent != null) { if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri data = intent.getData(); if (data != null) { profile.setUploadToken(data.getLastPathSegment()); etUploadToken.setText(profile.getUploadToken()); baseApplication.setUploadToken(profile.getUploadToken()); loadRemoteProfile();//from ww w. j ava 2 s .co m } } } }
From source file:audio.lisn.service.MediaNotificationManager.java
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); switch (action) { case ACTION_PAUSE: sendStateChange("pause"); //AppController.getInstance().pausePlayer(); break;//from ww w. ja va 2 s . c o m case ACTION_PLAY: sendStateChange("start"); //AppController.getInstance().starPlayer(); break; case ACTION_NEXT: AppController.getInstance().playNextFile(); break; case ACTION_PREV: AppController.getInstance().playPreviousFile(); break; case ACTION_DELETE: mService.stopForeground(true); sendStateChange("stop"); Log.v("onReceive", "delete"); break; default: } }
From source file:com.android.launcher3.InstallShortcutReceiver.java
public void onReceive(Context context, Intent data) { if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) { return;//from w w w . j a v a 2 s. com } if (DBG) Log.d(TAG, "Got INSTALL_SHORTCUT: " + data.toUri(0)); PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, context); queuePendingShortcutInfo(info, context); }