本文整理匯總了Java中com.crashlytics.android.Crashlytics類的典型用法代碼示例。如果您正苦於以下問題:Java Crashlytics類的具體用法?Java Crashlytics怎麽用?Java Crashlytics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Crashlytics類屬於com.crashlytics.android包,在下文中一共展示了Crashlytics類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rapporterOgvisFejl
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
public static void rapporterOgvisFejl(final Activity akt, final Exception e) {
if (!App.EMULATOR) {
Crashlytics.logException(e);
//Mint.logException(e);
}
Log.e(e);
Builder ab = new Builder(akt);
ab.setTitle("Beklager, der skete en fejl");
ab.setMessage(e.toString());
ab.setNegativeButton("Fortsæt", null);
ab.setPositiveButton("Indsend fejl", new Dialog.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
String brødtekst = "Skriv, hvad der skete:\n\n\n---\n";
brødtekst += "\nFejlspor;\n" + android.util.Log.getStackTraceString(e);
brødtekst += "\n\n" + lavKontaktinfo();
App.kontakt(akt, "Fejl DR Radio", brødtekst, Log.log.toString());
}
});
ab.create().show();
}
示例2: onCreate
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_login_registration);
login = (Button) findViewById(R.id.btn_login);
register = (Button) findViewById(R.id.btn_register);
cardView=(CardView)findViewById(R.id.layout2);
splashActivity=new SplashActivity();
login.setOnClickListener(this);
register.setOnClickListener(this);
b=splashActivity.containsPass("password");
if(b==true)
{
register.setVisibility(View.INVISIBLE);
cardView.setVisibility(View.INVISIBLE);
}
}
示例3: checkUserBlockText
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private void checkUserBlockText(){
application.getWebService()
.block_user_check(messageActivityuserId, MySharedPreferences.getUserId(preferences), MySharedPreferences.getUserToken(preferences))
.retryWhen(new RetryWithDelay(3,2000))
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new BaseSubscriber<SuccessResponse>() {
@Override
public void onNext(SuccessResponse response) {
if (response.getSuccess()){
Toast.makeText(MessageActivity.this, "This user has blocked You", Toast.LENGTH_LONG).show();
} else {
sendTextOnline();
}
}
@Override
public void onError(Throwable e){
e.printStackTrace();
Crashlytics.logException(e);
progressFrame.setVisibility(View.GONE);
}
});
}
示例4: eventLogin
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
public static void eventLogin(Context context,boolean success){
//Fabric
Answers.getInstance().logSignUp(new SignUpEvent()
.putMethod("Normal")
.putSuccess(success));
//Firebase
Bundle params = new Bundle();
params.putBoolean("Success",success);
FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_LOGIN,params);
//Amplitude
try {
Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_LOGIN,new JSONObject().put("Success",success));
} catch (JSONException e) {
Crashlytics.logException(e);
}
}
示例5: eventCalculate
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
public static void eventCalculate(Context context,Course course, double grade){
//Fabric
Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_CALCULATION)
.putCustomAttribute("Course name", course.getName())
.putCustomAttribute("Course code", course.getCode())
.putCustomAttribute("Result", grade));
//Firebase
Bundle params = new Bundle();
params.putString("course_name",course.getName());
params.putString("course_code",course.getCode());
params.putDouble("result",grade);
FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_CALCULATION,params);
//Amplitude
try {
Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_CALCULATION, new JSONObject()
.put("Course name",course.getName())
.put("Course code",course.getCode())
.put("Result",grade));
} catch (JSONException e) {
Crashlytics.logException(e);
}
}
示例6: postCommentLike
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
@Subscribe
public void postCommentLike(Account.sendCommentLike sendReply) throws Exception {
application.getWebService()
.sendCommentLike(sendReply.id_post_comment, MySharedPreferences.getUserId(preferences), "1",MySharedPreferences.getUserId(preferences), MySharedPreferences.getUserToken(preferences), sendReply.id_post_comment)
.observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryWithDelay(3,2000))
.subscribe(new BaseSubscriber<SuccessResponse>() {
@Override
public void onNext(SuccessResponse userResponse) {
// Send notification to user with id_user_name ID
// Toast.makeText(PostsDetailsActivity.this, "success comment like", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Throwable e) {
Crashlytics.logException(e);
}
});
}
示例7: onCreate
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
injector =
DaggerMobSoftApplicationComponent.builder().
uIModule(
new UIModule(this)
).build();
injector.inject(this);
repository.open(getApplicationContext());
}
示例8: requestPermission
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private void requestPermission() {
try {
StorageManager sm = getSystemService(StorageManager.class);
StorageVolume volume = sm.getPrimaryStorageVolume();
Intent intent = volume.createAccessIntent(Environment.DIRECTORY_DOWNLOADS);
startActivityForResult(intent, REQUEST_CODE);
} catch (Exception e) {
//Toast.makeText(this, R.string.cannot_request_permission, Toast.LENGTH_LONG).show();
Toast.makeText(this, "Can't use Scoped Directory Access.\nFallback to runtime permission.", Toast.LENGTH_LONG).show();
Log.wtf("FFM", "can't use Scoped Directory Access", e);
Crashlytics.logException(e);
// fallback to runtime permission
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
}
}
}
示例9: init
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
public static void init(Context context) {
if (sInitialized) {
return;
}
sInitialized = true;
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(context, crashlyticsKit);
FontProviderSettings.init(context);
FontManager.init(context);
}
示例10: onCreate
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
Log.i(TAG, "Creating main activity");
setContentView(R.layout.activity_main);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
TabsAdapter tabsAdapter = new TabsAdapter(getSupportFragmentManager(), MainActivity.this);
viewPager.setAdapter(tabsAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
示例11: startMainService
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private void startMainService() {
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService start chain");
if (checkPlayServicesPrereq() && hasAcceptedTerms() && requestLocationPermission() && checkGPSPrereq() && checkNetworkPrereq()) {
styleStartStopButton(true);
reset.setVisibility(View.INVISIBLE);
startService(new Intent(this, MainService.class));
bindService(new Intent(this, MainService.class), mainServiceConn, BIND_AUTO_CREATE);
driveTimeHandler.postDelayed(driveTimeRunnable, DRIVE_TIME_REFRESH_FREQ);
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService started");
Answers.getInstance().logCustom(new CustomEvent(useHereMaps ? "Using HERE" : "Using Overpass"));
Answers.getInstance().logCustom(new CustomEvent(Prefs.isUseKph(this) ? "Using kph" : "Using mph"));
} else {
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService not started");
}
}
示例12: showHereMapsTerms
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private void showHereMapsTerms() {
Crashlytics.log(Log.INFO, SettingsActivity.class.getSimpleName(), "showHereMapsTerms()");
WebView webView = new WebView(this);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(getString(R.string.here_maps_terms_url));
new AlertDialog.Builder(this)
.setView(webView)
.setCancelable(true)
.setPositiveButton(R.string.accept_terms_button_text, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
Prefs.setHereMapsTermsAccepted(SettingsActivity.this, true);
limitProviderSelectorHandler(true); //Set limit provider now that terms have been accepted
Answers.getInstance().logCustom(new CustomEvent("Enabled HERE"));
}})
.setNegativeButton(R.string.reject_terms_button_text, null)
.show();
}
示例13: sendLikeNotification
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
protected void sendLikeNotification(String likeUrl) {
application.getWebService()
.sendLikeNotification(likeUrl)
.retryWhen(new RetryWithDelay(3,2000))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseSubscriber<String>() {
@Override
public void onNext(String response) {
Timber.d("Got user details");
// followers.setText(String.valueOf(response.size()));
// Toast.makeText(ChangeProfileActivity.this, "Message Sent", Toast.LENGTH_SHORT).show();
// Timber.d("Message from server" + response);
}
@Override
public void onError(Throwable e) {
Crashlytics.logException(e);
try {
Toast.makeText(PostsDetailsActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}catch (Exception ex){
ex.printStackTrace();
}
}
});
}
示例14: checkPlayServicesPrereq
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private boolean checkPlayServicesPrereq() {
GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
int result = googleAPI.isGooglePlayServicesAvailable(this);
if (result != ConnectionResult.SUCCESS) {
if (googleAPI.isUserResolvableError(result)) {
googleAPI.getErrorDialog(this, result, 0).show();
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices update required");
Answers.getInstance().logCustom(new CustomEvent("PlayServices update required"));
} else {
playServicesErrorToast.show();
Crashlytics.log(Log.ERROR, MainActivity.class.getSimpleName(), "PlayServices incompatible");
Answers.getInstance().logCustom(new CustomEvent("PlayServices incompatible"));
}
return false;
}
Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices compatible");
return true;
}
示例15: getActiveTranslation
import com.crashlytics.android.Crashlytics; //導入依賴的package包/類
private String getActiveTranslation() {
String db = quranSettings.getActiveTranslation();
if (!TextUtils.isEmpty(db)) {
if (QuranFileUtils.hasTranslation(getContext(), db)) {
return db;
}
// our active database no longer exists, remove the pref
quranSettings.removeActiveTranslation();
}
try {
Crashlytics.log("couldn't find database, searching for another..");
List<LocalTranslation> items = translationsDBAdapter.getTranslations();
if (items != null && items.size() > 0) {
return TranslationUtils.getDefaultTranslation(getContext(), items);
}
} catch (Exception e) {
Crashlytics.logException(e);
}
return null;
}