Example usage for android.content Intent putExtra

List of usage examples for android.content Intent putExtra

Introduction

In this page you can find the example usage for android.content Intent putExtra.

Prototype

@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:edu.stanford.junction.android.AndroidJunctionMaker.java

/**
 * Launch the Activity Director to join an existing
 * Junction activity by some user-specified method.
 * /*from  ww w.  jav  a2s.c o m*/
 * @param context
 */
public static void joinActivity(Context context) {
    Intent intent = new Intent("junction.intent.action.join.ANY");
    intent.putExtra("package", context.getPackageName());
    IntentLauncher.launch(context, intent, "edu.stanford.prpl.junction.applaunch",
            "http://prpl.stanford.edu/android/JunctionAppLauncher.apk", "Activity Director");
}

From source file:com.facebook.unity.FB.java

@UnityCallable
public static void ShareLink(String params_str) {
    Log.v(TAG, "ShareLink(" + params_str + ")");
    final UnityParams unity_params = UnityParams.parse(params_str);
    final Bundle params = unity_params.getStringParams();
    Intent intent = new Intent(getUnityActivity(), FBUnityDialogsActivity.class);
    intent.putExtra(FBUnityDialogsActivity.DIALOG_TYPE, ShareDialogMode);
    intent.putExtra(FBUnityDialogsActivity.SHARE_DIALOG_PARAMS, params);
    getUnityActivity().startActivity(intent);
}

From source file:com.facebook.unity.FB.java

@UnityCallable
public static void FeedShare(String params_str) {
    Log.v(TAG, "FeedShare(" + params_str + ")");
    final UnityParams unityParams = UnityParams.parse(params_str);
    final Bundle params = unityParams.getStringParams();
    Intent intent = new Intent(getUnityActivity(), FBUnityDialogsActivity.class);
    intent.putExtra(FBUnityDialogsActivity.DIALOG_TYPE, ShareDialog.Mode.FEED);
    intent.putExtra(FBUnityDialogsActivity.FEED_DIALOG_PARAMS, params);
    getUnityActivity().startActivity(intent);
}

From source file:com.google.android.gcm.GCMRegistrar.java

public static synchronized void internalRegister(Context context, String... senderIds) {
    if (senderIds == null || senderIds.length == 0) {
        throw new IllegalArgumentException("No senderIds");
    }//  w ww. ja  v  a  2s. com
    StringBuilder builder = new StringBuilder(senderIds[0]);
    for (int i = 1; i < senderIds.length; i++) {
        builder.append(',').append(senderIds[i]);
    }
    String senders = builder.toString();
    Log.v(TAG, "Registering app " + context.getPackageName() + " of senders " + senders);
    Intent intent = new Intent(GCMConstants.INTENT_TO_GCM_REGISTRATION);
    intent.setPackage(GSF_PACKAGE);
    intent.putExtra(GCMConstants.EXTRA_APPLICATION_PENDING_INTENT,
            PendingIntent.getBroadcast(context, 0, new Intent(), 0));
    intent.putExtra(GCMConstants.EXTRA_SENDER, senders);
    context.startService(intent);
}

From source file:com.facebook.unity.FB.java

@UnityCallable
public static void GameGroupJoin(String params_str) {
    Log.v(TAG, "GameGroupJoin(" + params_str + ")");
    final UnityParams unity_params = UnityParams.parse(params_str);
    final Bundle params = unity_params.getStringParams();
    Intent intent = new Intent(getUnityActivity(), FBUnityJoinGameGroupActivity.class);
    intent.putExtra(FBUnityJoinGameGroupActivity.JOIN_GAME_GROUP_PARAMS, params);
    getUnityActivity().startActivity(intent);
}

From source file:com.facebook.unity.FB.java

@UnityCallable
public static void GameGroupCreate(String params_str) {
    Log.v(TAG, "GameGroupCreate(" + params_str + ")");
    final UnityParams unity_params = UnityParams.parse(params_str);
    final Bundle params = unity_params.getStringParams();
    Intent intent = new Intent(getUnityActivity(), FBUnityCreateGameGroupActivity.class);
    intent.putExtra(FBUnityCreateGameGroupActivity.CREATE_GAME_GROUP_PARAMS, params);
    getUnityActivity().startActivity(intent);
}

From source file:fr.julienvermet.bugdroid.service.CommentIntentService.java

public static Intent getIntent(Context context, Instance instance, int bugId, JSONObject jsonData) {
    Intent intent = new Intent(context, CommentIntentService.class);
    String accountSuffix = "";
    Account account = instance.account;//from  w w  w  .  j  a v  a 2  s.  c o m
    if (account != null) {
        accountSuffix = String.format(ACCOUNT_SUFFIX, account.username, account.password);
    }

    String bugSuffix = String.format(COMMENT_SUFFIX, bugId);
    String query = instance.url.concat(bugSuffix).concat(accountSuffix);

    intent.putExtra(JSON_DATA, jsonData.toString());
    intent.putExtra(QUERY, query);
    intent.putExtra(BUG_ID, bugId);
    return intent;
}

From source file:com.github.chenxiaolong.dualbootpatcher.FileUtils.java

private static void setCommonNativeSafOptions(Intent intent) {
    // Avoid cloud providers since we need the C file descriptor for the file
    intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
    // Hack to show internal/external storage by default
    intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
}

From source file:edu.stanford.junction.android.AndroidJunctionMaker.java

/**
 * Finds a pre-existing Junction activity by scanning for a QR code.
 * @param context//from   w  w w . jav a2 s  .  c om
 */
public static void findActivityByScan(final Activity activity) {
    WaitForInternetCallback callback = new WaitForInternetCallback(activity) {
        @Override
        public void onConnectionFailure() {
            activity.finish();
        }

        @Override
        public void onConnectionSuccess() {
            Intent intent = new Intent("junction.intent.action.join.SCAN");
            intent.putExtra("package", activity.getPackageName());
            IntentLauncher.launch(activity, intent, "edu.stanford.prpl.junction.applaunch",
                    "http://prpl.stanford.edu/android/JunctionAppLauncher.apk", "Activity Director");
        }
    };

    try {
        WaitForInternet.setCallback(callback);
    } catch (SecurityException e) {
        Log.w("junction",
                "Could not check network state. If you'd like this functionality, please add the permission: android.permission.ACCESS_NETWORK_STATE",
                e);
        callback.onConnectionSuccess();
    }
}

From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.AppObj.java

public static Intent getLaunchIntent(Context context, DbObj obj) {
    JSONObject content = obj.getJson();/*from ww  w  . ja va 2  s  .  co m*/
    if (content.has(ANDROID_PACKAGE_NAME)) {
        Uri appFeed = obj.getContainingFeed().getUri();
        String action = content.optString(ANDROID_ACTION);
        String pkgName = content.optString(ANDROID_PACKAGE_NAME);
        String className = content.optString(ANDROID_CLASS_NAME);

        Intent launch = new Intent(action);
        launch.setClassName(pkgName, className);
        launch.addCategory(Intent.CATEGORY_LAUNCHER);
        // TODO: feed for related objs, not parent feed
        launch.putExtra(AppState.EXTRA_FEED_URI, appFeed);
        launch.putExtra(AppState.EXTRA_OBJ_HASH, obj.getHash());
        // TODO: Remove
        launch.putExtra("obj", content.toString());

        List<ResolveInfo> resolved = context.getPackageManager().queryIntentActivities(launch, 0);
        if (resolved.size() > 0) {
            return launch;
        }

        Intent market = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pkgName));
        return market;
    } else if (content.has(WEB_URL)) {
        Intent app = new Intent(Intent.ACTION_VIEW, Uri.parse(content.optString(WEB_URL)));
        app.setClass(context, AppFinderActivity.class);
        app.putExtra(Musubi.EXTRA_FEED_URI, Feed.uriForName(obj.getFeedName()));
        return app;
    }
    return null;
}