{
"id": "163051",
"key": "MOD-2294",
"fields": {
"issuetype": {
"id": "1",
"description": "A problem which impairs or prevents the functions of the product.",
"name": "Bug",
"subtask": false
},
"project": {
"id": "10034",
"key": "MOD",
"name": "Appcelerator Modules",
"projectCategory": {
"id": "10100",
"description": "Titanium and related SDKs used in application development",
"name": "Client"
}
},
"fixVersions": [],
"resolution": {
"id": "7",
"description": "",
"name": "Invalid"
},
"resolutiondate": "2016-09-29T19:35:47.000+0000",
"created": "2016-09-07T18:01:56.000+0000",
"priority": {
"name": "High",
"id": "2"
},
"labels": [
"Geofence",
"module"
],
"versions": [
{
"id": "17723",
"name": "Release 5.4.0",
"archived": false,
"released": true,
"releaseDate": "2016-08-11"
}
],
"issuelinks": [],
"assignee": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"updated": "2018-08-06T17:37:00.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": "13714",
"name": "Geofence"
}
],
"description": "h6. description\r\n\r\n\"enterregions\" event does not work for Geofence module.\r\n- http://docs.appcelerator.com/platform/latest/#!/api/Modules.Geofence\r\n\r\nJust include the module to the project then run the following code to the device\r\n- https://platform.appcelerator.com/#/download\r\n\r\nTest code\r\n{code:title=app.js}\r\nvar window = Titanium.UI.createWindow({\r\n\tbackgroundColor : 'red'\r\n});\r\n\r\nvar titleInWinA = Ti.UI.createLabel({\r\n\ttext : 'Location',\r\n\tleft : 70,\r\n\ttop : 100,\r\n\twidth : Ti.UI.SIZE,\r\n\theight : Ti.UI.SIZE,\r\n});\r\nwindow.add(titleInWinA);\r\n\r\nvar lat;\r\nvar lon;\r\n\r\nif (Ti.Geolocation.locationServicesEnabled) {\r\n\tTitanium.Geolocation.purpose = 'Get Current Location';\r\n\tTitanium.Geolocation.getCurrentPosition(function(e) {\r\n\t\tif (e.error) {\r\n\t\t\talert('Error: ' + e.error);\r\n\t\t} else {\r\n\t\t\tTi.API.info(e.coords.latitude + '\\n' + e.coords.longitude);\r\n\t\t\ttitleInWinA.setText(e.coords.latitude + '\\n' + e.coords.longitude);\r\n\t\t\tlat = e.coords.latitude;\r\n\t\t\tlon = e.coords.longitude;\r\n\t\t\tEnterregions();\r\n\t\t}\r\n\t});\r\n} else {\r\n\talert('Please enable location services');\r\n}\r\n\r\nfunction Enterregions() {\r\n\r\n\tvar Geofence = require(\"ti.geofence\");\r\n\r\n\tvar newRegion = Geofence.createRegion({\r\n\t\tcenter : {\r\n\t\t\tlatitude : lat,\r\n\t\t\tlongitude : lon\r\n\t\t},\r\n\t\tradius : 500,\r\n\t\tidentifier : 'Appcelerator'\r\n\t});\r\n\r\n\tGeofence.startMonitoringForRegions([newRegion]);\r\n\r\n\tGeofence.addEventListener(\"enterregions\", function(e) {\r\n\t\tTi.API.log('####### enterregion #######: ' + JSON.stringify(e));\r\n\t\talert('enter region fired');\r\n\t});\r\n\r\n\r\n\tGeofence.addEventListener(\"monitorregions\", function(e) {\r\n\t\tTi.API.log('####### monitorregions #######: ' + JSON.stringify(e));\r\n\r\n\t}); \r\n\r\n\r\n}\r\n\r\nwindow.open();\r\n\r\n\r\n{code}\r\n\r\n{code:title=tiapp.xml}\r\nNSLocationAlwaysUsageDescription\r\n Specify the reason for accessing the user's location information.\r\n\t\t\t\t\tThis appears in the alert dialog when asking the user for permission to\r\n\t\t\t\t\taccess their location.\r\n{code}\r\n\r\nThanks",
"attachment": [],
"flagged": false,
"summary": "iOS Geofence module: EnterRegions event does not fire.",
"creator": {
"name": "morahman",
"key": "morahman",
"displayName": "Motiur Rahman",
"active": true,
"timeZone": "Asia/Dhaka"
},
"subtasks": [],
"reporter": {
"name": "morahman",
"key": "morahman",
"displayName": "Motiur Rahman",
"active": true,
"timeZone": "Asia/Dhaka"
},
"environment": "Ti SDK Version: 5.4.0.GA\r\nModule Version: 1.1.5\r\niPhone 5s v9.3.4",
"comment": {
"comments": [
{
"id": "395546",
"author": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"body": "Before I start further investigations, please validate the issue with this (corrected) demo-code, yours does not look valid for newer iOS-versions:\r\n\r\n{code:javascript}\r\nvar Geofence = require(\"ti.geofence\");\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\n\r\nvar titleInWinA = Ti.UI.createLabel({\r\n text: 'Receiving location ... ',\r\n left: 70,\r\n top: 100,\r\n});\r\nwindow.add(titleInWinA);\r\n\r\nwindow.addEventListener(\"open\", function() {\r\n checkLocationPermissions();\r\n});\r\n\r\nfunction checkLocationPermissions() {\r\n if (!Ti.Geolocation.hasLocationPermissions()) {\r\n Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e) {\r\n if (!e.success) {\r\n Ti.API.error(\"Error requesting location permissions: \" + e.error);\r\n return;\r\n }\r\n\r\n getCurrentPosition();\r\n });\r\n } else {\r\n getCurrentPosition();\r\n }\r\n}\r\n\r\nfunction getCurrentPosition() {\r\n Ti.Geolocation.getCurrentPosition(function(e) {\r\n if (e.error) {\r\n alert('Error: ' + e.error);\r\n } else {\r\n Enterregions(e.coords.latitude, e.coords.longitude);\r\n }\r\n });\r\n}\r\n\r\nfunction Enterregions(latitude, longitude) {\r\n\r\n Ti.API.info(latitude + '\\n' + longitude);\r\n titleInWinA.setText(latitude + '\\n' + longitude);\r\n\r\n var newRegion = Geofence.createRegion({\r\n center: {\r\n latitude: latitude,\r\n longitude: longitude\r\n },\r\n radius: 500,\r\n identifier: 'Appcelerator'\r\n });\r\n\r\n Geofence.startMonitoringForRegions([newRegion]);\r\n\r\n Geofence.addEventListener(\"enterregions\", function(e) {\r\n Ti.API.info('####### enterregion #######: ' + JSON.stringify(e));\r\n alert('enter region fired');\r\n });\r\n\r\n Geofence.addEventListener(\"monitorregions\", function(e) {\r\n Ti.API.info('####### monitorregions #######: ' + JSON.stringify(e));\r\n });\r\n}\r\n\r\nwindow.open();\r\n{code}\r\n\r\nMost important:\r\n- Validate the permissions status\r\n- Don't store global variables for this\r\n- Don't require a module inside an event-listener\r\n- Use Ti.API.info instead of Ti.API.log (\"log\" might not be displayed in the default log-level)\r\n\r\nAlso ensure to test on a device, thanks!",
"updateAuthor": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"created": "2016-09-07T22:28:45.000+0000",
"updated": "2016-09-07T22:29:57.000+0000"
},
{
"id": "396036",
"author": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"body": "Putting into next sprint for further investigation.",
"updateAuthor": {
"name": "hknoechel",
"key": "hansknoechel",
"displayName": "Hans Knöchel",
"active": true,
"timeZone": "Europe/Berlin"
},
"created": "2016-09-13T18:54:12.000+0000",
"updated": "2016-09-13T18:54:12.000+0000"
},
{
"id": "439906",
"author": {
"name": "emerriman",
"key": "emerriman",
"displayName": "Eric Merriman ",
"active": true,
"timeZone": "America/Los_Angeles"
},
"body": "Closing as invalid. If incorrect, please reopen.",
"updateAuthor": {
"name": "emerriman",
"key": "emerriman",
"displayName": "Eric Merriman ",
"active": true,
"timeZone": "America/Los_Angeles"
},
"created": "2018-08-06T17:37:00.000+0000",
"updated": "2018-08-06T17:37:00.000+0000"
}
],
"maxResults": 9,
"total": 9,
"startAt": 0
}
}
}