You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'll notice that there is an callback parameter in the constructor of the `NextcloudAPI`.
96
177
97
-
You'll notice that there is an callback parameter in the constructor of the `NextcloudAPI`.
98
-
```java
178
+
```java
99
179
public NextcloudAPI(Context context, SingleSignOnAccount account, Gson gson, ApiConnectedListener callback) {
100
-
```
180
+
```
181
+
101
182
102
-
You can use this callback to subscribe to errors that might occur during the initialization of the API. You can start making requests to the API as soon as you instantiated the `NextcloudAPI` object. For a minimal example to get started (without retrofit) take a look at section 4.2. The callback method `onConnected` will be called once the connection to the files app is established. You can start making calls to the api before that callback is fired as the library will queue your calls until the connection is established.
183
+
You can use this callback to subscribe to errors that might occur during the initialization of the API. You can start making requests to the API as soon as you instantiated the `NextcloudAPI` object. For a minimal example to get started (without retrofit) take a look at section 4.2. The callback method `onConnected` will be called once the connection to the files app is established. You can start making calls to the api before that callback is fired as the library will queue your calls until the connection is established.
103
184
104
-
4.1) **UsingRetrofit**
185
+
5.1) **UsingRetrofit**
105
186
106
-
4.1.1) Before using this single sign on library, your interfacefor your retrofit API might look like this:
187
+
5.1.1) Before using this single sign on library, your interfacefor your retrofit API might look like this:
Enjoy!If you're already using retrofit, you don't need to modify your application logic. Just exchange the API and you're good to go!
236
+
Enjoy!If you're already using retrofit, you don't need to modify your application logic. Just exchange the API and you're good to go!
155
237
156
-
Note: If you need a different mapping between your json-structure and your java-structure you might want to create a custom type adapter using `new GsonBuilder().create().registerTypeAdapter(...)`. Take a look at [this](https://github.com/nextcloud/news-android/blob/783836390b4c27aba285bad1441b53154df16685/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/GsonConfig.java) example for more information.
238
+
Note: If you need a different mapping between your json-structure and your java-structure you might want to create a custom type adapter using `new GsonBuilder().create().registerTypeAdapter(...)`. Take a look at [this](https://github.com/nextcloud/news-android/blob/783836390b4c27aba285bad1441b53154df16685/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/helper/GsonConfig.java) example for more information.
157
239
158
-
4.2) **Without Retrofit**
240
+
5.2) **Without Retrofit**
159
241
160
-
`NextcloudAPI` provides a method called `performNetworkRequest(NextcloudRequest request)` that allows you to handle the server response yourself.
242
+
`NextcloudAPI` provides a method called `performNetworkRequest(NextcloudRequest request)` that allows you to handle the server response yourself.
161
243
162
-
```java
244
+
```java
163
245
public class MyActivity extends AppCompatActivity {
0 commit comments