Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-12969

Crittercism module does not show any crash or handled exception in live stat section

    Details

      Description

      I Tested the sample code provided with Crittercism module and found that live stats are not working for Crash and Handled Exception with Android 2.2 and above.
      Also i get app load only for 1st time app launch with Titanium SDK version change. like when i change TiSDK from 3.0.0 to 3.0.2 or vice versa.

      Ti.API.info("Ti App: importing Crittercism...");
      var crittercism = require('com.crittercism.ti.android');
      Ti.API.info("module is => " + crittercism + "\n");
       
      Ti.API.info("Ti App: initializing Crittercism...");
       
      crittercism.init("5004e9d1be790e78f2000006");
       
      Ti.API.info("Ti App: Crittercism initialized\n");
       
      var win = Titanium.UI.createWindow({
      	title : 'Crittercism Test',
      	backgroundColor : '#fff'
      });
      crittercism.leaveBreadcrumb("Creating window");
       
      var topLabel = Titanium.UI.createLabel({
      	top:10,
      	color : '#999',
      	text : 'Crittercism Test App!',
      	font : {
      		fontSize : 16,
      		fontFamily : 'Helvetica Neue'
      	},
      	width : 'auto'
      });
       
      win.add(topLabel);
       
      var setMetaData = Titanium.UI.createButton({
      	top:35,
      	width:301,
      	height:30,
      	title:'Set Metadata'
      });
       
      setMetaData.addEventListener('click', function()
      {
      	crittercism.leaveBreadcrumb("setMetaData // Setting Username");
      	crittercism.setUsername("TomCritter");
      	try {
      		crittercism.leaveBreadcrumb("Attempting to add Metadata");
      		crittercism.setMetadata({
      			"gameLevel": 5,
      			"email": "support@crittercism.com",
      			"playerID": 9491824
      			});
      	} catch (e) {
      		Ti.API.error("set Metadata: JSON failed");
      	}
      	
      });
       
      win.add(setMetaData);
       
      var crashButton = Titanium.UI.createButton({
      	top:70,
      	width:301,
      	height:30,
      	title:'Crash'
      });
       
      crashButton.addEventListener('click', function()
      {
      	crittercism.leaveBreadcrumb("Clicking the crash button");
      	// create an array with an invalid size
      	var a = new Array(0x100000000);
      	
      	var array = new Array();
      	// access an index out of bounds
      	array[-4]; // this doesn't get caught
      	
      	win.add(array[-4]); // this gets caught
      	
      	// throw an exceptions
      	var er = new Error("My Not as Awesome Uncaught Error!");
      	throw er
      });
       
      win.add(crashButton);
       
      var handledButton = Titanium.UI.createButton({
      	top:105,
      	width:301,
      	height:30,
      	title:'Send Handled Exception'
      });
       
      handledButton.addEventListener('click', function()
      {	
      	try {
      		crittercism.leaveBreadcrumb("Attempting some awesome task...");
      		var err = new Error("My Awesome Caught Error!");
      		throw err
      	} catch (err){
      		crittercism.leaveBreadcrumb("Oh no, it failed! Log it...");
      		crittercism.logHandledException({
      			name: err.name,
      			message: err.message,
      			line:err.lineNumber
      		});
      	}
      });
       
      win.add(handledButton);
       
      var status = false;
       
      var optOutToggle = Titanium.UI.createButton({
      	top:140,
      	width:301,
      	height:30,
      	title:'Toggle OptOut Status: No'
      });
       
      optOutToggle.addEventListener('click', function()
      {
      	// Set the status
      	crittercism.setOptOutStatus(status = !status);
      	
      	// change the status in the button title for visibility
      	var stringStatus = crittercism.getOptOutStatus() ? "Yes" : "No";
      	optOutToggle.title = 'Toggle OptOut Status: ' + stringStatus;
      });
       
      win.add(optOutToggle);
       
      win.open();
       
      
      

        Attachments

          Activity

            People

            • Assignee:
              blainhamon Blain Hamon
              Reporter:
              anigam Ashish Nigam
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-15817
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration