Prerequisites to run this custom code - HimanshuSShephertz/SocialInfo GitHub Wiki

Here are few values which you need to fill up before running this custom code:

  • Register your self to AppHQ Management Console from here

  • Create your App, once you successfully login into AppHQ Management Console and get the App credentials

  • If you are already created your App, then skip the above point

  • Open Constants.java file which is under (java/src/com/shephertz/app42/paas/customcode/sample) folder

  • Put your APIKey, SecretKey, DataBase name, COLLECTION_NAME (if you don't want to put UserProfile), AdminKey (if your app is ACL enable), Sender Email id and Mail Subject (Required to send email to user who is going to register after the success of information fetched from Social network)

  • After following all the above steps, create jar of your code using Ant Command and deploy your custom code using AppHQ Management Console. How to deploy through AppHQ, see here

  • Once you done with the deployment, you just need to run custom code service method from App42 Client SDK. In this example, I will share a Java code snippet to run this, same you can run with other client as well:

App42API.initialize("ANDROID_APPLICATION_CONTEXT","YOUR_API_KEY","YOUR_SECRET_KEY");
CustomCodeService customCodeService = App42API.buildCustomCodeService();
String name = "DEPLOYED_CUSTOM_CODE_NAME";
JSONObject jsonBody = new JSONObject();
jsonBody.put("googleAccessToken", "<Google_Access_token>");
JSONObject response = customCodeService.runJavaCode(name, jsonBody);