2

In my main activity's onCreate, onStart and onResume methods, the call PushManager.shared().getAPID() is always null when the app is installed for the first time.

However, after the onResume method, Urban Airship automatically registers a new APID (I placed a button and created a toast to print the APID). I want to retrieve this APID and store it in my back end server on fresh install. How can I do that?

My question is similar to this question but I'm looking to register the apid on my own back end server not Urban Airship.

user972616
  • 1,324
  • 3
  • 18
  • 38

1 Answers1

0

I had the same problem. In order to get the UA lib to generate the APID on first install I had to call PUshManager.enablePush().

Its not the ideal solution I wanted but it allowed me to grab the APID and save it to a separate server.

Marco RS
  • 8,145
  • 3
  • 37
  • 45
  • 3
    Ya I called that on app launch. Problem for me was that on app launch itself I wanted to register the id on the server but it came null as it had not finished getting the id from UrbanAirship. I had to create a BroadcastReceiver and wait for action PushManager.ACTION_REGISTRATION_FINISHED and only after register the id to server. – user972616 Feb 12 '13 at 23:45
  • ah yeah that makes perfect sense. – Marco RS Feb 13 '13 at 00:05
  • could you please post the answer? I am also having the same problem: http://stackoverflow.com/questions/19827850/push-notifications-using-urban-airship-returns-apid-as-null-at-the-first-launch?noredirect=1#comment29482816_19827850 – TharakaNirmana Nov 07 '13 at 04:38