public class AnUitorService
extends Service
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
static java.lang.String |
DEFAULT_ROOT_FOLDER |
static int |
ICON_RES_ID |
static int |
NOTIF_ID |
static java.lang.String |
PORT |
static java.lang.String |
ROOT_FOLDER |
static java.lang.String |
START |
static java.lang.String |
STOP |
Constructor and Description |
---|
AnUitorService() |
Modifier and Type | Method and Description |
---|---|
boolean |
isRunning() |
IBinder |
onBind(Intent intent) |
void |
onCreate() |
protected AnUitorHttpServer |
onCreateServer(int port,
java.lang.String root) |
int |
onStartCommand(Intent intent,
int flags,
int startId) |
boolean |
start()
|
boolean |
start(int port,
java.lang.String rootFolder)
Start service
If there was any exception notification is shown with id
NOTIF_ID |
protected void |
startForeground()
Start service in foreground
|
static void |
startService(Context context)
Download web app if necessary and Start service
|
static void |
startService(Context context,
boolean overwriteWebFolder,
java.lang.Runnable onFinishCallback)
Async Download & Extract web and start service.
|
static void |
startService(Context context,
int rawWebZipFileRes)
Start service
|
static void |
startService(Context context,
int port,
int rawWebZipFileRes,
boolean overwriteWebFolder,
java.lang.Runnable onFinishCallback)
Async Extract web and start service.
|
static void |
startServiceUsingPort(Context context,
int port)
Download web app if necessary and Start service on particular port
|
void |
stop()
Stop service
|
public static final java.lang.String STOP
public static final java.lang.String START
public static final java.lang.String PORT
public static final int DEFAULT_PORT
public static final java.lang.String ROOT_FOLDER
public static final java.lang.String DEFAULT_ROOT_FOLDER
public static final int NOTIF_ID
public static final int ICON_RES_ID
public IBinder onBind(Intent intent)
public void onCreate()
public int onStartCommand(Intent intent, int flags, int startId)
public boolean start()
public boolean start(int port, java.lang.String rootFolder)
NOTIF_ID
port
- port for web browserrootFolder
- rootFolder for webBrowserjava.io.IOException
protected AnUitorHttpServer onCreateServer(int port, java.lang.String root)
public void stop()
protected void startForeground()
public boolean isRunning()
public static void startService(Context context)
context
- public static void startServiceUsingPort(Context context, int port)
context
- port
- public static void startService(Context context, int rawWebZipFileRes)
context
- rawWebZipFileRes
- #startService(android.content.Context, int, int, boolean, Runnable)
public static void startService(Context context, boolean overwriteWebFolder, java.lang.Runnable onFinishCallback)
context
- overwriteWebFolder
- onFinishCallback
- public static void startService(Context context, int port, int rawWebZipFileRes, boolean overwriteWebFolder, java.lang.Runnable onFinishCallback)
context
- rawWebZipFileRes
- resource id for zip file of web, if -1 'http://anuitor.scurab.com/download/anuitor.zip' is used as link to download app, 0 is used default included zip, otherwise your own asset fileoverwriteWebFolder
- true to delete old web folder and unzip againonFinishCallback
- called when Context#startService(android.content.Intent)
has been called, can be null, is called in non main thread!java.lang.IllegalStateException
- if application object doesn't implement WindowManager