Page 1 of 1

Using Java Classes

Posted: Tue Feb 25, 2014 10:01 am
by Rajeev

Hi,

There are Java classes to perform some funtionality. How do we use these Java classes in Appery.IO applications. Can we import them and use them in Javascripts or we can write these classes some where inside the application?


Using Java Classes

Posted: Tue Feb 25, 2014 12:30 pm
by Maryna Brodina

Hello!
You can add any Java files on Source tab. If you need to call any functions from these JS files using JS code, you would need to implement them as PhoneGap plugin http://cordova.apache.org/docs/en/3.0...


Using Java Classes

Posted: Tue Feb 25, 2014 12:51 pm
by Rajeev

I didn't get the plug-in part. I have a requirement to use below java class for receiving broadcasts. What is the best way to do that in appery.io

Thanks

public class MyReceiver extends BroadcastReceiver {

Code: Select all

 @Override
 public void onReceive(Context arg0, Intent arg1) {
     // TODO Auto-generated method stub

      Log.v("#@%@%#", "Power button is pressed.");  

      Toast.makeText(arg0, "power button clicked",Toast.LENGTH_LONG).show();

     //perform what you want here
 }

}


Using Java Classes

Posted: Tue Feb 25, 2014 1:38 pm
by Maryna Brodina

Sorry, but we are not aware what is this requirement. You would need to check your requirements carefully and figure out where it's recommended to place the code.