I've finally finished my app, and it works just fine in debug mode.
However, when I uploaded it to Google Play, and ran it, I have constant crashing when the app starts.
It seems to be a UA-related error, as I have checked my logcat and it gives me the following:
12-07 09:36:43.553: E/AndroidRuntime(11386): Process: com.cyrilsplutterworth.android.runphilosophy, PID: 11386
12-07 09:36:43.553: E/AndroidRuntime(11386): at com.cyrilsplutterworth.android.runphilosophy.UAApplication$1.onAirshipReady(UAApplication.java:25)
12-07 09:36:43.558: W/ActivityManager(1745): Force finishing activity com.cyrilsplutterworth.android.runphilosophy/.MainActivity
The error must be coming from somewhere in the activity, but I'm not sure where.
The code for my UrbanAirship activity is below, but as there's no redline showing an error I think the problem may be elsewhere.
package com.cyrilsplutterworth.android.runphilosophy;
import android.app.Application;
import android.util.Log;
import com.urbanairship.UAirship;
import com.urbanairship.push.notifications.DefaultNotificationFactory;
/**
* Created by Mr. Stuart Saunders on 29/11/2016.
*/
public class UAApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
UAirship.takeOff(this, new UAirship.OnReadyCallback() {
@Override
public void onAirshipReady(UAirship airship) {
//Method to get Channel ID, needed for UrbanAirship publishing//
String channelId = UAirship.shared().getPushManager().getChannelId();
Log.v ("My Channel ID: " , channelId);
// Enable user notifications
//airship.getPushManager().setUserNotificationsEnabled(true);
UAirship.shared().getPushManager().setUserNotificationsEnabled(true);
// Create Notification Factory
DefaultNotificationFactory defaultNotificationFactory = new DefaultNotificationFactory(getApplicationContext());
// Get the Icon image from resources. Needs to be white-on-transparent //
defaultNotificationFactory.setSmallIconId(R.drawable.whiteiconforpush);
//Optional, for larger image. Uncertain if it's any good//
//defaultNotificationFactory.setLargeIcon(R.drawable.whiteiconforpush);
// Set the accent color. NotificationCompat not recognised at the moment//
//defaultNotificationFactory.setColor(NotificationCompat.COLOR_DEFAULT);
airship.getPushManager().setNotificationFactory(defaultNotificationFactory);
}
});
}
}
Comments
2 comments