Issue Description
getapplicationcontext() method is present in android native code to get application context.
This is the code that needs to be executed in app.js
var localytics = require('com.localytics.android.Localytics');
localytics.autoIntegrate(application context);
Customer is not able to get current application context. He tried lot of things.
var context = require("android.context.Context");
var appContext = context.getApplicationContext();
This one throwing error stating could not find getapplicationContext method.
https://developer.android.com/reference/android/content/Context.html#getApplicationContext()
The above code only requires the class and tries to call a method on that, which will never work, because it isn't an instance, just a class. [~cwilliams] may be able to help where to call the
getApplicationContext
from. Maybe this *could* work:Because the
android.app.Activity
class indirectly inherits from theandroid.content.Context
class. Otherwise, and I'm not sure if that's possible so far, you could try to requireorg.appcelerator.titanium.TiApplication
(the internal classes) to callTiApplication.getInstance().getApplicationContext()
. But I think those classes are not generated so far.[~rramirez], please also check my comments in TIMOB-24420 which is exactly about the same issue.
Thanks ! [~nmishra] please take a look
Be my guest.