3

I have a app project using libgdx 1.2. I want to add Parse.com push notifications to its iOS and Android builds. No problems with the usual java interface that enables the core app to call into the native platform methods, but I have quite a few problems in understanding how to call Parse.com SDK methods from Java RoboVM code, e.g., assuming NativeMethods were my interface for native methods access, and IOSNatives my iOS RoboVM implementation:

public class IOSNatives implements NativeMethods
{
  public void pushNotifications()
  {
    // how do I write the java code equivalent to this example?
    // step 5 here: https://parse.com/tutorials/ios-push-notifications
  }
}

I mean, step 5 here: and then I need some hints about steps 1-4 too...

I've already searched SO for similar questions, but the only one I could find is

Is there a way for push notifications in libGDX (Android and iOS projects)?

which doesn't really tell what I need.

Community
  • 1
  • 1
Lucio Crusca
  • 1,277
  • 3
  • 15
  • 41

1 Answers1

1

In order to work with IOS sdk's written on Objective C, you must use bindings. Binding is wrapper which allows you to call objective C code from java. Fortunately you don't need to write your own binding fot parse, because here is existing one: RoboVM parse binding.

You can look at Sample.java for example of implementation.

You can get more info about bindings and how to add them to your project here

Alon Zilberman
  • 2,120
  • 1
  • 16
  • 16
  • I've done the steps at BlueRiverInteractive. However the Sample.java does not contain any code to receive push notifications. Should I look somewhere else? – Lucio Crusca Oct 02 '14 at 13:01
  • It should be the same code as for normal IOS app, just written in "java way". – Alon Zilberman Oct 02 '14 at 13:12
  • Ok, the problem is, I don't understand where I should write the code. The Sample.java extends UIApplicationDelegateAdapter, but my IOSLauncher extends IOSApplication.Delegate and the methods are not quite the same... – Lucio Crusca Oct 02 '14 at 14:42