Пример #1
0
            public override void uncaughtException(Thread thread, Exception ex)
            {
                /*
                 * Report crash to the service via start service, because we can't bind to a service if not
                 * already bound at this stage. We also check if the agent is enabled.
                 */
                if (outerInstance.Enabled)
                {
                    /* Get crash identifier */
                    EngagementCrashId crashId = EngagementCrashId.from(outerInstance.mContext, ex);

                    /* Dump stack trace */
                    string stackTrace = Log.getStackTraceString(ex);

                    /* Set parameters and send the intent */
                    Intent intent = EngagementAgentUtils.getServiceIntent(outerInstance.mContext);
                    intent.putExtra("com.microsoft.azure.engagement.intent.extra.CRASH_TYPE", crashId.Type);
                    intent.putExtra("com.microsoft.azure.engagement.intent.extra.CRASH_LOCATION", crashId.Location);
                    intent.putExtra("com.microsoft.azure.engagement.intent.extra.CRASH_STACK_TRACE", stackTrace);
                    outerInstance.mContext.startService(intent);
                }

                /* Do not prevent android from doing its job (or another crash handler) */
                sAndroidCrashHandler.uncaughtException(thread, ex);
            }
Пример #2
0
        /// <summary>
        /// Bind the agent to the Engagement service if not already done. This method opens the connection
        /// to the Engagement service. Calling this method is required before calling any of the other
        /// methods of the Engagement agent. This cancels unbind.
        /// </summary>
        private void bind()
        {
            /* Cancel unbind */
            cancelUnbind();

            /* Bind to the Engagement service if not already done or being done */
            if (mEngagementService == null && !mBindingService)
            {
                mBindingService = true;
                mContext.bindService(EngagementAgentUtils.getServiceIntent(mContext), mServiceConnection, BIND_AUTO_CREATE);
            }
        }
 public override void onReceive(Context context, Intent intent)
 {
     /* Just ensure the service starts and restore background location listening if enabled */
     context.startService(EngagementAgentUtils.getServiceIntent(context));
 }