Facebook Analytics Push Campaigns - In-App notifications - missing NotificationsManager - android

I'm trying to implement FB Analytics Push Campaigns on Android.
Eveything went fine with the push notifications, so I've turned my attention to the in-app notifications.
The docs' example calls for the use of a class called NotificationsManager:
public class MyGcmListenerService extends GcmListenerService {
#Override
public void onMessageReceived(String from, Bundle data) {
if (NotificationsManager.canPresentCard(data)) {
NotificationsManager.presentNotification(
this,
data,
new Intent(getApplicationContext(), MainActivity.class)
);
}
}
}
But I can't for the life of me find that class in the FB SDK, nor in the FB-Audience SDK.
I'm using v4.17.0 of the SDK. The changelog states in-app notifications were added on 4.11.0.

Wow. FB has the worst docs ever.
Apparently there is a small open source project that handles in-app notifications, and it's separated from the main SDK.
To get NotificationsManager, you need to add the following line to your gradle.build file:
compile 'com.facebook.android:notifications:1+';
Also, here is the GitHub repository for the notifications project. It contains some samples to help you with the integration.
EDIT: I've alerted FB to the issue and the support rep opened a ticket for them to update the doc.

Related

Play Install Referrer Library not working in Play Store live app

For our app I recently included the Play Install Referrer Library for getting the referrer link after an app install, following all steps exactly as laid out in this page by Google. We then store it in our database to get an idea of how users find our app.
All works well for when I upload the app from Android Studio. However, when I upload the app to the Play Store, no referrer links are being saved to the database, although the app is being downloaded plenty of times.
Does anyone know what's going wrong here? Any help would be much appreciated.
EDIT: Since today, we're only getting the utm_source=(not%20set)&utm_medium=(not%20set) referrer links. I can see from this post why this is happening, but why are we only getting those links into our database? Since there are many more installs from other sources.
It turned out I was using the Campaign Measurement from Analytics at the same time that I wanted to use the Play Install Referrer. Removing the following call from the tutorial solved the issue for me:
// Tracker for Classic GA (call this if you are using Classic GA only)
private void trackInstallReferrer(final String referrerUrl) {
new Handler(getMainLooper()).post(new Runnable() {
#Override
public void run() {
CampaignTrackingReceiver receiver = new CampaignTrackingReceiver();
Intent intent = new Intent("com.android.vending.INSTALL_REFERRER");
intent.putExtra("referrer", referrerUrl);
receiver.onReceive(getApplicationContext(), intent); // I suspect this line was causing the troubles
}
});
}

initializing firebase cloud messaging without google-services plugin

due to some reasons i've decided to initialize firebase sdk without aplying the google-service plugin and addin the google-services.json file to project.
here is my code in the application class
FirebaseApp.initializeApp(context, new FirebaseOptions.Builder()
setApiKey("val").setProjectId("val").
setDatabaseUrl("val").setApplicationId("val").setGcmSenderId("val").setStorageBucket("val").build());
and in my build.gradle i've added this
implementation 'com.google.firebase:firebase-messaging:17.3.0'
the firebase console does'nt show me any installation after the app is installed, but when i send a cloud mesage using console, it show me the number of devices installed app!,(and also the notification does'nt recieve)
I had the same issue, and the answer to your problem is very easy: You have to call to:
FirebaseApp.initializeApp(...
in your own custom Application's onCreate() method, for example:
public class YourApplication extends Application {
#Override
public void onCreate() {
FirebaseApp.initializeApp(context, new FirebaseOptions.Builder().
setApiKey("val").
setProjectId("val").
setDatabaseUrl("val").
setApplicationId("val").
setGcmSenderId("val").
setStorageBucket("val").build());
}
}
Why? Regarding what this post and this post says about how to have multiple firebase projects and you are not using google-services.json and google-services plugin, your firebase instance is not being initialized and you should initialize it as any other framework in your own custom application class in order to have it at the moment to receive a push notification.
This is not good idea to send cloud messaging without google-services plugin. All your keys inside to Google services json and when you want to send notification to your app, firebase will use this keys. May, if you add in strings.xml your keys, will work but also this not good idea.
Please read this doc: https://firebase.google.com/docs/android/setup

"Initialize Push Notifications" Push Notifications for Wordpress

I've been studying projects made in Android Studio for a few months, these days I've been trying to implement the "Push Notifications for Wordpress" plugin on a website, with the addition of the library provided by delitestudio.com for the android application. I'm following these instructions: https://www.delitestudio.com/wordpress/push-notifications-for-wordpress/push-notifications-library-for-android/
But as I do not have much experience, I do not know where to add this instruction:
Initialize Push Notifications
Add the following calls using the PushNotifications.Builder to initialize the library with your site’s url:
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
new PushNotifications.Builder(this, "http://[YOUR WORDPRESS SERVER]")
.build();
}
}
And several others for the text onwards, i did some research but I have not been able to understand it, I know it's too much to ask someone to teach me step by step, but I ask that someone with more experience enlighten me by giving at least the path where I should insert the instructions (if it should be inserted in mainactivity, Build.gradle, etc, for example) given in the link that I posted, since in the site quoted do not explain in detail. If you can help me by giving this path, I will be grateful, giving the other paths after this one, it would be even better. But thank you in advance for the help, forgive my English.

ACRA, overridden send is custom ReportSender never called

I recently upgraded ACRA to version 4.5.0 and the send method in my custom ReportSender is no longer getting called.
By look at the logs, it looks like it is attempting to upload the crash report to Google Docs.
I have included some of our code below.
Custom ReportSender:
public class AcraPassportSender implements ReportSender {
...
public AcraPassportSender(int versionCode, boolean isStoreVersion){
...
}
#Override
public void send(CrashReportData report) throws ReportSenderException {
PLog.i(TAG, "Attempting to create and upload a bug report");
...
}
}
Application Class:
#ReportsCrashes(formKey="")
public class MyApp extends Application {
#Override
public void onCreate() {
ACRA.init(this);
AcraPassportSender acsender = new AcraPassportSender(version, isStoreVersion);
ACRA.getErrorReporter().setReportSender(acsender);
}
}
The logs show ACRA getting initialized. This worked before I upgraded ACRA. Any ideas of what could be happening here?
You can find the following sentence on the website of ACRA:
Since the recent update of Google Forms by Google, the usage of Google
Docs as a storage engine for ACRA reports is now deprecated.
As far as I know, Google Forms was default method of crash reporting in ACRA. You can look at ACRA project on GitHub and try to use different reporting method than Google Forms.
Moreover, I recommend you to use tools like Crashlytics, which are better than ACRA, allows you to collect crash reports and monitor your applications. Note that Crashlytics were acquired by Twitter and now they're available under fabric.io domain. You can also use paid tools like Bugsnag or create your own reporting solution.
The latest version of ACRA is 4.6.2. I would suggest upgrading to that.
GoogleFormSender was removed in 4.6.0. Other than that it is hard to know wwhat is goinf on as you have not posted the code for your Sender and you have not posted your logcat.
I suggest upgrading to 4.6.2 first and then reassessing.

How to use tracking id of google analytics in android app?

I am trying to integrate google analytics with my android app. I followed the steps in the following link:
https://developers.google.com/analytics/devguides/collection/android/v3/#manifest
Then i tried the look at the statistic of my app, but it seems like analytics is not working, i must have done something wrong. The problem is, in those steps we do not make use of the tracking id, and in google analytic's web site, it says that
Download the Google Analytics SDK for Android or iOS and implement the tracking code,
including this tracking ID.
What does it mean to "implement the tracking id"? What should i do about this can anyone help me?
Thanks
Use this:
Tracker tracker = GoogleAnalytics.getInstance(context).getTracker(ga_trakingId);
Then you can SET some variables, that will be send to GoogleAnalytics:
tracker.set(Fields.APP_NAME, "Best Android Application");
tracker.set(Fields.APP_VERSION, "1.0");
To SEND some info, events:
tracker.send(MapBuilder.createEvent("UX", "App Launch", null, null).build());
You must watch Behind the Code: The Google Analytics v3 Mobile SDKs, all info from there.
Update 1
Google Analytics API v4 you should create google-services.json file from here and then you can use:
public Tracker getTracker() {
return GoogleAnalytics.getInstance(this).newTracker(R.xml.global_tracker);
}
And then you canuse it like this way:
getTracker().setScreenName("SomeScreenOrActivityName");
getTracker().send(new HitBuilders.ScreenViewBuilder().build()); // send screen name
The new process generates a file by Google which is called GoogleService-Info.plist.
This file contains (key, string) and one of them is:
<key>TRACKING_ID</key>
<string>*YOUR TRACKING ID*</string> // Auto generated by GAI
Just open the file and confirm that this is your tracking ID.

Categories

Resources