Piwik tracking in an android application - android

I want to do data analytics for my android application using Piwik.
In Piwik's documentation, they suggest using GitHub.
I got the Piwik API and download the following file:
https://github.com/piwik/piwik-java-tracking
which I don't know how to use.
What are the steps needed to get the data analysis using the Piwik working?
What should I do next?

I also would like to implement piwik tracking in my android app.
This is what I understood so far:
Unlike for iOS/MacOS applications, there is currently no SDK to help us out.
Piwik developers have a ticket opened in their bugtracker about this, which shows they're aware of the issue and willing to improve the situation, but it will take some time before this android tracking SDK is released.
At the moment, the Piwik team encourages android and Java developers to use the piwik-java-tracking library you mentioned. This is basically just a java wrapper for the web tracking API reference, which helps you to generate Tracking Request URLs to send to your Piwik instance.
This piwik-java-tracking project lacks documentation (there is none that I know of in Github), but there is javadoc in the java files.
Basically what you need to do to track an action is to:
Create a new instance of SimplePiwikTracker
Feed it with whatever values and parameters you wish to track using the various setters available
When you're done, get the URL using one of the methods defined in the PiwikTracker interface, depending of the type of "event" you want to track
Send a request to that URL to actually track your action into you Piwik instance.
This has several drawbacks:
If you need bulk tracking, you'll have to figure out a way of doing so. The web tracking API reference states you can use use a HTTP POST request containing a JSON object to do it.
It doesn't provide any help to handle the case where user is offline. If you need to, you'll have to find a way to cache your tracking request (in an sqlite database for example) and bulk send them when the user is back online.
You'll need to handle possible exceptions raised by network error for the tracking request, to make tat tracking does not interfere with your app normal behavior.
Be sure to read this article too. It gives you an overview of what you need to do to get up & running.
This is what I understood so far. I may update this answer as I progress in implementing piwik tracking in my own app.
Good luck.
Edit: I just noticed that Piwik released "Piwik SDK Android". There are some instruction on how to get this working in the project's wiki.

Related

Where do I put code that links app to Twitch OAuth and channel chat

I'm currently using Android Studio 3.0.1 to build a very small android app that will be used to send specific chat commands to the users twitch channel chat. It's been quite a while since I've dabbled and as such I'm getting lost with where to put certain things
Essentially what I need the app to do is two fold. Firstly I need to present the user with the Twitch authentication page on first open so that they can authorise the app to use their twitch account/channel. Then I have a single screen with buttons on it. Each button calls a certain string, and what I need to do is pass that string into the users channel chat
I've got virtually all the code required to connect to the twitch API and generate the OAuth request, as well as code connecting to the channel and code to push commands from the buttons out to another endpoint. What I'm struggling with is the following:
Where do I put any of this code? Where am I putting the twitch OAuth request code etc? Do I create a separate Java class for it?
Once I've got the code in and working where is the data being stored and how do I then call it elsewhere? I guess this might get answered once I know where I'm actually putting the main code
Obviously the app will be used by multiple users so I assume I'll be creating variables for usernames, OAuth tokens etc and then will call them from other areas. I'm just unaware of how to get this done in the current Studio version and while I can find lots of references to what code to use, and plenty of examples of how to make code work I can't seem to find any info on where to actually put any code
I've abandoned android studio for now. no matter what I tried I can't get things working. switching over to another method of working using html/js/css and I've got so much further

Android - Logging errors to an email account

I've implemented an ErrorHandler class into my app which is working just great but as I'm not sure if what I'm doing can fit into "best practices" just would like to share it with you to have your opinion.
My question is silly and my class is very simple. All that I do is the next: in every catch block of my whole java code I do a call to ErrorHabdler.log(e) (which works as an AsyncTask) and as I'm working with AWS what log(e) does is capture all information about the error, like message, device name and model, etc (NO user information) and sends a formatted email with the error to a specific email address.
Another possibility would be to create a new table into my AWS DynamoDB set called Exceptions and instead of sending an email in background write the error log into that new table to have errors more "centralized".
I'd like to know if you consider what I'm actualli doing a good practice, or if you prefer my second choice, or maybe none of them and you would better use a third party error logger.
Best!
There are several Crashlytics tools on the internet.
The best choice is to go to these tools, which make it easier to control crashes reports.
The most common, and is what I use in most of my projects, is Frabric.IO Crashlytics ,: https://fabric.io/kits/android/crashlytics
You can follow these steps to install Crashlytics in your project: https://fabric.io/kits/android/crashlytics/install

Put some values on internet to access from android

In my app a user can (only) see the values uploaded by admin.
For example. A salesman is using the app will be able to see the latest rate provided by the manger to trade.
Now the question is "where to put these values?"
I have .net webservice experience with android but I guess it wont work in this scenario,will it?
Any suggestion that the returned result be in (preferably) XML format.
It sounds like you already know how to do this. You can download and parse xml within your app. If you alreayd know how to set up the websever, the rest is easy. Limiting who can see what is just a matter of associating specific transactions with an individuals account. Then just have the phone check for updates on that transaction when the app loads (using someting like AsyncTask) or if you want to get more complicated you could push notificatinos using the android cloud service, or even use a REST model. More details are needed for a more specific answer but you can do what you want.
You can do it on your own, and build a webserver with a MySQL/PHP JSON API or you can use parse.com for a smaller project.

How to create simple self LVL like library

I have been trying to understand LVL library but without luck. All i need is a simple method that will send and receive current status of License without Policies , just send / reply from ILicensingService service. I want to create custom LVL library but i must understand it first.
Well, have you taken a look at the actual Market Licensing source files provided by Android? Once you take a few minutes you should be able to understand how the policies work. They are actually simple.
The key class where all the action happens is the LicenseValidator class. There is where the licensing check request are taken and there is where the connection to the remote service for licensing checks happens.
In that class take a look how the Policy interface class is used.

Is there a way to track how many users open your app(hourly,daily,etc)?

So does anyone know if there is a program that will allow me to track how many times my app is opened daily?
I'm not looking to track the users behavior or anything, I just what stats on the average use of my app.
To know this you need to send information to a server somehow. On the device you would need some kind of library or code that posts this information. On the server you need some service that receives it.
There's a number of tools that let you do that. Analytics tools for example: http://code.google.com/mobile/analytics/docs/
If you don't want to use a pre-made tool you could simply use an HttpClient and you could make a simple Servlet on the server that dumps the use count into a database.
Tow more details:
1- Make sure you ask the user for permission the first time he runs your app. This could be problematic for him because of privacy and bandwith.
2- I would batch this and send it to the server once per day (midnight).
I hope this helps.
Emmanuel
If want something easy to implement, you can use http://www.localytics.com/ I've used it for a couple of apps and it works really well.

Categories

Resources