Question

Is there a tooling or maybe a log, where I can see what caused my application running on a android mobile phone, to hung or eventually crash?

I have programmed a signed application that is a runnable, it checks for messages on my server and send sms messages to a receiver, and after two or maybe 3 days, the application hungs or crashes.

How can I see what caused the crash?

Regards.

Shafqat

    private void startservice() {
    r = new Runnable()
    {
        public void run() 
        {
            //execute the sms class and get the url
            //build the url
            SendSMS sms = null;
            //TODO get the url from a database
            Map<String, String> jsonitems = new JSONParser().parse(urlsmsservice+getDeviceId());
            if(!jsonitems.isEmpty()){
                sms = new SendSMS(context, jsonitems.get("PHONENUMBER").toString(), jsonitems.get("MESSAGE").toString());
                sentReceiver.setCallbackUrl(jsonitems.get("CALLBACKURL").toString());
                deliveredReceiver.setCallbackUrl(jsonitems.get("CALLBACKURL").toString());
                sms.send();
            }else{
                Log.d(TAG, "No messages in Queue");
            }
            //handler.postDelayed(this, getInterval());
        }
    };

    handler = new Handler();
    thread = new Thread()
    {
        @Override
        public void run() {
            try {
                while(thbool) {
                    sleep(getInterval());
                    handler.post(r);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    };

    thread.start();
}
Was it helpful?

Solution

Make sure ADB tools are installed (they will be with the SDK). Then run adb logcat, which will show the system log output (useful is an exception is thrown). There are also free market applications which will show you the logcat buffer (aLogCat comes to mind).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top