Problem description
Calling Ti.Android.getCurrentActivity() always fails with an exception in the logs.
E/TiJSError( 1288): (main) [2,1195] - Message: Uncaught TypeError: Object #<Android> has no method 'getCurrentService'
Steps to reproduce
Use this simple app to test:
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({
backgroundColor:'#fff',
fullscreen: true
});
win1.open();
Titanium.API.info("Activity: " + Titanium.Android.getCurrentService());
Changing from getCurrentService() to currentService (direct access to the property) works fine.
https://github.com/appcelerator/titanium_mobile/pull/6109
Both _Titanium.Android.getCurrentActivity()_ and _Titanium.Android.getCurrentService_ have been removed from the documentation. _Titanium.Android.currentActivity_ and _Titanium.Android.currentService_ should be used instead. This bug is because docgen automatically generates getter methods for properties even if the getter is not implemented.
Verified the fix in the docs yml files on github. Titanium.Android.getCurrentActivity() and Titanium.Android.getCurrentService are removed. Closing. Environment: Appc Studio : 3.5.1.201412091616 Ti SDK : 4.0.0.v20150317234215 CLI : 4.0.0-alpha Alloy : 1.6.0-alpha MAC Yosemite : 10.10.2