Google Tag Manager for Android - android

I implement Google Tag Manager on my project .When i work on emulator all events come faster in Google anlyatics account shown which page open,but problem is that when i use in real device its taking more time to show the events,its taking around 2-5 mins.
I am using like that can any tell me why its not working in real device.
& also can any one help me out how to implement E commerce tracking in android app.
DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();
dataLayer.push(DataLayer.mapOf("event", "openScreen",
"screenName", "Home Screen"));
GoogleAnalytics.getInstance(context).setLocalDispatchPeriod(5);

I'm not entirely sure, since I don't develop your Android, but for iOS using Google Tag Manager (and Google Analytics for that matter) the mobile platform is not pushing events in realtime, but they batch the data and send them every other minute or so. For me the emulator in iOS does the same, i.e. it sends data every other minute and the same on device. Maybe the emulator in Android is different in this regard, but I believe that mobiles do not send data in realtime at all, but batches a chunk of data and send it at the same time.
I don't think there is any way to go around this. Correct me if I'm wrong though, but that's what I read somewhere in the documentation. Can't seem to find the reference though.

Related

Detect application is being uninstalled in lollipop devices

I would like to know which users have uninstalled my application so that I can ask them for a feedback to improve the app. Hence, I would like to detect when the user has initiated the uninstallation process on my app.
One of the older solutions on StackOverflow had the following steps:
List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(MAX_PRIORITY);
String activityName = taskInfo.get(0).topActivity.getClassName();
if (activityName.equals("com.android.packageinstaller.UninstallerActivity")) {
// do whatever is needed
Since Lollipop, getRunningTasks has been deprecated. So how can com.android.packageinstaller.UninstallerActivity activity be detected without getRunningTask?
Alternatively is there any other method to detect uninstallation process has been started on my app? Using getAppTask probably?
Apparently you wont be able to do this, you will have to rely on something called silent notification.
What we did was we sent notification every 3 days or whatever frequency you want.
On the client side as soon as a notification is received we hit a network call which mark NotificationReceived for the client. Now since notification are not full proof we assumed a threshold of 2/3 missed notification as uninstall event. And for the client we have this counter above decided threshold we contacted them for feedback.
Also no one will be willing to fill your form at the time of uninstallation as user has already decided to uninstall your application.
Read these 2 questions and answers:
native solution
GCM solution
As I know you have to mix the two. Read the limitations of first solution. You have to confirm uninstallation event of the first solution with the second solution for a complete implementation.
Hopefully, this solution will work for you. It helps you understand the reasons for your app uninstalls, reduce the uninstall rate using a powerful predictive engine and also get app Re-installs through a unique actionable channel (Android version 4.0 and above).
Just set a variable named appLastPresent for every user in the server-side and update that variable every day by calling an API using WorkManager's PeriodicWorkRequest. Also set installedDate variable when the user installs the app.
Now set up a chron job on the server side to check if the difference between installedDate and appLastPresent is greater than 7 days. Then send the user an email or message enquiring for issues or feedback, if it is greater.
NB: User can be offline for 7 days. Therefore only send email enquiring like why you are not using the app, if uninstalled please let us know why

Android Wear: getDataItems returns 0 items

Here is a big problem that i simply don't know whats going on...
I have an app that stores Data in data API. The mobile app is aroudn the play store for some time and I decided to make a app for wearable.
My problem is: when the user install the wearable app for the first time (via Google Play), it need to load the data from the DataApi. But it simple returns 0 itens!
DataItemBuffer dataItems = Wearable.DataApi.getDataItems(mGoogleApiClient).await();
Observations:
GoogleApiClient IS CONNECTED
The Wearable receives the onDataChanged from WearableListenerService and this part is working fine.
I've already tested with .setResultCallback but results still the same.
I have two copmuter for developments, one is one my work and another is on my home.
In my tests, I DELETE the emulator and create a new one, to simulate a "new device beeing connected for the first time".
DataAPI says that the data is synchronzed to all devices but is seems not be working like that. How to solves this? Any workaround? SOMEONE HELP =(
It seems i found the solution for this problem. As I mentioned i have two computers for development, so, 2 development keys.
My mobile app was installed using the "A" computer's key and the wearable was using the "B" one. So, to solve this problem, when start developing always remember to re-run the mobile and wearable app from the same computer to your devices.

Google CloudPrint printing infinite copies (Android)

I have been using Google CloudPrint since December, and suddenly (sometimes, mostly when the networks is slow) when printing, it keeps printing.
I am using this configuration: Android Phone, my App creates a print job with ticket via Google CloudPrint, the android notification center displays the print job "Printing" (as in sending...), the Google CloudPrint receives the task, and prints it with the printer associated, then, normally, it removes the print job from the notification center. and thats all.
Now, it stays in the notification center... for ever, even if you cancel, it already sent a lot of print jobs (they are slow to appear on the GoogleCloud panel).
Is there a bug with Google CloudPrint or is a problem with my (probably outdated now) code?
I know is Beta, and that, but i neither find documentation, known bugs, or anything at all.
If you can guide me in solving this problem...
(This is the code i use to send the intent)
PrintHelper photoPrinter = new PrintHelper(Context);
photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
photoPrinter.printBitmap("print job", bitmap);
I had the same issue on a Samsung Galaxy Tab 4. I uninstalled Cloud Print and then reinstalled. Fixed the issue.

Samsung Chord as a Backgorund Process

I am going to enter the Samsung 2013 app contest, and one of the requirements is that you use their Chord API http://developer.samsung.com/chord.
I plan on allowing users to send messages to all phones that have my app installed. From what I gathered from the information in the previous link, this means that I will need to have a constantly running background process for users to receive the messages when they are not looking at the app at the time.
I want to know if this is true, and if so, is this viable? I am considering using the method detailed here: Android: keeping a background service alive (preventing process death) if I go ahead with this.
I'm trying to use Samsung Chord too. I thing you don't need to do this. Samsung's API Chord already provides this control.
According Chord's API:
"If a Chord node doesn’t receive a UDP signal within a specified amount of time, it considers the “missing”
node to no longer be part of the network."
And, the only thing you have to do is:
"A node cannot receive a UDP broadcast if it is in LCD-off status. Therefore, if developers want the node to discover other nodes while the application is running, the node’s status should be set to LCD-on. To do this, use Android’s PowerManager.WakeLock."
Best regards,
Adriano

How to track currier/package by using android GPS?

I am currently working on a GPS tracking App for track packages and parcels right from android smart-phone.
After user finishing put their tracking nO., I would like to be able to analyses this data and find their item information.It also can be track location on GPS to view current location in map-view.
-What would be a good way to smooth the track?
I know that I'll need to implement the tracking in a service, and probably show a notification to user for to easier to know thier item have arrived.
-I have read : Create an Android GPS tracking application
and
https://code.google.com/p/open-gpstracker/
-and also, what is the best way to do connect GPS tracking information with the user data that already have in the website?
like my refr.ex :https://play.google.com/store/apps/details?id=br.com.tribotech.trackpack&hl=en
Firstly, you need to know the API of the package carrier you intend to track packages for. Package carriers always provide an API for programmers to get information about parcels.
Examples
UPS: https://www.ups.com/upsdeveloperkit
NZ Post: http://www.nzpost.co.nz/products-services/iphone-apps-apis/tracking-api
etc..
Then write your app to use these API's. Some carriers may provide a GPS based tracking system, which is what you want for your tracking thing.

Categories

Resources