android - starting a service at boot time taking too much time,why? -


i'm trying build app starts service displays view. trying display view after boot takes time(>1min) start service. broadcastreceiver:

@override public void onreceive(context context, intent intent) {      if (intent.getaction().equals(intent.action_screen_off)) {         intent intentservice = new intent(context,newservice.class);         try{         context.startservice(intentservice);         }         catch(exception e){             e.printstacktrace();         }     } else if (intent.getaction().equals(intent.action_screen_on)) {         intent intent11 = new intent(context,mainactivity.class);         intent11.addflags(intent.flag_activity_new_task);     }    else if(intent.getaction().equals(intent.action_boot_completed))     {              context.startservice(new intent(context,newservice.class));     } 

manifest:

<uses-permission android:name="android.permission.receive_boot_completed"/> <service android:name="com.example.p.newservice"></service> <receiver android:name="receiver.myreceiver" android:permission="android.permission.receive_boot_completed"> <intent-filter>     <action android:name="android.intent.action.boot_completed" />     <action android:name="android.intent.action.screen_off" />     <action android:name="android.intent.action.screen_on" />     <category android:name="android.intent.category.default"/> </intent-filter>     </receiver> 

how proceed? there way set priority or that?

inside receiver replace permission with:

  <intent-filter android:priority="1000">         <action android:name="android.intent.action.boot_completed" />   </intent-filter> 

this should speed things.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -