Example usage for android.content Intent FILL_IN_DATA

List of usage examples for android.content Intent FILL_IN_DATA

Introduction

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

Prototype

int FILL_IN_DATA

To view the source code for android.content Intent FILL_IN_DATA.

Click Source Link

Document

Use with #fillIn to allow the current data or type value overwritten, even if it is already set.

Usage

From source file:pl.charmas.android.reactivelocation.observables.activity.ActivityRecognitionIntentService.java

/**
 * Called when a new activity detection update is available.
 *//*  w  w  w  . ja  v a2s .c om*/
@Override
protected void onHandleIntent(Intent intent) {

    Intent i = new Intent(ActivityUpdatesObservable.ACTION_ACTIVITY_DETECTED);
    i.fillIn(intent, Intent.FILL_IN_DATA);
    LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(i);

}

From source file:disono.webmons.com.clean_architecture.presentation.ui.activities.communication.voice.SIPService.java

/**
 * Logs you into your SIP provider, registering this device as the location to
 * send SIP calls to for your SIP address.
 *///from  w  ww  .  j a  v  a 2 s.com
private void _initializeLocalProfile() {
    if (manager == null) {
        return;
    }

    // unregister profile to server
    if (me != null) {
        _closeLocalProfile();
    }

    // SIP authentication details
    String username = "";
    String password = "";
    String domain = Configurations.envString("sipDomain");

    // check if domain configuration is set
    if (domain != null) {
        return;
    }

    // always check the variables for values
    if (username.length() == 0 || domain.length() == 0 || password.length() == 0) {
        return;
    }

    try {
        SipProfile.Builder builder = new SipProfile.Builder(username, domain);
        builder.setPassword(password);
        me = builder.build();

        // intent for incoming calls
        Intent i = new Intent();
        i.setAction("android.SipDemo.INCOMING_CALL");
        PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA);
        manager.open(me, pi, null);

        // This listener must be added AFTER manager.open is called,
        // Otherwise the methods aren't guaranteed to fire.
        manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
            @Override
            public void onRegistering(String localProfileUri) {
                Log.i(TAG, "_initializeLocalProfile:Registering with SIP Server...");
            }

            @Override
            public void onRegistrationDone(String localProfileUri, long expiryTime) {
                Log.i(TAG, "_initializeLocalProfile:Ready");
                _updateStatus(0, "Ready", null);
            }

            @Override
            public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
                Log.e(TAG, "_initializeLocalProfile:Registration failed: " + errorMessage);
            }
        });
    } catch (ParseException pe) {
        Log.e(TAG, "ParseException: " + pe.getMessage());
    } catch (SipException se) {
        Log.e(TAG, "SipException: " + se.getMessage());
    }
}

From source file:com.peppermint.peppermint.ui.CallFragment.java

/**
 * Logs you into your SIP provider, registering this device as the location to
 * send SIP calls to for your SIP address.
 *//*from   w  ww  .  j ava  2  s.  c  om*/
public void initializeLocalProfile() {
    if (manager == null) {
        return;
    }

    if (profile != null) {
        closeLocalProfile();
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext());
    sipUsername = prefs.getString("namePref", "");
    sipDomain = prefs.getString("domainPref", "");
    sipPassword = prefs.getString("passPref", "");
    sipPort = Integer.parseInt(prefs.getString("portPref", "5060"));

    if (sipUsername.length() == 0 || sipDomain.length() == 0 || sipPassword.length() == 0) {
        getActivity().showDialog(R.id.SET_SIP_OPTIONS);
        return;
    }

    try {
        SipProfile.Builder builder = new SipProfile.Builder(sipUsername, sipDomain);
        builder.setPassword(sipPassword);
        builder.setPort(sipPort);
        profile = builder.build();

        Intent i = new Intent();
        i.setAction("com.peppermint.peppermint.INCOMING_CALL");
        PendingIntent pi = PendingIntent.getBroadcast(currentContext, 0, i, Intent.FILL_IN_DATA);
        manager.open(profile, pi, null);

        // This listener must be added AFTER manager.open is called,
        // Otherwise the methods aren't guaranteed to fire.

        manager.setRegistrationListener(profile.getUriString(), new SipRegistrationListener() {
            public void onRegistering(String localProfileUri) {
                updateStatus("Registering with SIP Server...");
            }

            public void onRegistrationDone(String localProfileUri, long expiryTime) {
                updateStatus("Ready");
            }

            public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) {
                updateStatus("Registration failed.  Please check settings.");
            }
        });
    } catch (ParseException pe) {
        updateStatus("Connection Error.");
    } catch (SipException se) {
        updateStatus("Connection error.");
    }
}

From source file:edu.cmu.mpcs.dashboard.TagViewer.java

private String alarmSetting(String settingString) {
    if (settingString.contains("set alarm")) {
        /** Set Alarm **/

        String hour = settingString.substring(settingString.indexOf("#") + 1, settingString.indexOf("*"));
        String minute = settingString.substring(settingString.indexOf("*") + 1, settingString.indexOf("|"));

        Log.d("timePicker", hour + ":" + minute);

        int hr = Integer.parseInt(hour);
        int min = Integer.parseInt(minute);

        Log.d("Alarm", "hr:" + hr + "min:" + min);

        Calendar cal = Calendar.getInstance();
        // add minutes to the calendar object
        ///*  w  w  w  .  j ava 2  s.  co m*/
        cal.set(Calendar.HOUR_OF_DAY, hr);
        cal.set(Calendar.MINUTE, min);
        cal.set(Calendar.SECOND, 0);
        // cal.add(Calendar.MINUTE, 1);
        Intent alarmintent = new Intent(getApplicationContext(), AlarmReceiver.class);
        alarmintent.putExtra("title", "Alarm for " + hour + ":" + minute);
        alarmintent.putExtra("note", "Touch to turn off Alarm");
        // HELLO_ID is a static variable that must be
        // initialised at the BEGINNING OF CLASS with 1;

        PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), HELLO_ID, alarmintent,
                PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA);
        // VERY IMPORTANT TO SET FLAG_UPDATE_CURRENT...
        // this will send correct extra's informations
        // to
        // AlarmReceiver Class
        // Get the AlarmManager service

        AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);

        am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);
        Log.i("Alarm", "AlarmSet" + cal.toString());

        // /** Auto-sync **/
        //
        // if (!ContentResolver.getMasterSyncAutomatically())
        // ContentResolver.setMasterSyncAutomatically(true);
        // else {
        // ContentResolver.setMasterSyncAutomatically(false);
        // }

        return ("AlarmSet for : " + hour + ":" + min + "\n");

    }
    return ("");

}