皇马.apk(点击下载) / DefaultReportSenderFactory.java


package org.acra.sender;

import android.content.Context;
import org.acra.ACRA;
import org.acra.config.ACRAConfiguration;
import org.acra.log.ACRALog;
import org.acra.util.PackageManagerWrapper;

public final class DefaultReportSenderFactory implements ReportSenderFactory {
    @Override // org.acra.sender.ReportSenderFactory
    public ReportSender create(Context context, ACRAConfiguration aCRAConfiguration) {
        PackageManagerWrapper packageManagerWrapper = new PackageManagerWrapper(context);
        if (!"".equals(aCRAConfiguration.mailTo())) {
            ACRALog aCRALog = ACRA.log;
            String str = ACRA.LOG_TAG;
            aCRALog.w(str, context.getPackageName() + " reports will be sent by email (if accepted by user).");
            return new EmailIntentSenderFactory().create(context, aCRAConfiguration);
        } else if (!packageManagerWrapper.hasPermission("android.permission.INTERNET")) {
            ACRALog aCRALog2 = ACRA.log;
            String str2 = ACRA.LOG_TAG;
            aCRALog2.e(str2, context.getPackageName() + " should be granted permission " + "android.permission.INTERNET" + " if you want your crash reports to be sent. If you don't want to add this permission to your application you can also enable sending reports by email. If this is your will then provide your email address in @AcraConfig(mailTo=\"your.account@domain.com\"");
            return new NullSender();
        } else if (aCRAConfiguration.formUri() == null || "".equals(aCRAConfiguration.formUri())) {
            return new NullSender();
        } else {
            if (ACRA.DEV_LOGGING) {
                ACRALog aCRALog3 = ACRA.log;
                String str3 = ACRA.LOG_TAG;
                aCRALog3.d(str3, context.getPackageName() + " reports will be sent by Http.");
            }
            return new HttpSenderFactory().create(context, aCRAConfiguration);
        }
    }
}