Following are some more findings

When application is running fine following message doesn't appear when
service is scheduled

/ActivityManager(   57): Start proc MyService.Test for service
MyService.Test/.MyService: pid=426 uid=10023 gids={3003}

rather a message from very first line Service is printed. But when
application crash is to be started then application seems to be started by
ActivityManager and following message occurs

/ActivityManager(   57): Start proc MyService.Test for service
MyService.Test/.MyService: pid=426 uid=10023 gids={3003}

Why ActivityManager is starting MyService and after that application never
work ? But in normal case why above message is not displayed and scheduled
service works properly?

On Sun, Oct 4, 2009 at 1:08 PM, shahzad ahmad <[email protected]>wrote:

> When the android marketplace was opened on android phone following line was
> being till i closed android market place
>
> W/SurfaceFlinger(   57): executeScheduledBroadcasts() skipped, contention
> on the client. We'll try again later...
>
> What does this line means ? does this line occur because MyService was
> about to be scheduled but system delayed it ?
>
>
>
> On Sun, Oct 4, 2009 at 12:37 PM, shahzad ahmad 
> <[email protected]>wrote:
>
>> Hi,
>>      I've developed an application which has a service and boot completed
>> receiver. The boot completed receiver schedules the service to be executed
>> after every 7 minutes. The boot completed receiver saves its context in a
>> public static variable which is then accessed by service whenever it is
>> scheduled by scheduler. The service first gets the IMEI number of phone and
>> then saves it to a file if it is not already saved. Everything worked
>> smoothly but then i logged into market place and after that the scheduled
>> service was not able to get IMEI number directly , neither was it able to
>> open the file which had already been created and it keeps on throwing
>> nullpointer exception for both direct IMEI retrieval and attempt to open
>> file  .
>>
>> Following is the immidiate code executed by service which is scheduled by
>> schedular after contstant intervals (BootCompletedReceiver is the receiver
>> which is called when phone is restarted and it schedules a service to be
>> started after fixed time intervals,  appContext is public static Context
>> variable of BootCompletedReceiver which is equal to context of
>> BootCompletedReceiver and accessed by service and other classes for
>> different purposes)
>>
>>     public String getIMEINumber() throws Exception {
>>         String imei = null;
>>
>>         try {
>>             TelephonyManager tm = (TelephonyManager)
>> BootCompletedReceiver.appContext
>>                     .getSystemService(Context.TELEPHONY_SERVICE);
>>
>>             imei = tm.getDeviceId();
>>            System.out.println("[IMEIProcessor]: imei:" + imei);
>>             }
>>
>>             if (imei != null) {
>>                 storeIMEI(imei);
>>                 return imei;
>>             } else {
>>                 imei = getIMEIFromFile();
>>                 if (imei != null) {
>>                     return imei;
>>                 } else {
>>                     throw new NullPointerException();
>>                 }
>>
>>             }
>>         } catch (Exception e) {
>>             imei = getIMEIFromFile();
>>             if (imei != null) {
>>                 return imei;
>>             } else {
>>                 throw new NullPointerException();
>>             }
>>         }
>>     }
>>
>> /////////////////////////////////////////////
>> private boolean isIMEIFilePresent(){
>>         FileInputStream fis = null;
>>         try{
>>             fis =
>> BootCompletedReceiver.appContext.openFileInput("imei.file");
>>             fis.close();
>>             System.out.println("[IMEIProcessor]: imei file present");
>>             return true;
>>         } catch (Exception e){
>>                 System.out.println(e);
>>                 System.out.println("[IMEIProcessor]: imei file not
>> present");
>>                 return false;
>>         }
>>
>>     }
>>
>>
>> So following is first line of log when everything is working fine
>>
>> I/System.out(  194): [IMEIProcessor]: imei:358280015019595
>>
>> But when i logged into androidmarket place, application was neither able
>> to get IMEI number from system nor it was able to check if imei.file is
>> present. Following are logged messages .
>>
>> D/gmail-ls(  123): clearNewUnreadMailForNotificationLabelIfNeeded. Count:
>> 0, label: -65541/^^unseen-^^vmi
>> D/dalvikvm(  386): GC freed 3431 objects / 198576 bytes in 115ms
>> I/gmail-ls(  123): ConversationCursor requesting results for
>> query[label:^i] with queryId 1 starting at 1315217442227617791
>> D/gmail-ls(  123): clearNewUnreadMailForNotificationLabelIfNeeded. Count:
>> 0, label: -65540/^^unseen-^i
>> D/gmail-ls(  123): clearNewUnreadMailForNotificationLabelIfNeeded. Count:
>> 0, label: -65541/^^unseen-^^vmi
>> D/Gmail   (  386): ConversationHeaderCursorAdapter.cursorStatusChanged:
>> LOADING
>> D/gmail-ls(  123): clearNewUnreadMailForNotificationLabelIfNeeded. Count:
>> 0, label: -65540/^^unseen-^i
>> D/gmail-ls(  123): clearNewUnreadMailForNotificationLabelIfNeeded. Count:
>> 0, label: -65541/^^unseen-^^vmi
>> D/Gmail   (  386): ConversationHeaderCursorAdapter.cursorStatusChanged:
>> LOADED
>> I/WindowManager(   57): Input configuration changed: { scale=1.0 imsi=0/0
>> locale=en_AU touch=3 key=2/2 nav=3 orien=1 }
>> D/StatusBar(   57): updateResources
>> D/dalvikvm(   92): GC freed 3964 objects / 241744 bytes in 189ms
>> D/dalvikvm(   57): GC freed 5513 objects / 267056 bytes in 166ms
>> D/dalvikvm(  386): GC freed 3238 objects / 181800 bytes in 94ms
>> D/dalvikvm(  123): GC freed 4506 objects / 235528 bytes in 143ms
>> D/SurfaceFlinger(   57): About to give-up screen, flinger = 0xc3c18
>> D/dalvikvm(  123): GC freed 620 objects / 42568 bytes in 145ms
>> D/dalvikvm(   57): GC freed 14853 objects / 840120 bytes in 263ms
>> ----> I/ActivityManager(   57): Start proc MyService.Test for service
>> MyService.Test/.MyService: pid=426 uid=10023 gids={3003}
>> I/dalvikvm(  426): Ignoring DDM send req for type=0x41504e4d len=38
>> I/dalvikvm(  426): Ignoring DDM send req for type=0x41504e4d len=36
>> I/System.out(  426): java.lang.NullPointerException
>> I/System.out(  426): [IMEIProcessor]: imei file not present
>> I/ActivityManager(   57): Stopping service: MyService.Test/.MyService
>> I/System.out(  426): java.lang.NullPointerException
>> I/System.out(  426): [IMEIProcessor]: imei file not present
>> D/dalvikvm(  426): GC freed 680 objects / 42208 bytes in 129ms
>> I/ActivityManager(   57): Process MyService.Test (pid 426) has died.
>>
>> Can you tell what i'm doing wrong? Why Activity is manager is starting
>> process MyService.Test because when things were working fine there was no
>> mentioning of Activitymanager and following was the first line to be printed
>> in logs
>>
>> I/System.out(  194): [IMEIProcessor]: imei:358280015019595
>>
>> Suddenly why ActivityManager is trying to start my application ? and after
>> that service is never able to get IMEI and nor open file. Is it due to
>> context which the service uses of Boot completed receiver i.e
>> BootCompletedReceiver.appContext ?
>>
>> I'm realy stuck due to this issue . Please help me to solve this issue
>>
>> Thanks
>>
>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to