java - Run application in the background -
i'm trying start groomdroid web server in android when starts, black window shown.
i'd start app in background without screen being shown.
i'm starting app in following way:
intent webserver = new intent(); webserver.setclassname("net.allory.groom","net.allory.groom.groomdroid"); startactivity(webserver);
i tried startservice(webserver);
doesn't seem work.
can me ?
you should move background logic service, , when it's running create ongoing notification.
selecting notification should start activity (ui), , service can communicate data using handler.
also, if specify launchmode
of activity singletask
:
<activity android:name=".activity.youractivity" android:launchmode="singletask" android:alwaysretaintaskstate="true" android:cleartaskonlaunch="false" android:finishontasklaunch="false"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity>
and on application start check if service running (say you've started application, , press icon again), you'll able start same task, instead of relaunching service and/or showing nothing.
this explanation might not clear, let me know if need more details :)
Comments
Post a Comment