in-app-purchasecodenameonenokia-s40

How can I get a reference to the main application MIDlet object when running Codename one application on Nokia s40 device?


I'm trying to integrate the Nokia in app purchase for s40 and Asha library to my application. The NPayManager constructor needs a reference to the running MIDlet.


Solution

  • The MIDlet is passed in the init method of your main class.

    public void init(Object context)
    

    Note that you can only downcast to MIDlet in the j2me Native Interface section.Read more about native interface here - http://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html