@@ -94,39 +94,41 @@ public MultiASAPEngineFS getASAPEngine() {
9494
9595 // comes first
9696 public void onCreate () {
97- Log . d ( LOGSTART , "creating" );
98-
99- String text = "started: " ;
97+ super . onCreate ( );
98+ Log . d ( LOGSTART , "onCreate" );
99+ }
100100
101- Log .d (LOGSTART ,text );
101+ // comes second - could remove that overwriting method
102+ @ Override
103+ public int onStartCommand (Intent intent , int flags , int startId ) {
104+ Log .d (LOGSTART , "onStartCommand" );
105+ if (intent == null ) {
106+ Log .d (LOGSTART , "intent is null" );
107+ this .owner = ASAP .UNKNOWN_USER ;
108+ this .rootFolder = ASAPEngineFS .DEFAULT_ROOT_FOLDER_NAME ;
109+ this .onlineExchange = ASAP .ONLINE_EXCHANGE_DEFAULT ;
110+ } else {
111+ Log .d (LOGSTART , "intent is not null" );
112+ this .owner = intent .getCharSequenceExtra (ASAP .USER );
113+ this .rootFolder = intent .getCharSequenceExtra (ASAP .FOLDER );
114+ this .onlineExchange = intent .getBooleanExtra (ASAP .ONLINE_EXCHANGE , ASAP .ONLINE_EXCHANGE_DEFAULT );
115+ Log .d (LOGSTART , "owner | folder | online == " + this .owner
116+ + " | " + this .rootFolder + " | " + this .onlineExchange );
117+ }
102118
103119 // get root directory
104120 File asapRoot = null ;
105- asapRoot = Environment .getExternalStoragePublicDirectory (
106- ASAPEngineFS .DEFAULT_ROOT_FOLDER_NAME );
121+ asapRoot = Environment .getExternalStoragePublicDirectory (this .rootFolder .toString ());
107122
108123 this .asapEngineRootFolderName = asapRoot .getAbsolutePath ();
109- Log .d (LOGSTART ,"onCreate(): parameter rootFolder not yet used when setting up engine - change it soon" );
110124 Log .d (LOGSTART ,"work with folder: " + this .asapEngineRootFolderName );
111125
112- Log .d (LOGSTART , "created" );
113- }
114-
115- // comes second - could remove that overwriting method
116- @ Override
117- public int onStartCommand (Intent intent , int flags , int startId ) {
118- Log .d (LOGSTART , "start" );
119-
120- this .owner = intent .getCharSequenceExtra (ASAP .USER );
121- this .rootFolder = intent .getCharSequenceExtra (ASAP .FOLDER );
122- this .onlineExchange = intent .getBooleanExtra (ASAP .ONLINE_EXCHANGE , ASAP .ONLINE_EXCHANGE_DEFAULT );
123-
124126 return super .onStartCommand (intent , flags , startId );
125127 }
126128
127129 public void onDestroy () {
128130 super .onDestroy ();
129- Log .d (LOGSTART ,"destroy " );
131+ Log .d (LOGSTART ,"onDestroy " );
130132 }
131133 /**
132134 * Target we publish for clients to send messages to IncomingHandler.
0 commit comments