Omniata allows you to send Push Notifications to iOS and Android devices. This is also supported for Unity3D integrations. Configuring support for sending notifications from Omniata involves the same procedure for iOS and Android. On this guide we present the steps for each platform.
This guide enables Omniata to schedule and send notifications for users that have this feature enabled in their Apps. To enable or disable a user from receiving notifications refer to the the Standard Event Types section, and Application Settings to enable notification tracking. By default Omniata will not enable these features.
The overall setup is described in the diagram below.
For more information about setting up live campaigns, please see section Campaigns & A/B Test.
You will require an iPad or iPhone and a iOS Developer Program membership. You cannot push to iOS simulator.
First, Log in to the iPhone Developer Connection Portal and click App IDs. Next, ensure you have created an App ID without a wildcard. Wildcard IDs cannot use the push notification service. For example, our iPhone application ID looks something like
Make sure that push notification is activated for this application :
You don’t need to configure it yourself. Insead we are going to use the fastlane pem tool, which will take care of configuring your certificates.
The the fastlane pem tool will also generate a pem key, the output will look like this :
You will then need to create a provisioning profile for your app. Once created it should specifically list Push Notifications in the enabled services :
Note : make sure that your ios app has the updated provisioning profile.
Finally, you need to enable the Push Notification capability in the app settings:
To register Push Credentials in Omniata navigate to your project, and further Integrate -> Push And Email -> New.
If you need to test push notification for iOS development build, check the Is Development checkbox. Once you have uploaded the certificate, you can check the upload was successful by checking the hash of the certificate file. You can get the hash of your certificate on your computer with execute the following command in your terminal.
md5 <certificate.pem> # Mac OS X md5sum <certificate.pem> # Linux
Note: You cannot download the certificates from Omniata. This is to prevent someone with access to your project from taking the certificate and use it outside of Omniata.
To enable Push Notifications via Omniata SDK, calling this method will tell Omniata that the user is eligible to receive push notifications.
[iOmniataAPI initializeWithApiKey:@"<API_KEY>" UserId:@"<USER_ID>" AndDebug:YES]; ... [iOmniataAPI enablePushNotifications:deviceToken];
To disable via Omniata SDK, calling this method will tell Omniata that the user is no longer eligible to receive push notifications.
To enable using the REST API:
GET https://example.analyzer.omniata.com/event ?api_key=ae4398de &uid=e439da31f399c23a &om_event_type=om_apns_enable &om_device_token=<valid_device_token>
To disable using the REST API you can notify Omniata that the user is no longer interested in receiving push notifications. Please note that you can always re-enable at any time.
GET https://example.analyzer.omniata.com/event ?api_key=ae4398de &uid=e439da31f399c23a &om_event_type=om_apns_disable &om_device_token=<valid_device_token>
To create a Google API project:
Copy down your project number. You will use it later on as the GCM sender ID. The next step is to enable the GCM service:
Finally, to obtain an API key:
In the refreshed page, copy the API key. You will need the API key later on to configure Push Notifications in Omniata.
Note: If you need to rotate the key, click Regenerate key. A new key will be created. If you think the key has been compromised and you want to delete it immediately, click Delete.
To register Push Credentials in Omniata navigate to your project, and further Integrate -> Push And Email -> New. Once you have uploaded the API key, you can check the upload was successful by checking the hash of the key. You can get the hash of your certificate on your computer with execute the following command in your terminal.
md5 -s <GCM key> # Mac OS X echo -n <GCM key> | md5sum # Linux
Note: You cannot display the GCM keys from Omniata. This is to prevent someone with access to your project from taking the GCM keys and use it outside of Omniata.
Follow the GCM client guide to know how to retrieve the Registration ID in your Android Application.
To enable notifications calling this method will tell Omniata that the device is eligible to receive push notifications.
Activity activity = this; Omniata.initialize(activity, "<API_KEY>", "<USER_ID>"); ... Omniata.enablePushNotifications("<REGISTRATION_ID>");
To disable notifications calling this method will tell Omniata to stop sending push notifications to the user:
You can also send the user’s push token directly to our REST API.
GET https://example.analyzer.omniata.com/event ?api_key=ae4398de &uid=e439da31f399c23a &om_event_type=om_gcm_enable &om_registration_id=<valid_registration_id>
Similarly, to disable you can use:
GET https://example.analyzer.omniata.com/event ?api_key=ae4398de &uid=e439da31f399c23a &om_event_type=om_gcm_disable &om_registration_id=<valid_registration_id>
Start by following the steps to obtain the certificate in Mac. Once the certificate has been uploaded to Omniata you can proceed with the next steps.
Retrieve the device token and send it to Omniata with
EnablePushNotificationsFromTokenBytes. In order to retrieve the device token you need to use native Unity class
NotificationServices. You can find more information in Unity guides for iOS Notification Services.
Once you have obtained the device token, you need to send the following event :
byte token = NotificationServices.deviceToken; Omniata.Instance.EnablePushNotificationsFromTokenBytes(token);
Alternatively you can call the REST API as specified above.
Start by following the steps to obtain the GCM API Key. Once the certificate has been uploaded to Omniata you can proceed with the next steps.
Retrieve the GCM token as a string and send it with
AutoEnableOmPushNotifications. Unity3D does not provide a direct access to the android native interface for retrieving the token, so you will need to write the android interface to retrieve it or use a plugin such as Android Native Plugin.
To disable notifications, call this method to tell Omniata that the user is no longer eligible to receive push notifications:
Alternatively you can call the REST API as specified above.
To test Push Notifications in device, you’ll need to have your push notification credentials (Apple certificate or Google API key) registered in Omniata as well as have your app set up to send the tokens (Apple device token or Android Registration ID) to Omniata and receive remote notifications from Apple or Google.
The following can be used as a test script:
If the notification does not arrive, recheck that the configuration has been completed. Common causes of missing notifications are:
A good rule of thumb is to test that your certificate, token and content combination are working using iOS or Android native tools. Contact Omniata support in case assistance is needed.