List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:info.guardianproject.otr.app.im.app.WelcomeActivity.java
void handleIntentAPILaunch(Intent srcIntent) { Intent intent = new Intent(this, ImUrlActivity.class); intent.setAction(srcIntent.getAction()); if (srcIntent.getData() != null) intent.setData(srcIntent.getData()); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (srcIntent.getExtras() != null) intent.putExtras(srcIntent.getExtras()); startActivity(intent);//from w ww. j ava 2s. c o m setIntent(null); finish(); }
From source file:org.mythdroid.util.UpdateService.java
private void updateMythDroid(String ver, String url) { LogUtil.debug("Fetching APK from " + url); //$NON-NLS-1$ HttpFetcher fetcher = null;/*w w w . jav a 2 s . co m*/ try { fetcher = new HttpFetcher(url, false); } catch (ClientProtocolException e) { ErrUtil.logErr(e); notify("MythDroid" + Messages.getString("UpdateService.2"), //$NON-NLS-1$ //$NON-NLS-2$ e.getMessage()); return; } catch (IOException e) { ErrUtil.logErr(e); notify("MythDroid" + Messages.getString("UpdateService.2"), //$NON-NLS-1$ //$NON-NLS-2$ e.getMessage()); return; } final File storage = Environment.getExternalStorageDirectory(); final File outputFile = new File(storage.getAbsolutePath() + '/' + "Download", //$NON-NLS-1$ "MythDroid-" + ver + ".apk" //$NON-NLS-1$ //$NON-NLS-2$ ); LogUtil.debug("Saving to " + outputFile.getAbsolutePath()); //$NON-NLS-1$ FileOutputStream outputStream; try { outputStream = new FileOutputStream(outputFile); } catch (FileNotFoundException e) { ErrUtil.logErr("SDCard is unavailable"); //$NON-NLS-1$ notify("MythDroid" + Messages.getString("UpdateService.2"), //$NON-NLS-1$ //$NON-NLS-2$ Messages.getString("UpdateService.4") //$NON-NLS-1$ ); return; } try { fetcher.writeTo(outputStream); } catch (IOException e) { ErrUtil.logErr(e); notify("MythDroid" + Messages.getString("UpdateService.2"), //$NON-NLS-1$ //$NON-NLS-2$ e.getMessage()); return; } LogUtil.debug("Download successful, installing..."); //$NON-NLS-1$ final Intent installIntent = new Intent(Intent.ACTION_VIEW); installIntent.setDataAndType(Uri.fromFile(outputFile), "application/vnd.android.package-archive" //$NON-NLS-1$ ); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(installIntent); }
From source file:com.googlecode.android_scripting.facade.AndroidFacade.java
void startActivity(final Intent intent) { try {/*from ww w .jav a2 s .c o m*/ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mService.startActivity(intent); } catch (Exception e) { Log.e("Failed to launch intent.", e); } }
From source file:com.gb.cwsup.activity.order.WaitSureOrderActivity.java
/** * ?/*from w w w . j a v a2 s. c om*/ */ private void startscan() { if (dialog != null) { dialog.dismiss(); } Intent insureintent = new Intent(WaitSureOrderActivity.this, MipcaActivityCapture.class); insureintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(insureintent, SCANNIN_GREQUEST_CODE); }
From source file:gpsalarm.app.service.PostMonitor.java
private void showProximityNotification(String string) { final NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification note = new Notification(R.drawable.status, "Friend@ notification!", System.currentTimeMillis()); Intent i = new Intent(this, AlertList.class); // i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP| // Intent.FLAG_ACTIVITY_SINGLE_TOP); i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); note.setLatestEventInfo(this, "Friend@ notification", string, pi); mgr.notify(NOTIFICATION_ID, note);//from w ww . j a v a2 s . c o m }
From source file:com.procasy.dubarah_nocker.gcm.MyGcmPushReceiver.java
/** * Called when message is received.//from w w w . jav a2s .com * * @param from SenderID of the sender. * @param bundle Data bundle containing message data as key/value pairs. * For Set of keys use data.keySet(). */ @Override public void onMessageReceived(String from, Bundle bundle) { MainActivity.getInstance().updateNotification(); try { Log.e("notify_gcm", "success , type = " + bundle.toString()); switch (bundle.getString(GCM_TAG)) { case "GENERAL": { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.hourly_logo).setContentTitle(bundle.getString(TITLE_TAG)) .setContentText(bundle.getString(DESC_TAG)); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.notify(12, mBuilder.build()); mNotification = new com.procasy.dubarah_nocker.Helper.Notification(getApplicationContext()); mNotification.open(); try { ContentValues contentValues = new ContentValues(); contentValues.put(mNotification.COL_notification_type, GENERAL_TAG); contentValues.put(mNotification.COL_notfication_status, 0); contentValues.put(mNotification.COL_notfication_title, bundle.getString(TITLE_TAG)); contentValues.put(mNotification.COL_notfication_desc, bundle.getString(DESC_TAG)); contentValues.put(mNotification.COL_notfication_content, bundle.getString(CONTENT_TAG)); mNotification.insertEntry(contentValues); } catch (Exception e) { e.printStackTrace(); } finally { mNotification.close(); } break; } case "HELP": { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.hourly_logo).setContentTitle(bundle.getString(TITLE_TAG)) .setContentText(bundle.getString(DESC_TAG)); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.notify(12, mBuilder.build()); mNotification = new com.procasy.dubarah_nocker.Helper.Notification(getApplicationContext()); mNotification.open(); try { ContentValues contentValues = new ContentValues(); contentValues.put(mNotification.COL_notification_type, HELP_TAG); contentValues.put(mNotification.COL_notfication_status, 0); contentValues.put(mNotification.COL_notfication_title, bundle.getString(TITLE_TAG)); contentValues.put(mNotification.COL_notfication_desc, bundle.getString(DESC_TAG)); contentValues.put(mNotification.COL_notfication_content, bundle.getString(CONTENT_TAG)); mNotification.insertEntry(contentValues); } catch (Exception e) { e.printStackTrace(); } finally { mNotification.close(); } JSONObject content = new JSONObject(bundle.getString("content")); JSONObject hr = content.getJSONObject("hr"); JSONArray album = content.getJSONArray("album"); System.out.println(content.getInt("hr_id")); System.out.println(content.toString()); Bundle bundle1 = new Bundle(); bundle1.putString("hr_id", hr.getString("hr_id")); bundle1.putString("hr_user_id", hr.getString("hr_user_id")); bundle1.putString("hr_description", hr.getString("hr_description")); bundle1.putString("hr_est_date", hr.getString("hr_est_date")); bundle1.putString("hr_est_time", hr.getString("hr_est_time")); bundle1.putString("hr_skill_id", hr.getString("hr_skill_id")); bundle1.putString("hr_ua_id", hr.getString("hr_ua_id")); bundle1.putString("hr_voice_record", hr.getString("hr_voice_record")); bundle1.putString("hr_language", hr.getString("hr_language")); bundle1.putString("hr_lat", hr.getString("hr_lat")); bundle1.putString("hr_lon", hr.getString("hr_lon")); bundle1.putString("hr_address", hr.getString("hr_address")); ArrayList<String> array = new ArrayList<>(); for (int i = 0; i < album.length(); i++) { JSONObject object = album.getJSONObject(i); array.add(object.getString("ahr_img")); } bundle1.putStringArrayList("album", array); Intent intent = (new Intent(getApplicationContext(), JobRequestActivity.class)); intent.putExtras(bundle1); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplicationContext().startActivity(intent); break; } case "APPOINTEMENT": { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.hourly_logo).setContentTitle(bundle.getString(TITLE_TAG)) .setContentText(bundle.getString(DESC_TAG)); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.notify(12, mBuilder.build()); mNotification = new com.procasy.dubarah_nocker.Helper.Notification(getApplicationContext()); mNotification.open(); try { ContentValues contentValues = new ContentValues(); contentValues.put(mNotification.COL_notification_type, APPOINTEMENT_TAG); contentValues.put(mNotification.COL_notfication_status, 0); contentValues.put(mNotification.COL_notfication_title, bundle.getString(TITLE_TAG)); contentValues.put(mNotification.COL_notfication_desc, bundle.getString(DESC_TAG)); contentValues.put(mNotification.COL_notfication_content, bundle.getString(CONTENT_TAG)); mNotification.insertEntry(contentValues); } catch (Exception e) { e.printStackTrace(); } finally { mNotification.close(); } break; } case "QOUTA_USER": { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.hourly_logo).setContentTitle(bundle.getString(TITLE_TAG)) .setContentText(bundle.getString(DESC_TAG)); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.notify(12, mBuilder.build()); mNotification = new com.procasy.dubarah_nocker.Helper.Notification(getApplicationContext()); mNotification.open(); try { ContentValues contentValues = new ContentValues(); contentValues.put(mNotification.COL_notification_type, USER_Qouta_TAG); contentValues.put(mNotification.COL_notfication_status, 0); contentValues.put(mNotification.COL_notfication_title, bundle.getString(TITLE_TAG)); contentValues.put(mNotification.COL_notfication_desc, bundle.getString(DESC_TAG)); contentValues.put(mNotification.COL_notfication_content, bundle.getString(CONTENT_TAG)); mNotification.insertEntry(contentValues); } catch (Exception e) { e.printStackTrace(); } finally { mNotification.close(); } break; } case "QOUTA_NOCKER": { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.hourly_logo).setContentTitle(bundle.getString(TITLE_TAG)) .setContentText(bundle.getString(DESC_TAG)); Intent resultIntent = new Intent(this, MainActivity.class); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(MainActivity.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mBuilder.setDefaults( Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS | Notification.DEFAULT_VIBRATE); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); mNotificationManager.notify(12, mBuilder.build()); mNotification = new com.procasy.dubarah_nocker.Helper.Notification(getApplicationContext()); mNotification.open(); try { ContentValues contentValues = new ContentValues(); contentValues.put(mNotification.COL_notification_type, Nocker_Qouta_TAG); contentValues.put(mNotification.COL_notfication_status, 0); contentValues.put(mNotification.COL_notfication_title, bundle.getString(TITLE_TAG)); contentValues.put(mNotification.COL_notfication_desc, bundle.getString(DESC_TAG)); contentValues.put(mNotification.COL_notfication_content, bundle.getString(CONTENT_TAG)); mNotification.insertEntry(contentValues); } catch (Exception e) { e.printStackTrace(); } finally { mNotification.close(); } break; } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.zira.registration.BackgroundCheckActivity.java
@Override public void onBackPressed() { Intent intent = new Intent(BackgroundCheckActivity.this, VehicleInformationActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent);//w w w . j a va 2s . c o m }
From source file:com.zira.registration.VehicleInformationActivity.java
private void forwardToNextScreen() { SingleTon.getInstance().setVehicleLicencePlateNumber(licensePlateNumberEditText.getText().toString()); // editor.putString("licplateno", licensePlateNumberEditText.getText().toString()); // editor.commit(); //finish();//from w ww .j av a 2s. co m Intent intent = new Intent(VehicleInformationActivity.this, BackgroundCheckActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); }
From source file:com.campusconnect.GoogleSignInActivity.java
private void firebaseAuthWithGoogle(final GoogleSignInAccount acct) { Log.d(TAG, "firebaseAuthWithGoogle:" + acct.getId()); // [START_EXCLUDE silent] showProgressDialog();/* w ww . j av a 2s. c o m*/ // [END_EXCLUDE] AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null); mAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful()); // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. if (!task.isSuccessful()) { Log.w(TAG, "signInWithCredential", task.getException()); Toast.makeText(GoogleSignInActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } else { Bundle params = new Bundle(); params.putString("firebaseauth", "success"); firebaseAnalytics.logEvent("login_firebase", params); personName = acct.getDisplayName(); personEmail = acct.getEmail(); personId = acct.getId(); Log.i("sw32", personId + ": here"); if (acct.getPhotoUrl() != null) { personPhoto = acct.getPhotoUrl().toString() + ""; Log.d("photourl", personPhoto); } else personPhoto = "shit"; // mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName())); SharedPreferences sharedpreferences = getSharedPreferences("CC", Context.MODE_PRIVATE); if (sharedpreferences.contains("profileId")) { Intent home = new Intent(GoogleSignInActivity.this, HomeActivity2.class); home.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(home); finish(); } else { //TODO: SIGN-IN Retrofit retrofit = new Retrofit.Builder().baseUrl(MyApi.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); MyApi myApi = retrofit.create(MyApi.class); Log.i("sw32", personEmail + " : " + personId + " : " + FirebaseInstanceId.getInstance().getToken()); MyApi.getProfileRequest body = new MyApi.getProfileRequest(personEmail, personId, FirebaseInstanceId.getInstance().getToken()); Call<ModelGetProfile> call = myApi.getProfile(body); call.enqueue(new Callback<ModelGetProfile>() { @Override public void onResponse(Call<ModelGetProfile> call, Response<ModelGetProfile> response) { ModelGetProfile profile = response.body(); if (profile != null) { if (profile.getResponse().equals("0")) { SharedPreferences sharedPreferences = getSharedPreferences("CC", MODE_PRIVATE); sharedPreferences.edit().putString("profileId", profile.getProfileId()) .putString("collegeId", profile.getCollegeId()) .putString("personId", personId) .putString("collegeName", profile.getCollegeName()) .putString("batchName", profile.getBatchName()) .putString("branchName", profile.getBranchName()) .putString("sectionName", profile.getSectionName()) .putString("profileName", personName) .putString("email", personEmail) .putString("photourl", profile.getPhotourl()).apply(); Log.d("profileId", profile.getProfileId()); Intent home = new Intent(GoogleSignInActivity.this, HomeActivity2.class); home.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(home); finish(); } else { try { String decider = Branch.getInstance().getLatestReferringParams() .getString("+clicked_branch_link"); Intent registration = new Intent(GoogleSignInActivity.this, RegistrationPageActivity.class); if (decider.equals("false")) { registration.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); registration.putExtra("personName", personName); registration.putExtra("personEmail", personEmail); registration.putExtra("personPhoto", personPhoto); registration.putExtra("personId", personId); startActivity(registration); finish(); Log.d("branch", "regester called"); } } catch (JSONException e) { e.printStackTrace(); } } } } @Override public void onFailure(Call<ModelGetProfile> call, Throwable t) { } }); } } // [START_EXCLUDE] //Branch login try { String decider = Branch.getInstance().getLatestReferringParams() .getString("+clicked_branch_link"); if (decider.equals("true")) { if (Branch.isAutoDeepLinkLaunch(GoogleSignInActivity.this)) { final String collegeId = Branch.getInstance().getLatestReferringParams() .getString("collegeId"); final String collegeName = Branch.getInstance().getLatestReferringParams() .getString("collegeName"); final String batchName = Branch.getInstance().getLatestReferringParams() .getString("batch"); final String branchName = Branch.getInstance().getLatestReferringParams() .getString("branch"); final String sectionName = Branch.getInstance().getLatestReferringParams() .getString("sectionName"); String brachCoursesId = Branch.getInstance().getLatestReferringParams() .getString("coursesId"); Log.d("brancS:", brachCoursesId); String replace = brachCoursesId.replace("[", ""); String replace1 = replace.replace("]", ""); final List<String> coursesId = new ArrayList<String>( Arrays.asList(replace1.split("\\s*,\\s*"))); Log.d("brancL:", coursesId.toString()); Retrofit branchRetrofit = new Retrofit.Builder().baseUrl(FragmentCourses.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); MyApi myApi = branchRetrofit.create(MyApi.class); final MyApi.getProfileIdRequest request; Log.d("firebase", FirebaseInstanceId.getInstance().getId()); request = new MyApi.getProfileIdRequest(personName, collegeId, batchName, branchName, sectionName, personPhoto, personEmail, FirebaseInstanceId.getInstance().getId(), personId); Call<ModelSignUp> modelSignUpCall = myApi.getProfileId(request); modelSignUpCall.enqueue(new Callback<ModelSignUp>() { @Override public void onResponse(Call<ModelSignUp> call, Response<ModelSignUp> response) { ModelSignUp signUp = response.body(); if (signUp != null) { profileId = signUp.getKey(); SharedPreferences sharedPreferences = getSharedPreferences("CC", MODE_PRIVATE); sharedPreferences.edit().putString("profileId", profileId) .putString("collegeId", collegeId).putString("personId", personId) .putString("collegeName", collegeName) .putString("batchName", batchName) .putString("branchName", branchName) .putString("sectionName", sectionName) .putString("profileName", personName) .putString("email", personEmail).putString("photourl", personPhoto) .apply(); Log.d("branch login sucess", profileId); Retrofit retrofit = new Retrofit.Builder().baseUrl(FragmentCourses.BASE_URL) .addConverterFactory(GsonConverterFactory.create()).build(); MyApi branchMyApi = retrofit.create(MyApi.class); MyApi.subscribeCourseRequest subscribeCourseRequest = new MyApi.subscribeCourseRequest( profileId, coursesId); Call<ModelSubscribe> courseSubscribeCall = branchMyApi .subscribeCourse(subscribeCourseRequest); courseSubscribeCall.enqueue(new Callback<ModelSubscribe>() { @Override public void onResponse(Call<ModelSubscribe> call, Response<ModelSubscribe> response) { ModelSubscribe subscribe = response.body(); if (subscribe != null) { Log.d("branch response:", subscribe.getResponse()); SharedPreferences sharedPreferences = getSharedPreferences("CC", MODE_PRIVATE); sharedPreferences.edit() .putString("coursesId", coursesId.toString()).apply(); } Intent intent_temp = new Intent(getApplicationContext(), HomeActivity2.class); intent_temp.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent_temp); Log.d("branch", "home activity"); Bundle params = new Bundle(); params.putString("course_subscribe", "success"); firebaseAnalytics.logEvent("course_subscribe", params); finish(); } @Override public void onFailure(Call<ModelSubscribe> call, Throwable t) { Log.d("couses", "failed"); } }); } } @Override public void onFailure(Call<ModelSignUp> call, Throwable t) { Log.d("branch login", "failed"); } }); } else { Log.e("BRanch", "Launched by normal application flow"); } } } catch (JSONException e) { e.printStackTrace(); } hideProgressDialog(); // [END_EXCLUDE] } }); }
From source file:com.googlecode.android_scripting.facade.AndroidFacade.java
@Rpc(description = "Create an Intent.", returns = "An object representing an Intent") public Intent makeIntent(@RpcParameter(name = "action") String action, @RpcParameter(name = "uri") @RpcOptional String uri, @RpcParameter(name = "type", description = "MIME type/subtype of the URI") @RpcOptional String type, @RpcParameter(name = "extras", description = "a Map of extras to add to the Intent") @RpcOptional JSONObject extras, @RpcParameter(name = "categories", description = "a List of categories to add to the Intent") @RpcOptional JSONArray categories, @RpcParameter(name = "packagename", description = "name of package. If used, requires classname to be useful") @RpcOptional String packagename, @RpcParameter(name = "classname", description = "name of class. If used, requires packagename to be useful") @RpcOptional String classname, @RpcParameter(name = "flags", description = "Intent flags") @RpcOptional Integer flags) throws JSONException { Intent intent = buildIntent(action, uri, type, extras, packagename, classname, categories); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (flags != null) { intent.setFlags(flags);//from w w w .java2 s . co m } return intent; }