private void sendMessage(final Activity activity) { SharedPreferences prefs = activity.getSharedPreferences(Constants.PREF_NAME, Context.MODE_PRIVATE); prefs .edit() .putBoolean(Constants.PREF_KEY_MESSAGE_CENTER_SHOULD_SHOW_INTRO_DIALOG, false) .commit(); // Save the email. if (interaction.isAskForEmail()) { if (email != null && email.length() != 0) { PersonManager.storePersonEmail(activity, email.toString()); Person person = PersonManager.storePersonAndReturnDiff(activity); if (person != null) { Log.d("Person was updated."); Log.v(person.toString()); ApptentiveDatabase.getInstance(activity).addPayload(person); } else { Log.d("Person was not updated."); } } } // Send the message. final TextMessage textMessage = new TextMessage(); textMessage.setBody(message.toString()); textMessage.setRead(true); /* // TODO: Figure out how to add custom data here. textMessage.setCustomData(customData); customData = null; */ MessageManager.sendMessage(activity, textMessage); }
public static void showSurvey( final ForgeTask task, @ForgeParam("tags") final JsonArray surveyTags) { Log.e("Tags: " + surveyTags.toString()); // Remove duplicates and empty string tags. Set<String> tagSet = new HashSet<String>(); for (int i = 0; i < surveyTags.size(); i++) { String tag = surveyTags.get(i).getAsString(); if (tag.length() > 0) { tagSet.add(tag); } } final String[] tags = tagSet.toArray(new String[] {}); task.performUI( new Runnable() { public void run() { Apptentive.showSurvey( ForgeApp.getActivity(), new OnSurveyFinishedListener() { @Override public void onSurveyFinished(boolean completed) { Log.d( "Firing apptentive.surveyFinishedsurvey event with parameter {%b}", completed); ForgeApp.event("apptentive.surveyFinished", new JsonPrimitive(completed)); } }, tags); } }); }
public void setCurrentCarrier(String currentCarrier) { try { put(KEY_CURRENT_CARRIER, currentCarrier); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_CURRENT_CARRIER); } }
public void setConfigurationCacheExpirationMillis(long configurationCacheExpirationMillis) { try { put(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS, configurationCacheExpirationMillis); } catch (JSONException e) { Log.w("Error adding %s to Configuration.", KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); } }
public void setOsVersion(String osVersion) { try { put(KEY_OS_VERSION, osVersion); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_OS_VERSION); } }
public void setBuildId(String buildId) { try { put(KEY_BUILD_ID, buildId); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_BUILD_ID); } }
public void setUuid(String uuid) { try { put(KEY_UUID, uuid); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_UUID); } }
public void setNetworkType(String networkType) { try { put(KEY_NETWORK_TYPE, networkType); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_NETWORK_TYPE); } }
public void setLocaleCountryCode(String localeCountryCode) { try { put(KEY_LOCALE_COUNTRY_CODE, localeCountryCode); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_LOCALE_COUNTRY_CODE); } }
public void setLocaleRaw(String localeRaw) { try { put(KEY_LOCALE_RAW, localeRaw); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_LOCALE_RAW); } }
public void setProduct(String product) { try { put(KEY_PRODUCT, product); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_PRODUCT); } }
public void setCustomData(CustomData customData) { try { put(KEY_CUSTOM_DATA, customData); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_CUSTOM_DATA); } }
public void setModel(String model) { try { put(KEY_MODEL, model); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_MODEL); } }
public void setBoard(String board) { try { put(KEY_BOARD, board); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_BOARD); } }
public void setManufacturer(String manufacturer) { try { put(KEY_MANUFACTURER, manufacturer); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_MANUFACTURER); } }
public void setOsApiLevel(String osApiLevel) { try { put(KEY_OS_API_LEVEL, osApiLevel); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_OS_API_LEVEL); } }
public void setOsBuild(String osBuild) { try { put(KEY_OS_BUILD, osBuild); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_OS_BUILD); } }
public void setBootloaderVersion(String bootloaderVersion) { try { put(KEY_BOOTLOADER_VERSION, bootloaderVersion); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_BOOTLOADER_VERSION); } }
public void setBrand(String brand) { try { put(KEY_BRAND, brand); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_BRAND); } }
public void setRadioVersion(String radioVersion) { try { put(KEY_RADIO_VERSION, radioVersion); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_RADIO_VERSION); } }
public void setCpu(String cpu) { try { put(KEY_CPU, cpu); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_CPU); } }
public void setIntegrationConfig(CustomData integrationConfig) { try { put(KEY_INTEGRATION_CONFIG, integrationConfig); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_INTEGRATION_CONFIG); } }
public void setDevice(String device) { try { put(KEY_DEVICE, device); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_DEVICE); } }
public void setLocaleLanguageCode(String localeLanguageCode) { try { put(KEY_LOCALE_LANGUAGE_CODE, localeLanguageCode); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_LOCALE_LANGUAGE_CODE); } }
public void setOsName(String osName) { try { put(KEY_OS_NAME, osName); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_OS_NAME); } }
public void setUtcOffset(String utcOffset) { try { put(KEY_UTC_OFFSET, utcOffset); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_UTC_OFFSET); } }
public void setBuildType(String buildType) { try { put(KEY_BUILD_TYPE, buildType); } catch (JSONException e) { Log.w("Error adding %s to Device.", KEY_BUILD_TYPE); } }
public static synchronized void start(Context context) { appContext = context.getApplicationContext(); if (!running) { Log.i("Starting PayloadRunner."); running = true; new PayloadRunner().start(); } }
private Drawable getIconDrawableResourceId(Activity activity) { try { PackageManager pm = activity.getPackageManager(); PackageInfo pi = pm.getPackageInfo(activity.getPackageName(), 0); return activity.getResources().getDrawable(pi.applicationInfo.icon); } catch (Exception e) { Log.e("Error loading app icon.", e); } return null; }
public static void isSurveyAvailable( final ForgeTask task, @ForgeParam("tags") final JsonArray surveyTags) { Log.e("Tags: " + surveyTags.toString()); String[] tags = new String[surveyTags.size()]; for (int i = 0; i < surveyTags.size(); i++) { tags[i] = surveyTags.get(i).getAsString(); } boolean available = Apptentive.isSurveyAvailable(ForgeApp.getActivity(), tags); task.success(available); }