Example usage for android.content Intent getStringExtra

List of usage examples for android.content Intent getStringExtra

Introduction

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

Prototype

public String getStringExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.imalu.alyou.activity.RegisterActivity_second.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register_second);

    identifying_codeEditText = (EditText) findViewById(R.id.identifying_code_edit);
    nextButton = (Button) findViewById(R.id.code_next_bt);
    identifying_codeButton = (Button) findViewById(R.id.identifying_code_bt);
    Intent intent = getIntent();
    phone = intent.getStringExtra("phone");
}

From source file:com.github.chenxiaolong.dualbootpatcher.appsharing.AppSharingService.java

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getStringExtra(ACTION);

    if (ACTION_PACKAGE_REMOVED.equals(action)) {
        onPackageRemoved(intent.getStringExtra(EXTRA_PACKAGE));
    }// ww w .ja va2s .  c o m
}

From source file:com.ademsha.appnotifico.NotificationHubCommandReceiver.java

private void executeCommands(Context context, Intent intent) {
    if (intent.getStringExtra("command").equals("cancel-all")) {
        cancelAllNotifications();// ww  w  .  j a  v  a  2  s .co  m
    } else if (intent.getStringExtra("command").equals("cancel-list")
            && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        cancelNotifications(intent);
    } else if (intent.getStringExtra("command").equals("cancel")
            && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        cancelNotification(intent);
    } else if (intent.getStringExtra("command").equals("get-all")) {
        getAllActiveNotifications(context);
    } else if (intent.getStringExtra("command").equals("get-list")) {
        getActiveNotifications(context, intent);
    }
}

From source file:com.groupxs.cordova.plugin.backgroundgpssend.AppService.java

@Override
protected void doWakefulWork(Intent intent) {
    String token = intent.getStringExtra("token");

    try {//from   w w  w  .j a v  a  2 s  . c  om
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(8);
        nameValuePairs.add(new BasicNameValuePair("Sender", token));
        nameValuePairs.add(new BasicNameValuePair("Latitude", "0"));
        nameValuePairs.add(new BasicNameValuePair("Longitude", "0"));
        nameValuePairs.add(new BasicNameValuePair("Accuracy", "0"));
        nameValuePairs.add(new BasicNameValuePair("Altitude", "0"));
        nameValuePairs.add(new BasicNameValuePair("Heading", "0"));
        nameValuePairs.add(new BasicNameValuePair("Speed", "0"));
        nameValuePairs.add(new BasicNameValuePair("AltitudeAccuracy", "0"));

        getJSONfromURL("https://localhost/api/GpsUpdate", nameValuePairs);
    } catch (Exception e) {
        Log.d("CordovaPlugin", "Exception sending data to server");
    }
}

From source file:com.ademsha.appnotifico.NotificationHubCommandReceiver.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void cancelNotification(Intent intent) {
    String key = intent.getStringExtra("data");
    if (!key.isEmpty()) {
        notificationHub.cancelNotification(key);
    }/*w  w  w. j  a v a  2  s .co  m*/
}

From source file:hongik.android.project.best.ReviewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_review);

    Intent intent = getIntent();
    buid = intent.getStringExtra("BUID");
    cid = intent.getStringExtra("CID");

    try {/*  w  w w  .j a  v a  2 s .  c  o m*/
        drawReview();
    } catch (Exception ex) {
    }
    showAlertDialog();
}

From source file:com.ademsha.appnotifico.NotificationHubDataReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getExtras() != null) {
        String command = intent.getStringExtra("command");
        if (command.equals("get-all")) {
            String data = intent.getStringExtra("data");
            JSONArray notifications;//  w w w  .  j  a va 2s. co m
            try {
                notifications = new JSONArray(data);
                for (int i = 0; i < notifications.length(); i++) {
                    JSONObject notification = notifications.getJSONObject(i);
                    Toast.makeText(context, notification.toString(), Toast.LENGTH_SHORT).show();
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        } else {
            Toast.makeText(context, command, Toast.LENGTH_SHORT).show();
        }
    }
}

From source file:com.ademsha.appnotifico.NotificationHubCommandReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getExtras() != null && intent.getStringExtra("command") != null) {
        executeCommands(context, intent);
    }//from  www. ja va 2s .  c om
}

From source file:ph.sakay.gateway.RoutingService.java

@Override
public void onHandleIntent(Intent intent) {
    Log.d("RoutingService", "Got routing request.");
    String sender = intent.getStringExtra("sender");
    String body = intent.getStringExtra("body");

    String reply = request(sender, body);
    Util.sendSms(sender, reply);//from ww  w  .ja v  a  2s  .co  m
}

From source file:com.gmail.at.faint545.services.DataQueueService.java

@Override
protected void onHandleIntent(Intent intent) {
    String url = intent.getStringExtra("url");
    String api = intent.getStringExtra("api");
    StringBuilder results = new StringBuilder();

    HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(url);

    ArrayList<NameValuePair> arguments = new ArrayList<NameValuePair>();
    arguments.add(new BasicNameValuePair(SabnzbdConstants.APIKEY, api));
    arguments.add(new BasicNameValuePair(SabnzbdConstants.OUTPUT, SabnzbdConstants.OUTPUT_JSON));
    arguments.add(new BasicNameValuePair(SabnzbdConstants.MODE, SabnzbdConstants.MODE_QUEUE));

    try {//from  w w  w.  ja  va2s.  c o m
        request.setEntity(new UrlEncodedFormEntity(arguments));
        HttpResponse result = client.execute(request);
        InputStream inStream = result.getEntity().getContent();
        BufferedReader br = new BufferedReader(new InputStreamReader(inStream), 8);
        String line;
        while ((line = br.readLine()) != null) {
            if (line.length() > 0) {
                results.append(line);
            }
        }
        br.close();
        inStream.close();

        Bundle extras = intent.getExtras();
        Messenger messenger = (Messenger) extras.get("messenger");
        Message message = Message.obtain();

        Bundle resultsBundle = new Bundle();
        resultsBundle.putString("results", results.toString());
        message.setData(resultsBundle);

        messenger.send(message);
        stopSelf();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}