List of usage examples for android.content Intent getStringExtra
public String getStringExtra(String name)
From source file:com.apptentive.android.sdk.Apptentive.java
/** * Saves Apptentive specific data from a push notification Intent. In your BroadcastReceiver, if the push notification * came from Apptentive, it will have data that needs to be saved before you launch your Activity. You must call this * method <strong>every time</strong> you get a push opened Intent, and before you launch your Activity. If the push * notification did not come from Apptentive, this method has no effect. * <p/>//from w w w. j ava 2 s .c o m * <strong>Note: </strong>If you are using Parse, do not use this method. Instead, see the Apptentive * <a href="http://www.apptentive.com/docs/android/integration/"> integration guide</a> for Parse. * * @param context The Context from which this method is called. * @param intent The Intent that you received when the user opened a push notification. */ public static boolean setPendingPushNotification(Context context, Intent intent) { String apptentive = null; if (intent != null) { Log.i("Received Apptentive push notification."); apptentive = intent.getStringExtra(Apptentive.APPTENTIVE_PUSH_EXTRA_KEY); if (apptentive != null) { Log.d("Saving Apptentive push notification data."); SharedPreferences prefs = context.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); prefs.edit().putString(Constants.PREF_KEY_PENDING_PUSH_NOTIFICATION, apptentive).commit(); return true; } else { Log.d("Not an apptentive push notification."); } } return false; }
From source file:com.riksof.a320.c2dm.common.C2DMReceiver.java
@Override protected void onMessage(Context contxt, Intent intent) { String unValidatedURL = intent.getStringExtra("payload"); Log.w("C2DMReceiver", unValidatedURL); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); int icon = R.drawable.ic_launcher; // icon from resources CharSequence tickerText = "You got message !!!"; // ticker-text long when = System.currentTimeMillis(); // notification time Context context = getApplicationContext(); // application Context Intent notificationIntent = new Intent(this, PushEndpointDemo.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); CharSequence contentTitle = "Norification Received !"; // the next two lines initialize the Notification, using the configurations above Notification notification = new Notification(icon, tickerText, when); notification.defaults |= Notification.DEFAULT_LIGHTS; notification.ledARGB = 0xff00ff00;/*from w w w . j a v a 2 s .c om*/ notification.ledOnMS = 300; notification.ledOffMS = 1000; notification.flags |= Notification.FLAG_SHOW_LIGHTS; notification.setLatestEventInfo(context, contentTitle, unValidatedURL, contentIntent); notificationManager.notify(10001, notification); Cache.getInstance().remove(unValidatedURL); FileCache fc = new FileCache(context); fc.clear(); Log.w("C2DMReceiver", "finish"); }
From source file:at.metalab.donarsson.screeninvader.InvadeScreen.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService( Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { //TODO: Check if we know a ScreenInvader on this network Intent intent = getIntent(); String type = intent.getType(); if (type.startsWith("text/")) { String text = intent.getStringExtra(Intent.EXTRA_TEXT); Pattern pattern = Patterns.WEB_URL; Matcher matcher = pattern.matcher(text); while (matcher.find()) { String url = matcher.group(); new PostUrlTask().execute(url); }/*from w w w.ja va 2 s . c om*/ } //TODO: Add support for other types (file upload) } else { //TODO: Display a prompt to connect to a WiFi Toast.makeText(getApplicationContext(), getString(R.string.no_wifi_toast), Toast.LENGTH_LONG).show(); } finish(); }
From source file:com.avanade.C2DMReceiver.java
@Override protected void onMessage(Context context, Intent intent) { int flag = 0; Log.w("C2DMReceiver", intent.getStringExtra("Count")); String count = intent.getStringExtra("Count"); ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); List<RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses(); for (int i = 0; i < procInfos.size(); i++) { if (procInfos.get(i).processName.equals("com.avanade")) { if (count.startsWith("com.avanade")) { count = getIntFromEndOfString(count); numberNoti = count;/*from w ww. j av a 2s. c o m*/ flag = 1; break; } } } if (flag == 1) { Intent pushUpdateIntent = new Intent(getBaseContext(), PushUpdate.class); pushUpdateIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //pushUpdateIntent.putExtra("unregister", true); getApplication().startActivity(pushUpdateIntent); flag = 0; } else { // System.out.println(" the app is not runnning......do something"); //Toast.makeText(getApplicationContext(), "Notification Received", Toast.LENGTH_SHORT).show(); } }
From source file:com.clover.sdk.v1.app.AppNotification.java
public AppNotification(Intent intent) { Assert.assertEquals(AppNotificationIntent.ACTION_APP_NOTIFICATION, intent.getAction()); appEvent = intent.getStringExtra(AppNotificationIntent.EXTRA_APP_EVENT); payload = intent.getStringExtra(AppNotificationIntent.EXTRA_PAYLOAD); }
From source file:net.olejon.mdapp.PharmaciesLocationMapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Connected? if (!mTools.isDeviceConnected()) mTools.showToast(getString(R.string.device_not_connected), 1); // Intent//from w w w. j av a 2 s . c o m final Intent intent = getIntent(); mPharmacyName = intent.getStringExtra("name"); mPharmacyAddress = intent.getStringExtra("address"); // Location if (mPharmacyAddress.startsWith("Boks") || mPharmacyAddress.startsWith("Pb.") || mPharmacyAddress.startsWith("Postboks") || mPharmacyAddress.startsWith("Serviceboks")) { mTools.showToast(getString(R.string.pharmacies_location_map_post_box_location), 1); finish(); return; } // Layout setContentView(R.layout.activity_pharmacies_location_map); // Toolbar final Toolbar toolbar = (Toolbar) findViewById(R.id.pharmacies_location_map_toolbar); toolbar.setTitle(mPharmacyName); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Map MapFragment mapFragment = (MapFragment) getFragmentManager() .findFragmentById(R.id.pharmacies_location_map_map); mapFragment.getMapAsync(this); }
From source file:com.example.administrator.myapplication2._2_exercise._2_End.LeftFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout._2_fragment_main_dummy, container, false); Intent myIntent = getActivity().getIntent(); if (myIntent != null) { seq = myIntent.getStringExtra("seq"); }/*w w w . ja va2 s.c om*/ tvHeart = (TextView) rootView.findViewById(R.id.tvHeart); tvDistance = (TextView) rootView.findViewById(R.id.tvDistance); tvCalorie = (TextView) rootView.findViewById(R.id.tvCalorie); tvWeight = (TextView) rootView.findViewById(R.id.tvWeight); tvRuntime = (TextView) rootView.findViewById(R.id.tvRuntime); SharedPreferences myPrefs = this.getActivity().getSharedPreferences("login", Context.MODE_PRIVATE); if ((myPrefs != null) && (myPrefs.contains("id"))) { id = myPrefs.getString("id", ""); Log.i("logintest", id.toString()); } // getRecentSeq(); getRecentData(); return rootView; }
From source file:com.example.activity.ShotActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.shot);//from w w w. j a v a2s. c o m Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); playerName = intent.getStringExtra(PLAYER_NAME); back = (ImageView) findViewById(R.id.topview_back); back.setVisibility(View.VISIBLE); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); title = (TextView) findViewById(R.id.topview_title); title.setText(playerName + "Shot"); xlistView = (XListView) findViewById(R.id.shot_listview); xlistView.setXListViewListener(this, 0); xlistView.setPullLoadEnable(true); xlistView.setRefreshTime(); shotModel = new ShotModel(this); shotModel.addResponseListener(this); shotModel.getProfileShotList(playerId); }
From source file:com.example.activity.LikeShotListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.shot);/*from www .j av a2 s . c o m*/ Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); playerName = intent.getStringExtra(PLAYER_NAME); back = (ImageView) findViewById(R.id.topview_back); back.setVisibility(View.VISIBLE); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); title = (TextView) findViewById(R.id.topview_title); title.setText(playerName + "Shot"); xlistView = (XListView) findViewById(R.id.shot_listview); xlistView.setXListViewListener(this, 0); xlistView.setPullLoadEnable(true); xlistView.setRefreshTime(); likeShotModel = new LikeShotModel(this); likeShotModel.addResponseListener(this); likeShotModel.getLikeShotList(playerId); }
From source file:com.example.activity.FollowingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.followers_list); Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); playerName = intent.getStringExtra(PLAYER_NAME); title = (TextView) findViewById(R.id.topview_title); back = (ImageView) findViewById(R.id.topview_back); title.setText(playerName + ""); back.setVisibility(View.VISIBLE); back.setOnClickListener(new OnClickListener() { @Override// w ww . ja v a2s . c o m public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); xlistView = (XListView) findViewById(R.id.followers_listview); xlistView.setXListViewListener(this, 0); xlistView.setPullLoadEnable(true); xlistView.setRefreshTime(); followingModel = new FollowingModel(this); followingModel.addResponseListener(this); followingModel.getFollowing(playerId); }