acra: don't send "android id" - android

My acra bug reports show up in BugSense with a field "Android ID".
I tested this, and it remains constant between application installations. we do not want to send any information that can be used to track the user. Is there a way to avoid sending such data?
I'm not customizing the report data at all, so it's all defaults. I do not grant the READ_PHONE_STATE permission, so I'd expect that would prevent "Android ID" from being sent to BugSense.
any ideas?

You could try customReportContent, per https://github.com/ACRA/acra/wiki/AdvancedUsage#wiki-Choosing_which_fields_to_be_included_in_reports. According to the docs, "Only fields which are set in customReportContent are actually processed".
From their sample code:
#ReportsCrashes(formKey = "xxxxxxxxxxxxxxxx",
customReportContent = { APP_VERSION, ANDROID_VERSION, PHONE_MODEL, CUSTOM_DATA, STACK_TRACE, LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)

Enable/disable including DeviceID #
If you added the READ_PHONE_STATE permission to your application but want to let your user be able to disable the inclusion of their Device ID in crash reports, you can include the following CheckBoxPreference:
<CheckBoxPreference android:key="acra.deviceid.enable"
android:title="#string/pref_acra_deviceid"
android:summaryOn="#string/pref_acra_deviceid_enabled"
android:summaryOff="#string/pref_acra_deviceid_disabled"
android:defaultValue="true"/>
Don't forget to add the required strings in your strings.xml files.
https://github.com/ACRA/acra/wiki/AdvancedUsage#wiki-Enable/disable_including_DeviceID

Related

Android Management API change Policy for device

I created 2 policies in my enterprise.
I would like to switch one device to the other policy without re-enroling it.
I tried to use android management enterprises devices.patch with following JSON
{ "policyName": "policy2" }
this link
When i execute this command i always get follwoing error Message:
{
"error": {
"code": 400,
"message": "Illegal state transition from ACTIVE to DEVICE_STATE_UNSPECIFIED",
"status": "INVALID_ARGUMENT"
}
}
Does anybody know how to change policy for a device without wiping it?
It is indeed possible to change the policy of a device without re-enrolling it, and you're not far from the solution.
You get this error because you implicitly attempt to change other fields of the Device resource (in particular the state field) by not setting them in the resource that you send in devices.patch.
You have two options:
Set the updateMask in devices.patch to "policyName", to tell the API that you only want to change the policyName field.
Call devices.get to get the current Device resource, and then send back the entire resource with only the policyName field changed in to devices.patch.
Using updateMask is preferable because it does an atomic read-modify-write.
As Fred mentioned, updateMask is the preferred way to go. Here's an example of how to use the updateMask approach in the Google colab
swap_result = androidmanagement.enterprises().devices().patch(
name='enterprises/ENTERPRISE_NAME/devices/DEVICE_ID', updateMask='policyName', body={ "policyName": "enterprises/ENTERPRISE_NAME/policies/NEW_POLICY_NAME"}).execute()
i foudn a solution for my problem:
{ "policyName": "policy2" , "state":"active"}
If you try this from management api test site then add updateMask as "policyName"

Using ACRA with tracepot as backend

I have just finished my first android app as part of a school project ..one of my friends encountered a problem while trying to explore one of the activities in the app ..so i searched for solutions to get the crashes reports whenever they happen to fix the bugs ..i came across ACRA ..and I followed one of SO threads to setup ACRA to my app ..
RESULT: when the crashs happens the gmail app get launch in the device and the user (if he want to) he'll send the crash report by email ..Consedering not all users will want to ..i found in a comment in one of the SO threads that some developers use tracepot.
so i have used their link for integration in formUri but exploring my account on tracepot i get nothing ..is there something i am doing wrong (or if there is a better solution than using tracepot a backend , please suggest/explain or link a good tutorial, thanks!)
MyApplication.Java ( AFTER EDITING
#ReportsCrashes(
formUri = "https://collector.tracepot.com/79b1***",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
CaocConfig.Builder.create()
//.errorActivity(CustomErrorActivity.class) //default: null (default error activity)
.apply();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
EDIT :
msg in logcat if i use the http and email:
09-17 18:37:33.700 14329-14812/ma.ac.iav.menunaviagtion:acra W/ACRA: ma.ac.iav.menunaviagtion reports will be sent by email (if accepted by user).
09-17 18:37:33.703 14329-14812/ma.ac.iav.menunaviagtion:acra I/ACRA: Sending report /data/user/0/ma.ac.iav.menunaviagtion/app_ACRA-approved/2018-09-17T18:37:33.441+01:00-IS_SILENT.stacktrace
if i use only the http :
09-17 22:47:00.648 20116-20137/ma.ac.iav.myapplication:acra E/ACRA: Failed to send crash report for /data/user/0/ma.ac.iav.myapplication/app_ACRA-approved/2018-09-17T22:44:52.199+00:00-IS_SILENT.stacktrace
IMPLEMENTATION:
compile 'ch.acra:acra:4.9.2'
LOGCAT FOR F43nd1r
09-18 01:39:49.631 18508-18803/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: ma.ac.iav.myapplication, PID: 18508
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:733)
at android.app.SharedPreferencesImpl.startLoadFromDisk(SharedPreferencesImpl.java:119)
at android.app.SharedPreferencesImpl.<init>(SharedPreferencesImpl.java:112)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:392)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:373)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.getLastCrashTimestamp(CustomActivityOnCrash.java:673)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.hasCrashedInTheLastSeconds(CustomActivityOnCrash.java:683)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.access$200(CustomActivityOnCrash.java:52)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash$1.uncaughtException(CustomActivityOnCrash.java:112)
at org.acra.builder.ReportExecutor.endApplication(ReportExecutor.java:269)
at org.acra.builder.ReportExecutor.dialogAndEnd(ReportExecutor.java:254)
at org.acra.builder.ReportExecutor.access$400(ReportExecutor.java:42)
at org.acra.builder.ReportExecutor$2.run(ReportExecutor.java:217)
By default, if the mail config is present, Acra 4 will send via mail and nothing else.
To use both you'd have to configure the reportSenderFactories.
400: Client error
Indicates that tracepot rejected your report. This could have multiple reasons. To find out what the problem is, call ACRA.DEV_LOGGING = true; right before ACRA.init and post all logcat with the ACRA tag.
Also note that ACRA 4.9.2 does not support android Oreo and above, it is recommended to upgrade to at least ACRA 4.11, or just the newest version 5.2.0.
You are not sending all required fields to Tracepot.
https://tracepot.uservoice.com/knowledgebase/articles/355272-what-are-the-required-fields-acra-needs-to-send
ANDROID_VERSION
APP_VERSION_CODE
APP_VERSION_NAME
PACKAGE_NAME
REPORT_ID
STACK_TRACE
USER_APP_START_DATE
USER_CRASH_DATE

Codename one GoogleConnect setScope is not effective

I am using the new GoogleConnect thing and set the scope like
Login gc = GoogleConnect.getInstance();
gc.setScope("https://www.googleapis.com/auth/plus.profile.emails.read https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.file");
...
gc.doLogin();
However, when the access token is generated and checked in
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=(accesstoken)
, it shows
"scope": "https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.profile"
Is it related to any recent updates or new build hint?
I am totally lost here. It is an Android build.
Thanks.
Edited to add gc.doLogin() code, to clarify that I am NOT trying to set the scope after the access token is generated.
Same problem here, setScope only works on the simulator
"scope": "https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.profile",
My scopes (for reference):
google.auth.scopes=https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.me email profile

ACRA : Configured to send report on mail but not getting any mail

I am trying to configure ACRA for the first time. I have followed the Basic Setup guide :
1.Integrated the acra jar file to my app
2.Created a new class extending application class and have added the below code to it :
#ReportsCrashes(formKey = "", // will not be used
mailTo = "mymailId#gmail.com")
public class MyApplication extends Application
{
#Override
public void onCreate()
{
super.onCreate();
ACRA.init(this);
}
}
3.Made all necessary changes to manifest file
It seems that all is done correctly,I am able to get the below in logcat :
12-21 14:59:10.994: D/ACRA(28728): ACRA is enabled for com.android.demo.notepad1, intializing...
12-21 14:59:11.064: D/ACRA(28728): Using default Mail Report Fields
12-21 14:59:11.064: D/ACRA(28728): Looking for error files in /data/data/com.android.demo.notepad1/files
12-21 14:59:11.074: W/ACRA(28728): **com.android.demo.notepad1 reports will be sent by email (if accepted by user).**
But I am not able to get any mail :( !
As far i know, the mailTo option needs the user in order to send the email.
When an error occurs another mail client (such as Gmail.apk) has to be open to process the crash report and send e-mail. So the error will open a mail client and we need the user to click on send button.
Although a bit late, someone might find it useful anyways...
I did have at least a similar problem with ACRA 4.5.0 which I was able to resolve once all the other configuration options were actually set. This means – although partially labeled as optional – I had to give a value to the following options (in the #ReportsCrashes annotation)
resDialogText = R.string.crash_dialog_text, // Text to display upon crash
resDialogIcon = android.R.drawable.ic_dialog_info, //optional (apparently not). default is a warning sign
resDialogTitle = R.string.crash_dialog_title, // optional (apparently not). default is your application name
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional (apparently not). when defined, adds a user text field input with this text resource as a label
resDialogOkToast = R.string.crash_dialog_ok_toast // optional (apparently not). displays a Toast message when the user accepts to send a report.
Though I had mode = ReportingInteractionMode.DIALOG, set which might be the source of my problems at least.
have not used "mailTo" field ,had only used #ReportsCrashes(formKey = "formkey")
Make sure you get the form key from google drive correctly
And on crash you will be getting the report on Google drive excel file
And also make sure you have added Internet permission and Added "MyApplication" in mainfeast
<manifest ...>
<application ... android:name="MyApplication">
...
</application>
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
</manifest>
Detail explanation is provided here http://acra.ch/

How to successfully add account to android E-mail Database?

I am trying to add an account to E-mail database ,Below is the way i'm trying ...
Account account = new Account(mContext);
account.setDescription("acc added thr prog");
account.setAutomaticCheckIntervalMinutes(10);
account.setEmail("UserName#gmail.com");
account.setDraftsFolderName("Drafts");
account.setOutboxFolderName("OutBox");
account.setSentFolderName("Sent");
account.setTrashFolderName("Trash");
account.setName("Tester");
account.setNotifyNewMail(true);
account.setSenderUri("smtp+ssl+://userName#gmail.com:PassWord#imap.gmail.com");
account.setStoreUri("imap+ssl+://userName#gmail.com:PassWord#imap.gmail.com");
account.setDeletePolicy(10);
account.setVibrate(true);
mPrefer = Preferences.getPreferences(getInstrumentation().getContext());
account.save(mPrefer);
Email.setServicesEnabled(mInstrumenatation.getTargetContext());
This code compiles successfully but account will not be created.
account.setSenderUri(mContext, "smtp+ssl+://UserName%40gmail.com:Password#smtp.gmail.com");
mAccount.setStoreUri(mContext, "imap+ssl+://UserName%40gmail.com:Password#imap.gmail.com");
These are two important fields that you need add along with the above fields. These Uri's provides a way for your account to connect to internet.
This configuration is for POP3 type of account . If you know similar config for "Exchange account" please inform me , i am waiting for your reply .
Kinds & Regards
Santhosh Kumar H.E

Categories

Resources