The Netmera Developer Hub

Welcome to the Netmera developer hub. You'll find comprehensive guides and documentation to help you start working with Netmera as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Android Guide


To be able to use Netmera services, you must initialize your application with your API key. An initialization without API key will cause an Exception.

This initialization can be done with the following instructions:

There are 2 methods to initialize the application. Using only one of them is suitable for initialization. Initialization with first method is recommended.

  • 1- Initialization Using NetmeraProperties Class

You can initialize Netmera from code and without file under assets. You just need to build a NetmeraProperties instance and give it to proper Netmera.init method in your Application class.

package my.package.namespace;

public class YourAppClass extends Application {
    public void onCreate() {
        NetmeraProperties prop = new NetmeraProperties.Builder("Netmera SDK API Key")
            .googleProjectNumber("Google Project Number")
            Netmera.init(this, prop);


  • If you are not using Netmera push inbox library, you should set this property as pushInboxEnabled(false)

  • If you are not using location related functions of Netmera, you should set locationTrackingEnabled(false)

If you need to be informed about the result of the init method, you may add a listener to the method above as shown below.

Netmera.init(TestApp.this, prop, new NetmeraCallback<Void>() {

        public void onSuccess(Void v) {
             Log.i(“Netmera”, “Netmera initialized successfully!);   

        public void onFail(NetmeraException e) {
  • 2- Initialization Using File

You need to add file to assets folder of the application. Here is an example properties file:
Note: You shouldn’t use quotation mark for values. (correct format: googleProjectNumber=1112223334444)

#Netmera API key
apiKey=Your api key here
#Project number obtained from Google Developers Console
googleProjectNumber=Your Google project number here
#Push activity class name with full package name
# Log level must be one of the following: ERROR, WARNING, INFO, DEBUG, VERBOSE. Default is ERROR.
# Is location service active? Default is false
# Is exception reporting active? Default is true
# Is push inbox enabled? Default is false
# Is pop-up retrieval on start up active? If you are using pop up, please activate this.
# Default is false

In this file, you have to set a Netmera SDK Api key. Otherwise, you will get an exception. After creating the file, call Netmera.init(Application) method. You should call Netmera.init(Application) method from the class which extends Application ( which you also set in AndroidManifest.xml file.

package my.package.namespace;

public class YourAppClass extends Application {
    public void onCreate() {

Don’t forget to add name of this Application class in AndroidManifest.xml file like below

<application android:name="my.package.namespace.YourAppClass"

Note: Please check Initialization Notes.

Initialization Notes

If you set a Google project number and push activity class, default push registration will be done automatically. Google project number can be obtained from Google APIs console. For more information, please see our Netmera Push Notification Guide page. Push activity class name must include full package name.

You may want to see inner Netmera logs to track what Netmera does or if you use Netmera’s Logging class to log your app, you need to set a log level to see logs. Otherwise, you can see only ERROR level logs. To set log level, you can use file or NetmeraProperties class as shown above. For more info about log level, please visit API doc.

You can enable location tracking from or NetmeraProperties class as shown above. To be able to start tracking, you need some extra setup. Please see Location Service Guide page for more detail.

Netmera reports unhandled exceptions automatically. However, you may want not to send exception reports to Netmera. To disable reporting, you can use file or NetmeraProperties class as shown above. Remember, an application can have one exception tracker at a time. If you want to use another exception tracker than Netmera, you need to disable Netmera’s tracker.

You can enable/disable push inbox just by setting the property to true or false. If you are not interested in push inbox library, you can set it to FALSE. For more detail, please see Netmera Push Notification Guide page.

You can register pop-ups directly from file or NetmeraProperties class as shown above. Please see Netmera Pop-up Guide page for more detail. If you set this property to true, please be sure that you have added onStart and onStop methods of NetmeraEvent to your Activities. For more detail, please see Netmera Events Guide page.

After creating file or NetmeraProperties instance, initialization must be done in Application class of your application. This application class must be referenced from AndroidManifest.xml file and it must extend class. In application tag, you need to have a name property. Its value must be the name of your Application class.

For example, you have an Application class named in com.netmera.myapp package. In AndroidManifest.xml file, the name attribute in application tag should be like this:


Getting Installation Id
In order to get the installation id of the device, you can use the following code block:

String installationId = Netmera.getInstallationID();

Note for Very Old Android and Netmera SDKs

IO Exception with Android SDK 3.1 or higher with Netmera SDK 2.1.0 and below

For Android 3.1 or higher versions you should use background methods for network operations. Netmera’s most network operations are already done in background. However, if there is an alternative method for the same operation to do in background, you should either choose the background method directly or you should use normal method in an AsyncTask or in another thread. Because, Android does not allow performing network operations on main thread. If you get IOException, you can solve it by using background methods.

In Netmera SDK 2.2.0 and upper versions, this error is shown with a proper warning. Exception cause is given as NetworkOnMainThreadException if the exception is because of this case. Not just as IOException.

Android Guide