List of usage examples for android.content Intent getLongExtra
public long getLongExtra(String name, long defaultValue)
From source file:org.openlmis.core.view.fragment.VIARequisitionFragmentTest.java
@Test public void shouldGetIntentToRequisitionActivity() { long formId = 100L; Intent intent = VIARequisitionActivity.getIntentToMe(VIARequisitionFragment.getActivity(), formId); assertThat(intent).isNotNull();/*ww w .j a v a 2s .c om*/ assertThat(intent.getLongExtra(Constants.PARAM_FORM_ID, 0L)).isEqualTo(formId); }
From source file:org.telegram.messenger.AutoMessageReplyReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); if (remoteInput == null) { return;//from w w w. j a v a 2 s . c om } CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY); if (text == null || text.length() == 0) { return; } long dialog_id = intent.getLongExtra("dialog_id", 0); int max_id = intent.getIntExtra("max_id", 0); if (dialog_id == 0 || max_id == 0) { return; } SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, false); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, 0, true, false); }
From source file:com.panahit.telegramma.AutoMessageReplyReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); if (remoteInput == null) { return;//from w w w . ja v a2 s . c o m } CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY); if (text == null || text.length() == 0) { return; } long dialog_id = intent.getLongExtra("dialog_id", 0); int max_id = intent.getIntExtra("max_id", 0); if (dialog_id == 0 || max_id == 0) { return; } SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, false, null, null); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false); }
From source file:com.commonsware.android.deepbg.PollReceiver.java
@Override public void onReceive(Context ctxt, Intent i) { Log.d(getClass().getSimpleName(), "Received alarm broadcast"); boolean isDownload = i.getBooleanExtra(EXTRA_IS_DOWNLOAD, false); startWakefulService(ctxt,/* www .j av a 2 s.co m*/ new Intent(ctxt, DemoScheduledService.class).putExtra(EXTRA_IS_DOWNLOAD, isDownload)); long period = i.getLongExtra(EXTRA_PERIOD, -1); if (period > 0) { scheduleExactAlarm(ctxt, (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE), period, isDownload); } }
From source file:de.vanita5.twittnuker.activity.support.MediaViewerActivity.java
private void loadImage() { getSupportLoaderManager().destroyLoader(0); final Intent intent = getIntent(); final Uri uri = intent.getData(); final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1); if (uri == null) { finish();//w ww. ja va 2 s .c o m return; } final Bundle args = new Bundle(); args.putParcelable(EXTRA_URI, uri); args.putLong(EXTRA_ACCOUNT_ID, accountId); if (!mLoaderInitialized) { getSupportLoaderManager().initLoader(0, args, this); mLoaderInitialized = true; } else { getSupportLoaderManager().restartLoader(0, args, this); } }
From source file:com.perm.DoomPlay.MainScreenActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_LOGIN) { if (resultCode == RESULT_OK) { Account.account.access_token = data.getStringExtra("token"); Account.account.user_id = data.getLongExtra("user_id", 0); Account.account.save(this); api = new Api(Account.account.access_token, LoginActivity.API_ID); isRegister = true;/*from w w w . ja v a2 s .c o m*/ Toast.makeText(getBaseContext(), getResources().getString(R.string.registr_succes), Toast.LENGTH_SHORT).show(); } } }
From source file:zlyh.dmitry.recaller.services.RecordService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { int command = intent.getIntExtra(Const.COMMAND, -1); switch (command) { case Const.RecordService.START: time_start = intent.getLongExtra(Const.CallReceiver.TIME_MARK, -1); File dir = getDir();//from w w w .jav a2 s .c om if (dir == null) { break; } phone = intent.getStringExtra(Const.CallReceiver.PHONE_NUM); file = new File(dir, "r_" + String.valueOf(time_start) + "_.pcm"); record = new RecordRunnable(this, file); try { executor.execute(record); localBroadcast(Const.RecordService.START); } catch (RejectedExecutionException e) { e.printStackTrace(); } break; case Const.RecordService.STOP: final String temp_phone = intent.getStringExtra(Const.CallReceiver.PHONE_NUM); if (temp_phone != null && !temp_phone.isEmpty()) { phone = temp_phone; } fullstop(false); saveSQL(intent.getLongExtra(Const.CallReceiver.TIME_MARK, -1), intent.getIntExtra(Const.CallReceiver.WAS_INCOMING, -1)); localBroadcast(Const.RecordService.STOP); popNotification(); break; } //start redeliver will ruin app if notification is alive return START_NOT_STICKY; }
From source file:org.strongswan.android.ui.MainActivity.java
/** * Start the VPN profile referred to by the given intent. Displays an error * if the profile doesn't exist./*from w ww.java 2 s .c om*/ * * @param intent Intent that caused us to start this */ private void startVpnProfile(Intent intent) { long profileId = intent.getLongExtra(EXTRA_VPN_PROFILE_ID, 0); if (profileId <= 0) { /* invalid invocation */ return; } VpnProfileDataSource dataSource = new VpnProfileDataSource(this); dataSource.open(); VpnProfile profile = dataSource.getVpnProfile(profileId); dataSource.close(); if (profile != null) { onVpnProfileSelected(profile); } else { Toast.makeText(this, R.string.profile_not_found, Toast.LENGTH_LONG).show(); } }
From source file:com.piusvelte.sonet.SelectFriends.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // allow posting to multiple services if an account is defined // allow selecting which accounts to use // get existing comments, allow liking|unliking those comments setContentView(R.layout.friends);//from w ww . j av a 2 s .c o m if (!getPackageName().toLowerCase().contains(PRO)) { AdView adView = new AdView(this, AdSize.BANNER, BuildConfig.GOOGLEAD_ID); ((LinearLayout) findViewById(R.id.ad)).addView(adView); adView.loadAd(new AdRequest()); } Intent intent = getIntent(); if ((intent != null) && intent.hasExtra(Accounts.SID)) { mAccountId = intent.getLongExtra(Accounts.SID, Sonet.INVALID_ACCOUNT_ID); String[] tags = intent.getStringArrayExtra(Stags); if (tags != null) { for (String tag : tags) mSelectedFriends.add(tag); } } else finish(); mHttpClient = SonetHttpClient.getThreadSafeClient(getApplicationContext()); registerForContextMenu(getListView()); setResult(RESULT_CANCELED); }
From source file:com.piusvelte.sonet.core.SelectFriends.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // allow posting to multiple services if an account is defined // allow selecting which accounts to use // get existing comments, allow liking|unliking those comments setContentView(R.layout.friends);/*from w ww .ja va 2s . c om*/ if (!getPackageName().toLowerCase().contains(PRO)) { AdView adView = new AdView(this, AdSize.BANNER, SonetTokens.GOOGLE_AD_ID); ((LinearLayout) findViewById(R.id.ad)).addView(adView); adView.loadAd(new AdRequest()); } Intent intent = getIntent(); if ((intent != null) && intent.hasExtra(Accounts.SID)) { mAccountId = intent.getLongExtra(Accounts.SID, Sonet.INVALID_ACCOUNT_ID); String[] tags = intent.getStringArrayExtra(Stags); if (tags != null) { for (String tag : tags) mSelectedFriends.add(tag); } } else finish(); mHttpClient = SonetHttpClient.getThreadSafeClient(getApplicationContext()); registerForContextMenu(getListView()); setResult(RESULT_CANCELED); }