{ "id": "101820", "key": "AC-2383", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2013-04-01T23:24:00.000+0000", "created": "2012-09-24T06:53:37.000+0000", "labels": [ "android", "background", "service" ], "versions": [], "issuelinks": [ { "id": "27241", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "63384", "key": "TIMOB-2752", "fields": { "summary": "Android: Support for android.app.AlarmManager", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:25.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": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "In a simple alarm clock it´s impossible to get a background service running every 5 seconds, because when phone enter in sleep mode, the service stops running (maybe the internal counter of interval stops) not vibrate, not counter, nothing.\r\nThen when wake up the phone, service restart, but it´s not usable.\r\n\r\n\r\nFor example:\r\n\r\nin app.js:\r\n{code:title=app.js|borderStyle=solid}\r\nvar intent = Ti.Android.createServiceIntent({\r\n url: 'service.js'\r\n});\r\nintent.putExtra('interval', 5000);\r\nTi.Android.startService(intent);\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n\r\nin service.js:\r\n{code:title=service.js|borderStyle=solid}\r\nTi.API.info('Alarm control');\r\nTi.Media.vibrate([ 0, 100]);\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n\r\nin tiapp.xml:\r\n{code:title=tiapp.xml|borderStyle=solid}\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n{code}\r\n\r\nIf needed (help) I could provide complete titanium project.\r\n\r\nThanks!\r\nRegards.", "attachment": [], "flagged": false, "summary": "Android: Services in background not working when phone enter in sleep mode", "creator": { "name": "juanram0n", "key": "juanram0n", "displayName": "juanra", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "juanram0n", "key": "juanram0n", "displayName": "juanra", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "228089", "author": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "anagesh", "key": "anagesh", "displayName": "Anirudh Nagesh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-11-20T22:42:23.000+0000", "updated": "2012-11-20T22:42:23.000+0000" }, { "id": "228429", "author": { "name": "juanram0n", "key": "juanram0n", "displayName": "juanra", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hello Anirudh!!\n\nThanks for your answer.\n\nI allways used SDK 2.1.2GA, and now I have tested my code in 3.0. The error persist.\nI have look at the ticket but really it´s not the same problem, in that ticket the problem is that the service it´s killed when exit application. In my case the service do nothing (not running) when the phone enter in sleep mode. I know that many people have same problem.\n\nin the case of my example, the phone stops vibrating when the screen go black. I have researched about that and it seems than the solution in android it´s about AlarmManager, it provides tools for wake up the phone in certain moments.\n\nThanks a lot!", "updateAuthor": { "name": "juanram0n", "key": "juanram0n", "displayName": "juanra", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-11-26T16:36:42.000+0000", "updated": "2012-11-26T16:36:42.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }