ÃÛ¶¹ÊÓƵ

Configuring an Android service and creating an Android mobile application in Campaign

Learn how to configure an Android service and create an Android mobile application in Campaign. This step is required so that you can define the target mobile application for the push notification.

Transcript
In this video, you will learn how to configure an Android service, and create an Android mobile application on Campaign.
I’ve installed a demo mobile app called NeoTrip on my Android phone. Is has the Campaign mobile STK installed, with the endpoints and some additional parameters that will be passed to Campaign when calling the Campaign mobile STK.
The mobile STK is a piece of code that allows the mobile application to communicate with Campaign. For example, to register to a subscription service, and to send back the tracking information to Campaign when the user clicks on a notification.
You can find instructions on how to integrate the mobile STK in the product guide.
Before I can start sending push notifications to the app, I will need to configure it in Campaign.
Let’s start by creating a new service.
In ÃÛ¶¹ÊÓƵ Campaign on the explorer tab, navigate to profiles and targets, and then to services and subscriptions.
For this demo I will create the service in a new sub-folder. I will call this folder: mobile applications demo.
Now I’ll click on create to create the service itself.
I will call it: mobile app one demo.
On the dropdown, I will select mobile application.
Once I save, the new service is available. The next step is to configure my mobile application for the service.
Click on add, and here you can select if you want to create iOS, Android, or both. So I’ll select the Android application. Click on next. I will call it: Android app.
The integration key is used by Campaign to identify the mobile application. It is defined in ÃÛ¶¹ÊÓƵ Campaign, as well as in the application code via the STK.
In general, you have two options. You can either use the key that is generated by Campaign automatically, and add it to the STK, or since the integration key is fully customizable with a string value, you can add the one the mobile app developer might have provided you with. Just make sure that the value you enter is exactly the same as the one specified in the STK. I will add the integration key, that I have received from my mobile developer.
I will also add the android icon from the Campaign library. That makes it easier to find the service later on.
Now we will need to configure the connection settings. These allow Campaign to connect to the Google server for authentication and sending the payload, et cetera.
Two versions are available: HTTP and HTTPv1. The HTTP is flagged as legacy by Google, and Google is advising customers to switch to HTTPv1 where possible. For more information on HTTPv1 and how to migrate, please visit the Google Firebase documentation.
As we are setting up a new service, I will use the HTTPv1. With the HTTP version, only the project key is required. HTTPv1 provides more security. So we will need to enter three pieces of information: the project ID, the private key, and the client email. So the question is: how can we get this information? The information is available from the Firebase portal. In the service accounts section, click on generate a new private key. You will be provided with a JSON file that contains all information you need to connect to Campaign.
So we have the project ID here, the private key is here, and the client email is here.
Now you have two options to add the data. You can, of course, copy and paste the values one by one into Campaign, or you can directly upload the JSON configuration file and Campaign will do the job for you. It will upload and parse the file, and automatically populate the fields. Please note that the private key is masked, and more importantly, it is encrypted in the database. It is highly secure, as the information is very sensitive. Now I can test the connection. The system is trying to connect to the mobile service, using the parameters that have been entered in the form. It worked for us, so we have the correct parameters, and we can reach the Google servers.
Let’s move on. In the application variables, you can specify any custom payload fields that you want to include in push notifications to the Android app.
These should include any payload fields that your Android app would use in handling and displaying notifications.
I will create three additional parameters. Title.
Image URL.
And icon URL.
Next, I need to specify additional parameters that will be included when registering mobile app users in Campaign. I would like to personalize the push notifications that I send to the mobile app users by addressing them by their first name. This is the value that needs to be available in Campaign, and that I need to receive when the mobile app user registers for the service.
I’ve extended the subscription table with two additional attributes earlier, so I will use one of these to store the information.
To add the parameters, click on the create icon.
The mobile application has been configured to pass an additional parameter when calling the Campaign STK. The parameter is called: first name. And I want to store the information in one of the new attribute columns I created. So I will select additional parameter one as the destination field.
Once the mobile application has been configured, the service has been set up in Campaign and the correct endpoints and parameters have been added to the mobile application, we can test the subscription from the mobile application to the service.
In the NeoTrip application, I will register with my email address.
Now let’s take a look what happened in Campaign.
I can see that a record has been added, with a registration token that has been sent from the mobile application to Campaign, as well as the user ID.
And let’s see if the additional parameter has been passed on. And we can see that the app has passed on my first name as well.
Now that the registration works, we can start configuring and sending the push notifications. -

Previous Step

Step 1: Extending the app subscription schema to personalize push notifications

Next Step

Step 3: Configuring and sending push notifications

recommendation-more-help
e811a650-48fd-4e5a-ab38-22c535840186