List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:mobisocial.socialkit.musubi.Musubi.java
public DbObj objFromIntent(Intent intent) { Log.d(TAG, "fetching obj from " + intent); if (intent.hasExtra(EXTRA_OBJ_URI)) { try {//w ww. j a v a 2s .co m Uri objUri = intent.getParcelableExtra(EXTRA_OBJ_URI); return objForUri(objUri); } catch (Exception e) { if (DBG) Log.e(TAG, "couldnt get obj from uri", e); } } if (intent.getType() != null && intent.getType().startsWith("vnd.musubi.obj/")) { if (intent.getData() != null) { return objForUri(intent.getData()); } } if (DBG) Log.e(TAG, "no obj found"); return null; }
From source file:com.mindprotectionkit.freephone.RedPhoneService.java
private void handleIncomingCall(Intent intent) { SessionDescriptor session = (SessionDescriptor) intent.getParcelableExtra(Constants.SESSION); remoteNumber = extractRemoteNumber(intent); state = RedPhone.STATE_RINGING;/*from ww w. j av a 2 s.c om*/ lockManager.updatePhoneState(LockManager.PhoneState.PROCESSING); this.currentCallManager = new ResponderCallManager(this, this, remoteNumber, localNumber, password, session, zid); this.currentCallManager.start(); }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushIntentService.java
private void onUnhandled(Context context, Intent intent) { String action = intent.getAction(); if ((MFPPushUtils.getIntentPrefix(context) + GCM_MESSAGE).equals(action)) { MFPInternalPushMessage message = intent.getParcelableExtra(GCM_EXTRA_MESSAGE); int notificationId = randomObj.nextInt(); message.setNotificationId(notificationId); saveInSharedPreferences(message); intent = new Intent(MFPPushUtils.getIntentPrefix(context) + IBM_PUSH_NOTIFICATION); intent.setClass(context, MFPPushNotificationHandler.class); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(NOTIFICATIONID, message.getNotificationId()); generateNotification(context, message.getAlert(), getNotificationTitle(context), message.getAlert(), getCustomNotificationIcon(context, message.getIcon()), intent, getNotificationSound(message), notificationId, message); }/*from w ww . j av a 2 s . c o m*/ }
From source file:com.andrew.apollo.MediaButtonIntentReceiver.java
/** * {@inheritDoc}/*from w ww . j av a2 s . c o m*/ */ @Override public void onReceive(final Context context, final Intent intent) { if (DEBUG) Log.v(TAG, "Received intent: " + intent); final String intentAction = intent.getAction(); if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(intentAction)) { startService(context, MusicPlaybackService.CMDPAUSE); } else if (Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) { final KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (event == null) { return; } final int keycode = event.getKeyCode(); final int action = event.getAction(); final long eventtime = event.getEventTime(); String command = null; switch (keycode) { case KeyEvent.KEYCODE_MEDIA_STOP: command = MusicPlaybackService.CMDSTOP; break; case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: command = MusicPlaybackService.CMDTOGGLEPAUSE; break; case KeyEvent.KEYCODE_MEDIA_NEXT: command = MusicPlaybackService.CMDNEXT; break; case KeyEvent.KEYCODE_MEDIA_PREVIOUS: command = MusicPlaybackService.CMDPREVIOUS; break; case KeyEvent.KEYCODE_MEDIA_PAUSE: command = MusicPlaybackService.CMDPAUSE; break; case KeyEvent.KEYCODE_MEDIA_PLAY: command = MusicPlaybackService.CMDPLAY; break; } if (command != null) { if (action == KeyEvent.ACTION_DOWN) { if (mDown) { if (MusicPlaybackService.CMDTOGGLEPAUSE.equals(command) || MusicPlaybackService.CMDPLAY.equals(command)) { if (mLastClickTime != 0 && eventtime - mLastClickTime > LONG_PRESS_DELAY) { acquireWakeLockAndSendMessage(context, mHandler.obtainMessage(MSG_LONGPRESS_TIMEOUT, context), 0); } } } else if (event.getRepeatCount() == 0) { // Only consider the first event in a sequence, not the repeat events, // so that we don't trigger in cases where the first event went to // a different app (e.g. when the user ends a phone call by // long pressing the headset button) // The service may or may not be running, but we need to send it // a command. if (keycode == KeyEvent.KEYCODE_HEADSETHOOK) { if (eventtime - mLastClickTime >= DOUBLE_CLICK) { mClickCounter = 0; } mClickCounter++; if (DEBUG) Log.v(TAG, "Got headset click, count = " + mClickCounter); mHandler.removeMessages(MSG_HEADSET_DOUBLE_CLICK_TIMEOUT); Message msg = mHandler.obtainMessage(MSG_HEADSET_DOUBLE_CLICK_TIMEOUT, mClickCounter, 0, context); long delay = mClickCounter < 3 ? DOUBLE_CLICK : 0; if (mClickCounter >= 3) { mClickCounter = 0; } mLastClickTime = eventtime; acquireWakeLockAndSendMessage(context, msg, delay); } else { startService(context, command); } mLaunched = false; mDown = true; } } else { mHandler.removeMessages(MSG_LONGPRESS_TIMEOUT); mDown = false; } if (isOrderedBroadcast()) { abortBroadcast(); } releaseWakeLockIfHandlerIdle(); } } }
From source file:com.mindprotectionkit.freephone.RedPhoneService.java
private void handleBusyCall(Intent intent) { SessionDescriptor session = (SessionDescriptor) intent.getParcelableExtra(Constants.SESSION); if (currentCallManager != null && session.equals(currentCallManager.getSessionDescriptor())) { Log.w("RedPhoneService", "Duplicate incoming call signal, ignoring..."); return;//from ww w . j a va2s. c o m } handleMissedCall(extractRemoteNumber(intent)); try { SignalingSocket signalingSocket = new SignalingSocket(this, session.getFullServerName(), Release.SERVER_PORT, localNumber, password, OtpCounterProvider.getInstance()); signalingSocket.setBusy(session.sessionId); signalingSocket.close(); } catch (SignalingException e) { Log.w("RedPhoneService", e); } }
From source file:com.google.android.apps.iosched.ui.SessionDetailFragment.java
/** * Derive {@link com.google.android.apps.iosched.provider.ScheduleContract.Tracks#CONTENT_ITEM_TYPE} * {@link Uri} based on incoming {@link Intent}, using * {@link #EXTRA_TRACK} when set./* ww w. ja v a2s .co m*/ * @param intent * @return Uri */ private Uri resolveTrackUri(Intent intent) { final Uri trackUri = intent.getParcelableExtra(EXTRA_TRACK); if (trackUri != null) { return trackUri; } else { return ScheduleContract.Sessions.buildTracksDirUri(mSessionId); } }
From source file:com.heneryh.aquanotes.ui.SessionDetailFragment.java
/** * Derive {@link com.heneryh.aquanotes.provider.AquaNotesDbContract.Tracks#CONTENT_ITEM_TYPE} * {@link Uri} based on incoming {@link Intent}, using * {@link #EXTRA_TRACK} when set./*from w ww.j av a 2 s . c om*/ * @param intent * @return Uri */ private Uri resolveTrackUri(Intent intent) { final Uri trackUri = intent.getParcelableExtra(EXTRA_TRACK); if (trackUri != null) { return trackUri; } else { return AquaNotesDbContract.Sessions.buildTracksDirUri(mSessionId); } }
From source file:com.android.managedprovisioning.ProfileOwnerProvisioningService.java
private void initialize(Intent intent) { // Load the ProvisioningParams (from message in Intent). mParams = (ProvisioningParams) intent.getParcelableExtra(ProvisioningParams.EXTRA_PROVISIONING_PARAMS); if (mParams.accountToMigrate != null) { ProvisionLogger.logi("Migrating account to managed profile"); }//from w w w . jav a2 s .co m }
From source file:com.hema.playViewUtil.ui.OnlineVideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ???/* ww w .j av a 2s . com*/ requestWindowFeature(Window.FEATURE_NO_TITLE); // ???? getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_player); mSettings = new Settings(this); // handle arguments mVideoPath = getIntent().getStringExtra("videoPath"); Intent intent = getIntent(); String intentAction = intent.getAction(); if (!TextUtils.isEmpty(intentAction)) { if (intentAction.equals(Intent.ACTION_VIEW)) { mVideoPath = intent.getDataString(); } else if (intentAction.equals(Intent.ACTION_SEND)) { mVideoUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { String scheme = mVideoUri.getScheme(); if (TextUtils.isEmpty(scheme)) { Log.e(TAG, "Null unknown ccheme\n"); finish(); return; } if (scheme.equals(ContentResolver.SCHEME_ANDROID_RESOURCE)) { mVideoPath = mVideoUri.getPath(); } else if (scheme.equals(ContentResolver.SCHEME_CONTENT)) { Log.e(TAG, "Can not resolve content below Android-ICS\n"); finish(); return; } else { Log.e(TAG, "Unknown scheme " + scheme + "\n"); finish(); return; } } } } if (!TextUtils.isEmpty(mVideoPath)) { new RecentMediaStorage(this).saveUrlAsync(mVideoPath); } // init UI // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // setSupportActionBar(toolbar); // ActionBar actionBar = getSupportActionBar(); mMediaController = new AndroidMediaController(this, false); // mMediaController.setSupportActionBar(actionBar); mToastTextView = (TextView) findViewById(R.id.toast_text_view); mHudView = (TableLayout) findViewById(R.id.hud_view); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mRightDrawer = (ViewGroup) findViewById(R.id.right_drawer); loading_icon = (ProgressBar) findViewById(R.id.loading_icon); mDrawerLayout.setScrimColor(Color.TRANSPARENT); // init player IjkMediaPlayer.loadLibrariesOnce(null); IjkMediaPlayer.native_profileBegin("libijkplayer.so"); mVideoView = (IjkVideoView) findViewById(R.id.video_view); mVideoView.setMediaController(mMediaController); // mVideoView.setHudView(mHudView); setListener(); // prefer mVideoPath if (mVideoPath != null) mVideoView.setVideoPath(mVideoPath); else if (mVideoUri != null) mVideoView.setVideoURI(mVideoUri); else { Log.e(TAG, "Null Data Source\n"); finish(); return; } mVideoView.start(); }
From source file:com.putlocker.upload.DownloadService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { PutlockerUpDownloadJob upDownJob = null; Notification notification = null; if (intent.hasExtra(JOB_EXTRA_DOWNLOAD)) { final PutlockerDownloadJob job = intent.getParcelableExtra(JOB_EXTRA_DOWNLOAD); notification = createDownloadNotification(job, this, 0); upDownJob = job;/*from w w w . j av a2s . c om*/ } else { final PutlockerUploadJob job = intent.getParcelableExtra(JOB_EXTRA_UPLOAD); notification = createDownloadNotification(job, this, 0); upDownJob = job; } if (downloadJobs.size() == 0) { startForeground((int) upDownJob.getGlobalId(), notification); } else { mNM.notify(upDownJob.getGlobalId(), notification); } downloadJobs.append(upDownJob.getGlobalId(), notification); return super.onStartCommand(intent, flags, startId); }