Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17711] Android: Ti.Android.getCurrentService() fails with an exception

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-09-17T00:53:08.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsAndroid
Labelsn/a
ReporterDavide Cassenti
AssigneeGary Mathews
Created2014-09-16T22:20:16.000+0000
Updated2015-03-19T22:56:34.000+0000

Description

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.

Comments

  1. Gary Mathews 2014-09-16

    https://github.com/appcelerator/titanium_mobile/pull/6109
  2. Gary Mathews 2015-02-11

    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.
  3. Lokesh Choudhary 2015-03-19

    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

JSON Source