appcelerator-archive / ti.googleanalytics

Google Analytics module for Titanium Mobile
4 stars 8 forks source link

isGooglePlayServicesAvailable for Android? Or an Android 5.0 (Lollipop) issue? #1

Open Astrovic opened 9 years ago

Astrovic commented 9 years ago

Would need a way to check whether Google Play Services is available on the device, like this:

GoogleAnalytics =  require('ti.googleanalytics');
GoogleAnalytics.isGooglePlayServicesAvailable();

When it is not available, I get this error:

[ERROR] : TiApplication: (GAThread) [4865,5095] Sending event: exception on thread: GAThread msg:java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }; Titanium 3.5.0,2015/01/12 15:33,0014f83 [ERROR] : TiApplication: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) } [ERROR] : TiApplication: at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1682) [ERROR] : TiApplication: at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1781) [ERROR] : TiApplication: at android.app.ContextImpl.bindService(ContextImpl.java:1759) [ERROR] : TiApplication: at android.content.ContextWrapper.bindService(ContextWrapper.java:538) [ERROR] : TiApplication: at com.google.analytics.tracking.android.AnalyticsGmsCoreClient.connect(AnalyticsGmsCoreClient.java:82) [ERROR] : TiApplication: at com.google.analytics.tracking.android.GAServiceProxy.connectToService(GAServiceProxy.java:330) [ERROR] : TiApplication: at com.google.analytics.tracking.android.GAServiceProxy.createService(GAServiceProxy.java:210) [ERROR] : TiApplication: at com.google.analytics.tracking.android.GAThread.init(GAThread.java:85) [ERROR] : TiApplication: at com.google.analytics.tracking.android.GAThread.run(GAThread.java:352)

AppWerft commented 9 years ago

Hi Ingo, we are in germany and in this country we need the property '[tracker set:kGAIAnonymizeIp value:@"1"];'

What is about?

Rainer

ingo commented 9 years ago

Hi Rainer--can you explain in more detail?

AppWerft commented 9 years ago

Here https://developers.google.com/analytics/devguides/collection/ios/v3/advanced you can read about it:

Anonymize IP

Enabling anonymize IP functionality tells Google Analytics to anonymize the IP information sent by the SDK by removing the last octet of the IP address prior to its storage.

The following example shows how to enable the anonymize IP functionality for a tracker:

[tracker set:kGAIAnonymizeIp value:@"1"];

Anonymize IP functionality can be set at any time.

.... With android I see a similar problem ;-)

trueflywood commented 8 years ago

I am getting this error on Android 5.0.1 (API 21) and 5.1.1 (API 22) but that is working with Android 4.4.4 (API 19) Do you have any idea?

My Titanium SDK 5.0.2.GA

[WARN] TiVerify: (Timer-0) [5000,5000] Verifying module licenses... [INFO] I/System.out: Thread-1991(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables [INFO] I/System.out: Thread-1991(ApacheHTTPLog):isSBSettingEnabled false [INFO] I/System.out: Thread-1991(ApacheHTTPLog):isShipBuild true [INFO] I/System.out: Thread-1991(ApacheHTTPLog):SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false [INFO] I/System.out: Timer-0 calls detatch() [INFO] TiVerify: (Timer-0) [671,5671] Succesfully verified module licenses [ERROR] AndroidRuntime: FATAL EXCEPTION: GAThread [ERROR] AndroidRuntime: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }
[ERROR] AndroidRuntime: at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:2052) [ERROR] AndroidRuntime: at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:2160) [ERROR] AndroidRuntime: at android.app.ContextImpl.bindService(ContextImpl.java:2138) [ERROR] AndroidRuntime: at android.content.ContextWrapper.bindService(ContextWrapper.java:559) [ERROR] AndroidRuntime: at com.google.analytics.tracking.android.AnalyticsGmsCoreClient.connect(AnalyticsGmsCoreClient.java:82) [ERROR] AndroidRuntime: at com.google.analytics.tracking.android.GAServiceProxy.connectToService(GAServiceProxy.java:330) [ERROR] AndroidRuntime: at com.google.analytics.tracking.android.GAServiceProxy.createService(GAServiceProxy.java:210) [ERROR] AndroidRuntime: at com.google.analytics.tracking.android.GAThread.init(GAThread.java:85) [ERROR] AndroidRuntime: at com.google.analytics.tracking.android.GAThread.run(GAThread.java:352) [INFO] Timeline: Timeline: Activity_idle id: android.os.BinderProxy@b2d7b49 time:607707 [DEBUG] SensorManager: unregisterListener :: [DEBUG] Window: Window is closed normally. [INFO] Process: Sending signal. PID: 12683 SIG: 9