Crashlytics custom key not appearing in crash - android

I am trying to figure out how to link each and every crash with application user id. I got to know we can achieve this functionality with firebase customized key logs.
For POC purpose, I have added custom key after logged in completion and then I am crashing app on next screen. But Custom keys are not getting logged on console.
Here, how I am adding custom key :
FirebaseCrashlytics.getInstance().setCustomKey("userId", serverLoginResponse.getBody().getUserId());
And I am crashing application on next screen using divide by 0.
int i = 2;
int j = i / 0;
But keys are not gettging tagged to crash. Please see screenshots.
On Dashboard.
on Crash Details Screen :
Please let me know if I am doing anything wrong here.

You should enable the collection in your activity but preferable in the Main Application Class
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
Follow this guide:
FirebaseCrashlytics

I noticed that key/values set using setCustomValue(_,_) didn't persist between app relaunches. I had to call the setCustomValue code everytime on app relaunch aka appDidFinishingWithOptions(_). See related solution and answer here: https://stackoverflow.com/a/68097562/4970749
Note that setCustomValue here affects Crashlytics dashboard which is the second screenshot you showed here, under "Crash Details Screen." It doesn't update Firebase Analytics keys/properties (first screenshot), thats a separate method (try: Analytics.setUserProperty(value, forName: name) for that first screenshot).

Related

User properties from Firebase Analytics in DebugView

I put some user properties in my android code such as:
(https://firebase.google.com/docs/analytics/android/properties)
mFirebaseAnalytics.setUserProperty("easy_account_connected", "true");
Then, I checked debug view and nothing appears whereas if there is a break point, my code stopped on this instruction. I can't understand, in my code there are other places where we can find these properties and sometimes it works (I see it in debug view) and sometimes, nothing.
Is it normal ?
I have found nothing on firebase website which could tell me debug view is not perfect but data are correctly saved ...
https://firebase.google.com/docs/analytics/debugview#seconds_stream
EDIT :
With the help of adbitx, I discovered user properties are sent with event so I made a new use case.
2 events (login / logout) and one user properties (easy_account_connected). In login case, I send :
mFirebaseAnalytics.setUserProperty("easy_account_connected", "true");
mFirebaseAnalytics.logEvent("login", null);
and in logout case, I send :
mFirebaseAnalytics.setUserProperty("easy_account_connected", "false");
mFirebaseAnalytics.logEvent("logout", null);
Here is the result in debug view
Login works whereas logout does not...
From what you describe, it looks like you only have that line and no other events. It would be nice to know whether you send any events after setting the user property. The user property comes with each event after it is set. Therefore, you need to send some events and click on one of the events in the debug view to see the user property under User Properties tab.
I was running into a similar issue.
I found that sending the app to the background was a way to "flush" the cache of user properties on the device and send them through to Firebase. I could then see them appear in DebugView.
Without sending the app to the background I would see event after event appear in DebugView, but no user property updates.

Tutorial first time you enter into an app?

I'm programming an app using android studio. I want to know in which way I can do a tutorial that users will see only the first time that use the app. Tutorial like image or screenshoots
Can someone help me? Thanks
I encountered this thread while looking for a solution for running a tutorial only at the first time (as rbaleksandar suggested), so in case it will be helpful for someone someday, here's a template of a solution that works for me (using the SharedPreferences API):
#Override
protected void onResume() {
super.onResume();
String tutorialKey = "SOME_KEY";
Boolean firstTime = getPreferences(MODE_PRIVATE).getBoolean(tutorialKey, true);
if (firstTime) {
runTutorial(); // here you do what you want to do - an activity tutorial in my case
getPreferences(MODE_PRIVATE).edit().putBoolean(tutorialKey, false).apply();
}
}
EDIT - BONUS - If you're into app tutorial - I'm messing now with the ShowcaseView library (which is amazing - try it out). Apparently they have some shortcut for that issue using a method called singleShot(long) - its input is a key for the SharedPreferences, and it does the exact same thing - runs only in the first activation. Example of usage (taken from here):
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_shot);
Target viewTarget = new ViewTarget(R.id.button, this);
new ShowcaseView.Builder(this)
.setTarget(viewTarget)
.setContentTitle(R.string.title_single_shot)
.setContentText(R.string.R_string_desc_single_shot)
.singleShot(42)
.build();
}
You could always code your own solution, but, let us not reinvent the wheel.
Check this Android Library:
Tour Guide Repository
It allows you to add pointers in your screen, so the user knows where is he supposed to touch next.
It's pretty easy to use, you only need to point to the element you want the user to touch.
From the doc:
Let's say you have a button like this where you want user to click on:
Button button = (Button)findViewById(R.id.button);
You can add the tutorial pointer on top of it by:
TourGuide mTourGuideHandler = TourGuide.init(this).with(TourGuide.Technique.Click)
.setPointer(new Pointer())
.setToolTip(new ToolTip().setTitle("Welcome!").setDescription("Click on Get Started to begin..."))
.setOverlay(new Overlay())
.playOn(button);
Hope this helps!
Some links to libraries for creating introduction and/or tutorial screens.
Horizontal cards like Google Now:
https://github.com/PaoloRotolo/AppIntro
Tutorial screen:
https://github.com/amlcurran/ShowcaseView
As far as I understand the question is not How do I create a tutorial? (as the people who have already posted an answer have concluded) but instead How to show a tutorial upon first launch only?. So here are my two cents on this topic:
I'm not familiar with how your Android app stores its configuration data but I will assume that it's either in a database (SQLite) or a text file (plaintext, YAML, XML - whatever). Add a configuration entry to wherever the app's settings are being stored - something like tutorial_on : false, tutorial_on : 1 etc. depending on the format the configuration is represented in.
The way configurations work is that whenever an app (or software in general) is launched it has to be loaded in the app itself. So add the following to your app (where and how is up to you and your app design):
Check tutorial_on entry
If tutorial_on is set to true/1 whatever
2.1 Display tutorial
2.2 Change tutorial_on to false/0 whatever
2.3 Store the result in your configuration
Continue using the app
By doing so the first time your app launches the flag responsible for displaying the tutorial will be toggled and afterwards every time you start the app the toggle flag will be read leading to omitting the tutorial.
Personally I would suggest that you an option similar to Don't show tutorial anymore along with a description how to re-enable it (by triggering some action in that app's menu etc.). This has two major benefits:
Improved user experience - users like to have control (especially over trivial matters such as showing or hiding a tutorial). Whenever you take the control away from them, they get pissed off.
Enable your user to re-learn forgotten things - a general rule of thumb is to create apps that should not burden the user with a lot of stuff to remember. That is why things should be self-explanatory. However sometimes you may want to do that nonetheless. By adding the possibility that the user re-launches (by simply resetting the tutorial_on flag and repeating the steps from above) the tutorial allows just that - refreshing a user's memory.

Where do I view event parameters with Facebook Analytics App Events?

I'm using Facebook analytics in my Android app to log app events - I'm seeing the correct tracking of app events and am able to view them in my Facebook App Analytics dashboard.
However, I have no idea where parameters that I attach to each event are displayed. Some of them are automatically summed and shown - for instance, purchases or other values. For other, string-based parameters, however, I'm unable to figure out where I can view them.
As an example:
Say every time something goes wrong in my app, I log an event named "Error". I then pass the parameter named AppEventsConstants.EVENT_PARAM_DESCRIPTION a string description - so this might be "App Crashed" or "No Internet Connection" or something. Let's say one of each happens.
When I go to view my analytics, I will correctly see that there have been two "Error" events. But now I want to know whether these were instances of "App Crashed" or "No Internet Connection" - presumably that's what the point of the parameters is. How do I do this? I've googled and clicked everything I can think of, but haven't found a way to see the parameter breakdown of an event.
I can confirm that it is troublesome to find and the name has been changed to "Breakdowns"...
Activity -> Breakdowns
click "Create New" in upper right
give the report a NAME
select the top level event from the EVENT pop-up
select one or more parameters to report on from the 3 BREAKDOWN
pop-ups (note that your custom parameters appear at the bottom of
these menus)
Yep, its not simple to find that information. You will need to use Segments in Facebook Analytics for that. Go to Segments and try creating a new segment. Define Condition Type as "Events". Then select the Event then you want to include. After that, select the option of "Refine". This will show you "Select a Parameter". Here you can select the parameter that you want to see and its value. Save this segment, and use it in any chart you want.
Unfortunately, that is the best way I have found, though it is not as straightforward as it should be.
I tried using the ways based on the answers provided here. But the fact is, it is tedious or going round the bush.
The answer is simple, just send the values and parameters wrapped inside "contents".
It will be visible on your analytics dashboard the same as standard events do.
var name = "Dhinesh";
var platformName = "flutter";
//custom event - fb analytics
fbq('trackCustom', 'FreeTrialPlatform',
// begin parameter object data
{
contents: [{
name: name,
platform: platformName
}],
content_type: 'product'
}
// end parameter object data
);
View in fb analytics
For your case like this,
var errorName = "App crashed";
fbq('trackCustom', 'TrackError', {
contents: [{
Error: errorName
}],
});

Google Plus One button shows wrong count in Android App(wrong count issue)

I used official tutorial to add google plus one button to one of my android apps. But plus one button shows wrong count. Everything i did in the code is the same as with the tutorial. I used it before never got this stupid error.
Right now my app has been recommended 26 times so plus one button shoud show count as "26" but it shows "13".
To include plus button in my layout i used :
<com.google.android.gms.plus.PlusOneButton
android:id="#+id/plus_one_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/drawer_list_item_padding_left"
plus:annotation="inline"
plus:size="standard"
android:layout_marginBottom="#dimen/drawer_textview_paddingtopbottom"
android:layout_marginTop="#dimen/drawer_textview_paddingtopbottom" />
To assign button to a member variable i used :
mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
As suggested i initialized it in onResume method of my activity using below code :
mPlusOneButton.initialize(APP_URL, PLUS_ONE_REQUEST_CODE);
here APP_URL is my app's google play page url, PLUS_ONE_REQUEST_CODE is the activity request code i used it as 0.
Any suggestions? Thanks in advance.
in my case, after some days it showed correct g+ count itself. I didn't make any changes in my code because i was sure my code is right according to documentation. Why i got that annoying delay? I don't know, maybe it was related with google servers and updates.
My best guesses are:
There is a mistype on the APP_URL. Happens to everyone at some point
I don't know if this is a factor or not. The app version number is different with the one on Google Play Store. So it returns the wrong +1 count
Cheers

How can I keep Flurry from crashing when I don't yet have keys

sometimes my app cannot compose the key in time for flurry. When it can't this is an exception that takes down the whole app. Is there any way to set Flurry so that it does not crash under these circumstances?
Normally I define the key like this:
public final static String FLURRY_KEY = "your key...";
This won't give any problems, please show how you are trying to implement it if this isn't a possible solution.

Categories

Resources