Question

I've been following the tutorial for implementing Urban Airship functionality, but I'm stuck at this step:

4. Open your airshipconfig.properties file and add the following line...

I don't know where to find this file. It is definitely not inside my Android project.

The next instruction is also confusing, because I have no idea what an "app secret" is:

5. Make sure you set developmentAppKey, developmentAppSecret, 
   productionAppKey, and productionAppSecret...

Can someone please clarify these for me? Thanks

Was it helpful?

Solution

I figured it is not necessary to have airshipconfig.properties at all. All the properties from that file can be set programmatically. This is what worked for me, in onCreate of my Application file:

AirshipConfigOptions options = 
        AirshipConfigOptions.loadDefaultOptions(this.getApplicationContext());

if (!options.isValid()) {
    options.gcmSender = "932487653294";
    options.transport = "gcm";
    options.developmentAppKey = "41fdslhbc827dgc2cdj";
    options.developmentAppSecret = "svigivyeubwohubvsdv";
    options.productionAppKey = "41fdslhbc827dgc2cdj";
    options.productionAppSecret = "svigivyeubwohubvsdv";
    options.inProduction = true;
    options.richPushEnabled = true;
}

UAirship.takeOff(this, options);

PushManager.enablePush();

String apid = PushManager.shared().getAPID();
Log.i("my_tag", "My Application onCreate - App APID: " + apid);

PushManager.shared().setIntentReceiver(IntentReceiver.class);

OTHER TIPS

If you did want to have the properties, it's meant to go in your src/main/assets directory.

Once you create the application in your Urban Airship account, you will get Appkey and AppSecret.

The credentials have to be integrated in the application.

It can be done in two ways

1) in the assets folder(in airshipconfig.properties file). 2) in the application class.

This is where you can find your airshipconfig.properties file, assuming you are using Android Studio to compile your project:

app\src\main\assets\airshipconfig.properties

You can find the corresponding developmentAppKey, developmentAppSecret, productionAppKey, and productionAppSecret at urbanairship.com from your account.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top