public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // OPTIONAL: To specify a different user email than what the device was setup with. // Apptentive.setInitialUserEmail(this, "*****@*****.**"); // OPTIONAL: To send extra about the device to the server. // Apptentive.addCustomDeviceData(this, "custom_device_key", "custom_device_value"); // Apptentive.addCustomPersonData(this, "custom_person_key", "custom_person_value"); // OPTIONAL: Specify a different rating provider if your app is not served from Google Play. // Apptentive.setRatingProvider(new AmazonAppstoreRatingProvider()); // Impersonate an app for ratings. // Apptentive.putRatingProviderArg("package", "your.package.name"); // If you would like to be notified when there are unread messages available, set a listener // like this. Apptentive.setUnreadMessagesListener( new UnreadMessagesListener() { public void onUnreadMessageCountChanged(final int unreadMessages) { Log.e(LOG_TAG, "There are " + unreadMessages + " unread messages."); runOnUiThread( new Runnable() { public void run() { Button messageCenterButton = (Button) findViewById(R.id.button_message_center); if (messageCenterButton != null) { messageCenterButton.setText("Message Center, unread = " + unreadMessages); } if (lastUnreadMessageCount != unreadMessages) { Toast.makeText( MainActivity.this, "You have " + unreadMessages + " unread messages.", Toast.LENGTH_SHORT) .show(); } lastUnreadMessageCount = unreadMessages; } }); } }); // Ad a listener to notify you when a survey is completed. Apptentive.setOnSurveyFinishedListener( new OnSurveyFinishedListener() { @Override public void onSurveyFinished(boolean completed) { Toast.makeText( MainActivity.this, completed ? "Survey was completed." : "Survey was skipped.", Toast.LENGTH_SHORT) .show(); } }); }
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); /* if (hasFocus) { boolean ret = Apptentive.engage(this, "init"); Log.e(LOG_TAG, "Rating flow " + (ret ? "was" : "was not") + " shown."); } */ }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.data); }