{ "id": "159822", "key": "AC-3549", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2016-04-28T04:24:22.000+0000", "created": "2016-04-26T08:06:50.000+0000", "labels": [ "Android", "Module" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-04-28T04:24:22.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "Hi,\r\n\r\nin my special view I need access to lifecycle events for rerendering etc.\r\n\r\nThe only example I found in net is https://github.com/appcelerator-modules/ti.admob/blob/master/android/src/ti/admob/ViewProxy.java\r\n\r\nMy viewproxy is a simple clone of it: https://github.com/AppWerft/Ti.AudioVisualizerView/blob/master/android/src/ti/audiovisualizerview/ViewProxy.java \r\n\r\nThe event never appears. If I add the init routine in view constructor, then I see the visualizer, but not after resuming.\r\n\r\nDoes the event listener depends of a condition? The module will called after open event of window\r\n\r\n", "attachment": [], "flagged": false, "summary": "OnLifecycleEvent doesn't work on viewproxy", "creator": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "383895", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "The same issue, if I add the code to native View:\r\n\r\nhttps://github.com/AppWerft/Ti.AudioVisualizerView/blob/master/android/src/ti/audiovisualizerview/VisualizerImageView.java", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-26T08:28:37.000+0000", "updated": "2016-04-26T08:28:37.000+0000" }, { "id": "383901", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "Here the code example:\r\n\r\n{code:title=VisualizerView.js|borderStyle=solid}\r\nvar $ = Ti.UI.createWindow();\r\n$.addEventListener('open', function() {\r\n  require('vendor/permissions').requestPermissions(['RECORD_AUDIO', 'MODIFY_AUDIO_SETTINGS'], function(_success) {\r\n    if (_success == true) {\r\n      var Visualizer = require('ti.audiovisualizerview');\r\n      $.visualizerView = Visualizer.createView({\r\n        audioSessionId : 0, //playStopControlView.audioSessionId || 0,\r\n      });\r\n      $.visualizerView.addEventListener('ready', function() {\r\n  $.visualizerView.addBarGraphRenderers();\r\n});\r\n\t$.add($.visualizerView); \r\n} else\r\n\t\tconsole.log('Pheelicks: WRONG PERMISSIONS');\r\n});\r\n});\r\n$.open();\r\n{code}\r\n", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-26T08:40:17.000+0000", "updated": "2016-04-26T09:05:52.000+0000" }, { "id": "383906", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\nThanks for your query. Here is some information which may help you.\r\nOn android lifecycle events are attached to activities. For example onPause event of an activity is fired when the activity is paused. To make a proxy to respond to these events first, in the module proxy, override the activity lifecycle callbacks you want to respond to. Then, in the JavaScript application, when you create the module proxy, assign its lifecycleContainer property to either a Window or TabGroup object to listen for that object's lifecycle events to trigger the module proxy's activity lifecycle callbacks. Like this :\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\nvar foo = require('com.appc.foo');\r\nvar fooProxy = foo.createExample({lifecycleContainer: win});\r\nwin.open();\r\n\r\n{code}\r\n[Documentation Link|http://docs.appcelerator.com/platform/latest/#!/guide/Android_Module_Architecture-section-43289000_AndroidModuleArchitecture-ActivityLifecycleEvents]\r\nThanks\r\n", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-04-26T09:10:26.000+0000", "updated": "2016-04-26T09:10:26.000+0000" }, { "id": "383909", "author": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for quick answer. In my case the calling of module is after opening of window. Is it a problem?\r\n\r\nSecond: I found in TiUIImageView.java the same pattern. The listener is binded an View, not on Viewproxy and in JS-code I dont see the lifecycle binding. Or is it only needed for special applications?\r\nIs there a difference TiContext.OnLifecycleEvent;and and TiLifecycle.OnLifecycleEvent?\r\n\r\nCheers!\r\n\r\n", "updateAuthor": { "name": "titanium@webmasterei-hamburg.de", "key": "titanium@webmasterei-hamburg.de", "displayName": "Rainer Schleevoigt", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-04-26T09:31:52.000+0000", "updated": "2016-04-26T09:31:52.000+0000" }, { "id": "383910", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nFirst:\r\nWhen the window is opened the activity has already gone pass onResume and onStart event. You can not catch these events now. But the the activity can go through these events again depending on the app structure.\r\nSecond:\r\nWhile developing module you have to make use of module development API. [LINK|http://docs.appcelerator.com/module-apidoc/latest/android/index.html]\r\n\r\nThanks", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2016-04-26T10:16:05.000+0000", "updated": "2016-04-26T10:16:05.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }