66import android .content .Context ;
77import android .content .Intent ;
88import android .content .pm .PackageManager ;
9- import android . support .annotation .CallSuper ;
10- import android . support . v4 .app .ActivityCompat ;
11- import android . support . v4 .content .ContextCompat ;
9+ import androidx .annotation .CallSuper ;
10+ import androidx . core .app .ActivityCompat ;
11+ import androidx . core .content .ContextCompat ;
1212import android .util .Log ;
1313import android .widget .Toast ;
1414
3131import java .util .Map ;
3232import java .util .Set ;
3333
34- import static android . support . v4 .content .PermissionChecker .PERMISSION_DENIED ;
35- import static android . support . v4 .content .PermissionChecker .PERMISSION_GRANTED ;
34+ import static androidx . core .content .PermissionChecker .PERMISSION_DENIED ;
35+ import static androidx . core .content .PermissionChecker .PERMISSION_GRANTED ;
3636
3737public class ASAPAndroidPeer extends BroadcastReceiver implements ASAPPeer {
3838 private static final int MY_ASK_FOR_PERMISSIONS_REQUEST = 100 ;
@@ -133,10 +133,6 @@ private ASAPAndroidPeer(Collection<CharSequence> supportedFormats,
133133 // remember me
134134 ASAPAndroidPeer .singleton = this ;
135135
136- // create proxy
137- this .asapPeerApplicationSide =
138- new ASAPPeerFS (asapOwner , this .getASAPRootFolder (), supportedFormats );
139-
140136 // set context
141137 this .setActivity (initialActivity );
142138
@@ -160,7 +156,7 @@ private ASAPAndroidPeer(Collection<CharSequence> supportedFormats,
160156 /**
161157 * Start initialized ASAPAndroidPeer
162158 */
163- public static void startPeer () {
159+ public static void startPeer () throws IOException , ASAPException {
164160 ASAPAndroidPeer .getASAPAndroidPeer ().start ();
165161 }
166162
@@ -175,7 +171,7 @@ public static boolean peerStarted() {
175171 * <b>Never forget to launch your application.</b>
176172 */
177173 @ CallSuper
178- public void start () {
174+ public void start () throws IOException , ASAPException {
179175 if (!this .started ) {
180176 Log .d (this .getLogStart (), "initialize and launch ASAP Service" );
181177 // collect parameters
@@ -213,6 +209,12 @@ public void start() {
213209 } else {
214210 Log .e (this .getLogStart (), "try to re-start application - not allowed. Ignored" );
215211 }
212+
213+ // finally create proxy
214+ this .asapPeerApplicationSide =
215+ new ASAPPeerFS (asapOwner , this .getASAPRootFolder (), supportedFormats );
216+
217+
216218 }
217219
218220 private void askForPermissions () {
0 commit comments