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
Copy file name to clipboardExpand all lines: README.md
+100-7Lines changed: 100 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ This framework combines multipe functionalities provided by PACE i.e. authorizin
25
25
+[AppActivity](#appactivity)
26
26
+[AppWebView](#appwebview)
27
27
+[AppDrawer](#appdrawer)
28
+
+[Default AppDrawer](#default-appdrawer)
29
+
+[Custom AppDrawer](#custom-appdrawer)
28
30
+[Deep Linking](#deep-linking)
29
31
+[Native login](#native-login)
30
32
+[Removal of Apps](#removal-of-apps)
@@ -258,8 +260,8 @@ A new authorization will be required afterwards.
258
260
## AppKit
259
261
### Main features
260
262
* Get apps at the current location or by URL
261
-
* Shows an `AppDrawer` for each app
262
-
* Opens the app in the `AppActivity` (recommended) or `AppWebView`
263
+
* Shows an [AppDrawer](#appdrawer) for each app
264
+
* Opens the app in the [AppActivity](#appactivity) (recommended) or [AppWebView](#appwebview)
263
265
* Checks if there is an app for the given POI ID at the current location
264
266
265
267
### Setup
@@ -353,7 +355,8 @@ The *AppKit* contains a default `Activity` which can be used to display an app.
353
355
Moreover the *AppKit* contains a default `AppWebView`. To display an app in this WebView you have to call `AppWebView.loadApp(parent: Fragment, url: String)`. The `AppWebView`s parent needs to be a fragment as that's the needed context for the integrated `Android Biometric API`.
354
356
355
357
### AppDrawer
356
-
The `AppDrawer` is an expandable button that can be used to display an app. It shows an icon in collapsed state and additionally a title and subtitle in expanded state. By default it will be opened in expanded mode. To fade in the button with an animation, use `appDrawer.show()`. The AppDrawer will be removed if the app is not returned on the next App check again.
358
+
#### Default AppDrawer
359
+
The default `AppDrawer` is an expandable button that can be used to display an app. It shows an icon in collapsed state and additionally a title and subtitle in expanded state. By default it will be opened in expanded mode. To fade in the button with an animation, use `appDrawer.show()`. The `AppDrawer` will be removed if the app is not returned on the next App check again.
357
360
358
361
**_Note:_** You need to call `AppKit.requestLocalApps(...)` periodically to make sure that Apps get closed when they are not longer available. This can be done when the app comes into the foreground or the location changes.
The *AppKit* will now create an `AppDrawer` for each app in `apps` and add it to the given `parentLayout`.
374
-
Clicking on the button opens the `AppActivity` with the app in the `AppWebView`.
377
+
Clicking on the button opens the [AppActivity](#appactivity) with the app in the [AppWebView](#appwebview).
375
378
376
379
##### Static example
377
380
```xml
@@ -398,11 +401,101 @@ fun showAppDrawer(app: App) {
398
401
}
399
402
```
400
403
404
+
#### Custom AppDrawer
405
+
If you don't want to use the [default AppDrawer](#default-appdrawer), you can also create your own app drawer/button. To create a custom app drawer/button you need the `App` object that you can request from the *AppKit* using the `AppKit.requestLocalApps()`, `AppKit.requestApps()` or `AppKit.fetchAppsByUrl(...)` methods. All texts are returned in the system language, if available. The app object consists of the following properties:
406
+
```kotlin
407
+
name:String// e.g. "PACE Connected Fueling"
408
+
shortName:String// e.g. "Connected Fueling"
409
+
description:String?// e.g. "Pay at the pump"
410
+
url:String// App URL
411
+
logo:Bitmap?// App logo e.g. from the gas station
412
+
iconBackgroundColor:String?// App icon/logo background color e.g. #57C2E4
413
+
textBackgroundColor:String?// App background color e.g. #222424
414
+
textColor:String?// App text color e.g. #121414
415
+
display:String?// Not relevant
416
+
gasStationId:String?// Referenced gas station ID, if available
417
+
```
418
+
419
+
You can now display this data in your own views, e.g. your app drawer/button consists of a **title**, **description** and **icon** as in the following XML layout:
The texts and the icon of the above views can now be set programmatically. When clicking the app drawer/button the app is opened in the [AppActivity](#appactivity) via `AppKit.openAppActivity(...)`:
473
+
```kotlin
474
+
AppKit.requestLocalApps { app ->
475
+
name.text = app.name
476
+
description.text = app.description
477
+
app.textColor?.let {
478
+
val textColor =Color.parseColor(it) // Parses hex color string to color int
**Note**: For a more detailed example, where the apps are displayed in a `RecyclerView`, see the `PACECloudSDK` example app.
493
+
401
494
### Deep Linking
402
495
Some of our services (e.g. `PayPal`) do not open the URL in the WebView, but in a Chrome Custom Tab within the app, due to security reasons. After completion of the process the user is redirected back to the WebView via deep linking. In order to set the redirect URL correctly and to ensure that the client app intercepts the deep link, the following requirements must be met:
403
496
404
497
* Set `clientId` in *PACECloudSDK's* configuration during the [setup](#setup), because it is needed for the redirect URL
405
-
* Specify the `AppActivity` as deep link intent filter in your app manifest. **`pace.${clientId}` (same `clientId` as passed in the configuration) must be passed to `android:scheme`:**
498
+
* Specify the [AppActivity](#appactivity) as deep link intent filter in your app manifest. **`pace.${clientId}` (same `clientId` as passed in the configuration) must be passed to `android:scheme`:**
406
499
* If the scheme is not set, the *AppKit* calls the `onCustomSchemeError(context: Context?, scheme: String)` callback
407
500
408
501
```xml
@@ -460,6 +553,6 @@ AppKit.INSTANCE.openAppActivity(context, url, true, false, new AppCallbackImpl()
460
553
```
461
554
462
555
### Removal of Apps
463
-
In case you want to remove the `AppActivity`, simply call `AppKit.closeAppActivity()`.
556
+
In case you want to remove the [AppActivity](#appactivity), simply call `AppKit.closeAppActivity()`.
464
557
465
-
If you want to remove all `AppDrawer`s*and* the `AppActivity` (only if it was started with `autoClose =true`), you can call the `AppKit.closeApps(buttonContainer:ConstraintLayout)` method and pass your `ConstraintLayout` where you've added the `AppDrawer`s to (see [AppDrawer](#appdrawer)).
558
+
If you want to remove all [AppDrawers](#appdrawer)*and* the [AppActivity](#appactivity) (only if it was started with `autoClose =true`), you can call the `AppKit.closeApps(buttonContainer:ConstraintLayout)` method and pass your `ConstraintLayout` where you've added the `AppDrawer`s to (see [AppDrawer](#appdrawer)).
0 commit comments