{"action":"created","issue":{"url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/335","repository_url":"https://api.github.com/repos/danwilson/google-analytics-plugin","labels_url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/335/comments","events_url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/335/events","html_url":"https://github.com/danwilson/google-analytics-plugin/issues/335","id":192607847,"number":335,"title":"trackView not working in Android (works on iOS) version 1.6.0","user":{"login":"jeudycecropia","id":3329666,"avatar_url":"https://avatars.githubusercontent.com/u/3329666?v=3","gravatar_id":"","url":"https://api.github.com/users/jeudycecropia","html_url":"https://github.com/jeudycecropia","followers_url":"https://api.github.com/users/jeudycecropia/followers","following_url":"https://api.github.com/users/jeudycecropia/following{/other_user}","gists_url":"https://api.github.com/users/jeudycecropia/gists{/gist_id}","starred_url":"https://api.github.com/users/jeudycecropia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeudycecropia/subscriptions","organizations_url":"https://api.github.com/users/jeudycecropia/orgs","repos_url":"https://api.github.com/users/jeudycecropia/repos","events_url":"https://api.github.com/users/jeudycecropia/events{/privacy}","received_events_url":"https://api.github.com/users/jeudycecropia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-30T16:12:39Z","updated_at":"2016-11-30T22:03:48Z","closed_at":null,"body":"Hi,\r\n\r\nI'm using the plugin on an Ionic2 app, and its working great on iOS, I can see the activity in the Google Analytics dashboard for realtime data. But its not doing anything in Android. Exact same code. No evident errors on logcat. I'm using the 1.6.0 version (added it and removed it several times along with the android platform).\r\n\r\n```\r\n$ionic plugins\r\ncordova-plugin-google-analytics 1.6.0 \"Google Universal Analytics Plugin\"\r\n```\r\n\r\nThis is my system info:\r\n\r\n```\r\nYour system information:\r\n\r\nCordova CLI: 6.3.1\r\nGulp version:  CLI version 3.9.1\r\nGulp local:   Local version 3.9.1\r\nIonic Framework Version: 2.0.0-beta.11\r\nIonic CLI Version: 2.1.0\r\nIonic App Lib Version: 2.1.0-beta.1\r\nOS: Distributor ID:\tUbuntu Description:\tUbuntu 14.04.5 LTS \r\nNode Version: v6.7.0\r\n```\r\n\r\nThe last thing I tried was adding crosswalk in case there was some permissions issue with the default webview, but it didn't help.\r\n\r\nI implemented this inside a service as suggested in a different issue, and as I mentioned, its working fine on iOS. This is my code:\r\n\r\n```\r\nimport { Injectable } from '@angular/core';\r\nimport { GoogleAnalytics} from 'ionic-native';\r\nimport { Platform } from 'ionic-angular';\r\n\r\n@Injectable()\r\nexport class AnalyticsService {\r\n  platform : any;\r\n  initialized: boolean;\r\n\r\n  constructor(private _platform: Platform) {\r\n    this.platform = _platform;\r\n    this.initialized = false;\r\n    this.platform.ready().then(() => {\r\n\r\n      console.log(\"GoogleAnalytics service platform ready\");\r\n\r\n    });\r\n\r\n  }\r\n\r\n  track_page_view(page_name, page_path) {\r\n    this.platform.ready().then(() => {\r\n\r\n      console.log(\"GoogleAnalytics is initialized? \" + this.initialized);\r\n\r\n      if(this.platform.is(\"ios\") || this.platform.is(\"android\")){\r\n        //mobile\r\n\r\n        var platform = \"\";\r\n\r\n        if(this.platform.is(\"ios\")){\r\n          platform = \"ios\";\r\n        }\r\n        else{\r\n          platform = \"android\";\r\n        }\r\n\r\n        //GoogleAnalytics.debugMode();\r\n\r\n        if(!this.initialized){\r\n\r\n          GoogleAnalytics.debugMode();\r\n\r\n          GoogleAnalytics.startTrackerWithId(\"UA-xxxxx-13\").then((_result) => {\r\n\r\n            this.initialized = true;\r\n\r\n            console.log(\"GoogleAnalytics initialized for mobile: UA-xxx-13\");\r\n            console.log(\"GoogleAnalytics result: \" + _result);\r\n\r\n            GoogleAnalytics.enableUncaughtExceptionReporting(true)\r\n              .then((_success) => {\r\n                console.log(\"GoogleAnalytics success: \" + _success);\r\n              }).catch((_error) => {\r\n                console.log(\"GoogleAnalytics error: \" + _error);\r\n              });\r\n            GoogleAnalytics.trackView(page_name).then((_success) => {\r\n              console.log(\"GoogleAnalytics: Tracked view for mobile: \" + page_name + \"_\" + platform);\r\n            }).catch((_error) => {\r\n              console.log(\"GoogleAnalytics error tracking view: \" + _error);\r\n            });\r\n\r\n          });\r\n\r\n        }\r\n        else{\r\n\r\n          console.log(\"GoogleAnalytics: Starting Tracking page view: \" + page_name + \"_\" + platform);\r\n\r\n          GoogleAnalytics.trackView(page_name).then((_success) => {\r\n            console.log(\"GoogleAnalytics: Tracked view for mobile: \" + page_name + \"_\" + platform);\r\n          }).catch((_error) => {\r\n            console.log(\"GoogleAnalytics error tracking view: \" + _error);\r\n          });\r\n        }\r\n      }\r\n    });\r\n  }\r\n}\r\n\r\n```\r\n\r\nAny ideas? \r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/comments/264010222","html_url":"https://github.com/danwilson/google-analytics-plugin/issues/335#issuecomment-264010222","issue_url":"https://api.github.com/repos/danwilson/google-analytics-plugin/issues/335","id":264010222,"user":{"login":"jeudycecropia","id":3329666,"avatar_url":"https://avatars.githubusercontent.com/u/3329666?v=3","gravatar_id":"","url":"https://api.github.com/users/jeudycecropia","html_url":"https://github.com/jeudycecropia","followers_url":"https://api.github.com/users/jeudycecropia/followers","following_url":"https://api.github.com/users/jeudycecropia/following{/other_user}","gists_url":"https://api.github.com/users/jeudycecropia/gists{/gist_id}","starred_url":"https://api.github.com/users/jeudycecropia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeudycecropia/subscriptions","organizations_url":"https://api.github.com/users/jeudycecropia/orgs","repos_url":"https://api.github.com/users/jeudycecropia/repos","events_url":"https://api.github.com/users/jeudycecropia/events{/privacy}","received_events_url":"https://api.github.com/users/jeudycecropia/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T22:03:48Z","updated_at":"2016-11-30T22:03:48Z","body":"This is an error that I just noticed in logcat:\r\n\r\n> Unable to start service Intent { cmp=com.google.android.gms/.analytics.service.RefreshEnabledStateService"}}
{"actor":{"display_login":"jeudycecropia"}}