9
I am integrating Urban Airship to my Android application. I got a sample code from there and I followed the same procedure in order to invoke it from my application. But, I don't get any push notification on my device.
Can anyone guide me how to integrate the Urban Airship in Android application? How to send the AppId and GCM Register ID to Urban Airship server and getting the notification?
public class MyApplication extends Application {
public static SharedPreferences PREFS_TOKEN;
public static final String PREFERENCE = "UrbanAirship";
public static String tokenKey;
@Override
public void onCreate() {
super.onCreate();
AirshipConfigOptions options = AirshipConfigOptions
.loadDefaultOptions(this);
UAirship.takeOff(this, options);
PushManager.enablePush();
// Optionally, customize your config at runtime:
//
// options.inProduction = false;
// options.developmentAppKey = "Your Development App Key";
// options.developmentAppSecret "Your Development App Secret";
// UAirship.takeOff(this, options);
Logger.logLevel = Log.VERBOSE;
// use CustomPushNotificationBuilder to specify a custom layout
CustomPushNotificationBuilder nb = new CustomPushNotificationBuilder();
nb.statusBarIconDrawableId = R.drawable.icon;// custom status bar icon
nb.layout = R.layout.notification;
nb.layoutIconDrawableId = R.drawable.icon;// custom layout icon
nb.layoutIconId = R.id.icon;
nb.layoutSubjectId = R.id.subject;
nb.layoutMessageId = R.id.message;
// customize the sound played when a push is received
// nb.soundUri =
// Uri.parse("android.resource://"+this.getPackageName()+"/"
// +R.raw.cat);
String apid = PushManager.shared().getAPID();
Logger.info("My Application onCreate - App APID: " + apid);
PREFS_TOKEN = th