Skip to content

Commit df66996

Browse files
authored
Merge pull request #13 from the-commons-project/btseytlinTCP-readmepatch-1-1
Update README for 1.6.4
2 parents 2796657 + a7b9f02 commit df66996

File tree

1 file changed

+38
-119
lines changed

1 file changed

+38
-119
lines changed

README.md

+38-119
Original file line numberDiff line numberDiff line change
@@ -36,61 +36,33 @@ implementation "org.thecommonsproject:commonhealth-common:1.6.4"
3636
implementation "org.thecommonsproject:commonhealth-client:1.6.4"
3737
```
3838

39-
The release artifacts are made avalable via the Maven Central repository, so you will need to have the following in your list of dependency repositories:
39+
The release artifacts are made avalable via the Maven Central repository and some dependencies are in Jitpack, so you will need to have the following in your list of dependency repositories (probably settings.gradle):
4040

4141
`mavenCentral()`
4242

43-
Additionally, some dependency artifacts are served by Jitpack, so you will also need to add the following maven repository:
44-
4543
`maven { url "https://jitpack.io" }`
4644

4745
### Manifest Placeholders
4846

49-
The interapplication data sharing functionality of CommonHealth leverages native Android communication components. The CommonHealth Client SDK defines the following activities, services, and receivers in its `manifest.xml` file, which will be merged into the application's manifest during the build process:
47+
Our authorization process is inspired by OAuth and requires that the `RedirectUriReceiverActivity` receive a redirect from CommonHealth. Applications must define the `interappAuthRedirectScheme`, `interappAuthRedirectHost`, and `interappAuthRedirectPath` manifest placeholders in the app's `build.gradle` file, and the compiled URL must match the `authorizationCallbackUri` in the `CommonHealthStoreConfiguration` object (see below). For example, defining the following manifest placeholders in `app/build.gradle`:
5048

5149
```
52-
<activity android:name=".AuthorizationManagementActivity"
53-
android:exported="false"
54-
android:theme="@style/Theme.AppCompat.NoActionBar"
55-
android:launchMode="singleTask" />
56-
57-
<activity android:name=".RedirectUriReceiverActivity" android:exported="true">
58-
<intent-filter>
59-
<action android:name="android.intent.action.VIEW"/>
60-
<category android:name="android.intent.category.DEFAULT"/>
61-
<category android:name="android.intent.category.BROWSABLE"/>
62-
<data
63-
android:host="${interappAuthRedirectHost}"
64-
android:pathPrefix="${interappAuthRedirectPath}"
65-
android:scheme="${interappAuthRedirectScheme}" />
66-
</intent-filter>
67-
</activity>
68-
69-
<service
70-
android:name="org.thecommonsproject.android.commonhealthclient.service.IdentityTokenJobIntentService"
71-
android:exported="false"
72-
android:permission="android.permission.BIND_JOB_SERVICE"/>
73-
74-
<receiver
75-
android:name="org.thecommonsproject.android.commonhealthclient.service.IdentityTokenBroadcastReceiver"
76-
android:exported="true">
77-
<intent-filter>
78-
<action android:name="org.thecommonsproject.android.common.interapp.identitytoken.broadcastreceiver.action.IDENTITY_TOKEN_REQUEST" />
79-
</intent-filter>
80-
</receiver>
81-
```
82-
83-
Our authorization process is inspired by OAuth and requires that the `RedirectUriReceiverActivity` receive a redirect from CommonHealth. Applications must define the `interappAuthRedirectScheme`, `interappAuthRedirectHost`, and `interappAuthRedirectPath` manifest placeholders in the app's `build.gradle` file, and the compiled URL must match the `authorizationCallbackUri` in the `CommonHealthStoreConfiguration` object (see below). For example, defining the following manifest placeholders in your `build.gradle` file:
50+
android {
51+
defaultConfig {
52+
...
53+
manifestPlaceholders.interappAuthRedirectScheme = "YOUR FULL APP PACKAGE" // ex: org.thecommonsproject.android.commonhealth.sampleapp
54+
manifestPlaceholders.interappAuthRedirectHost = "interapp"
55+
manifestPlaceholders.interappAuthRedirectPath = "/redirect"
56+
buildConfigField("String", "APPLICATION_ID", "\"YOUR FULL APP PACKAGE\"")
57+
...
58+
}
59+
}
8460
85-
```
86-
manifestPlaceholders.interappAuthRedirectScheme = "org.thecommonsproject.android.commonhealth.sampleapp"
87-
manifestPlaceholders.interappAuthRedirectHost = "interapp"
88-
manifestPlaceholders.interappAuthRedirectPath = "/redirect"
8961
```
9062

9163
Translates to `org.thecommonsproject.android.commonhealth.sampleapp://interapp/redirect`
9264

93-
## Initialization
65+
## Initialization
9466

9567
### CommonHealthStore Configuration
9668

@@ -116,12 +88,12 @@ val notificationPreferences = NotificationPreferences(
11688
}
11789
)
11890
val configuration = CommonHealthStoreConfiguration(
119-
appId = BuildConfig.APPLICATION_ID,
120-
commonHealthAppId = "org.thecommonsproject.android.phr.developer",
91+
appId = BuildConfig.APPLICATION_ID, //
92+
commonHealthAppId = "YOUR FULL PACKAGE NAME",
12193
developerModeEnabled = true,
12294
attestationServiceConfiguration = null,
123-
commonHealthAuthorizationUri = "org.thecommonsproject.android.phr://interapp/auth",
124-
authorizationCallbackUri = "org.thecommonsproject.android.commonhealth.sampleapp://interapp/redirect",
95+
commonHealthAuthorizationUri = "org.thecommonsproject.android.phr.developer://interapp/auth", // remove ".developer" for production
96+
authorizationCallbackUri = "YOUR FULL PACKAGE NAME://interapp/redirect",
12597
notificationPreferences = notificationPreferences
12698
)
12799
```
@@ -130,11 +102,11 @@ Note that the the `interappAuthRedirectScheme`, `interappAuthRedirectHost`, and
130102

131103
In order to store the keys required to secure the connection(s) with the CommonHealth application, the client application must also provide a secure implementation of the `NamespacedKeyValueStore` interface. This object persists the stored values across application launches.
132104

133-
The `common` module provides a `NamespacedKeyValueStore` implementation that utilizes the Android Room architecture component. If you're not using Android Room for persistence, you can provide an implementation using the persistence method of your choosing.
105+
The `common` module provides a `NamespacedKeyValueStore` implementation that utilizes the Android Room architecture component. If you're not using Android Room for persistence, you can provide an implementation using the persistence method of your choosing.
134106

135107
To help with security, the `common` module provides `SecureNamespacedKeyValueStore` to automatically encrypt and decrypt values. This class leverages the Google Tink encryption library and a key stored in the Android Keystore.
136108

137-
The `SampleApplication` class contains the following code to create a `SecureNamespacedKeyValueStore`:
109+
The `SampleApplication` class contains the following code (including helper methods like createDatabase) to create a `SecureNamespacedKeyValueStore`:
138110

139111
```
140112
val cryptoProvider = DefaultCryptoProvider(DefaultAndroidKeystoreClientWrapper())
@@ -164,14 +136,30 @@ You'll likely notice that many of the interface methods require a `connectionAli
164136

165137
### Check that CommonHealth is available
166138

139+
Declare <queries> in `Android Manifest.xml` the package that will be launched.
140+
141+
```
142+
<manifest>
143+
144+
<application>
145+
...
146+
</application>
147+
<queries>
148+
<package android:name="org.thecommonsproject.android.phr.developer"/>
149+
</queries>
150+
151+
</manifest>
152+
```
153+
154+
167155
The `CommonHealthStore` class provides the `getCommonHealthAvailability` method that can help determine how (or how not) to interact with CommonHealth:
168156

169157
```
170158
val chStore = CommonHealthStore.getSharedInstance()
171159
val chAvailability = chStore.getCommonHealthAvailability(context)
172160
when(chAvailability) {
173-
CommonHealthAvailability.NOT_INSTALLED -> { } // show install UX
174-
CommonHealthAvailability.ACCOUNT_NOT_CONFIGURED_FOR_SHARING -> { } // this can indicate that a user has disabled sharing entirely or that their device is unsuitable for sharing (ex. device is rooted)
161+
CommonHealthAvailability.NotInstalled -> { } // show install UX
162+
CommonHealthAvailability.NotConfiguredForSharing -> { } // this can indicate that a user has disabled sharing entirely or that their device is unsuitable for sharing (ex. device is rooted)
175163
CommonHealthAvailability.AVAILABLE -> { } // Suitable for authorization or querying if consent has been given
176164
}
177165
```
@@ -278,7 +266,7 @@ val authorizationRequest = AuthorizationRequest(
278266
"Sample app would like to read your labs, vitals, and conditions."
279267
)
280268
281-
val intent = AuthorizationManagementActivity.createStartForResultIntent(
269+
val authIntent = AuthorizationManagementActivity.createStartForResultIntent(
282270
context,
283271
authorizationRequest
284272
)
@@ -389,72 +377,3 @@ CommonHealth performs SMART® Health Card validation prior to ingesting the card
389377
## Registering with CommonHealth
390378

391379
Registering with CommonHealth is not required to begin testing integrations with CommonHealth Developer Edition. However, if you have a client application that you would like to use in staging or production environments, you'll need to register the application with CommonHealth. This is similar to registering an OAuth client, where you would specify information such as required scope, authorization redirect URI, etc. Please reach out to developers [at] commonhealth.org for more information.
392-
393-
## Upgrading from v1.6.2 to v1.6.4
394-
`v1.6.4` updated our SMART IT Sandbox version:
395-
396-
- Upgraded to SMART IT Sandbox R4 from DSTU2
397-
- Make sure to use the R4 Patient Browser (listed above) rather than the previously linked DSTU2 browser for finding valid patients
398-
399-
## Upgrading from v1.3.15 to v1.6.2
400-
`v1.6.2` introduced insurance data:
401-
402-
- Support for Insurance data through the CMS Blue Button 2.0 Sandbox. This will require you to register with CMS an app with a redirect url to CommonHealth, and then for you to provide the client id/secret locally into CommonHealth so that you can download the data. Please see section "Using CMS Blue Button Sandbox" above.
403-
- Minor change to readSampleQuery(..) parameters
404-
405-
## Upgrading from v1.1.2 to v1.3.15
406-
`v1.3.15` introduced a small number of changes:
407-
408-
- Support for requesting access to Verifiable Credentials (SMART® Health Cards) is now in beta
409-
- Updates to support higher Android OS levels (specifically changes to accommodate new restrictions on apps calling into packageManager)
410-
411-
## Upgrading from v0.4.8 to v1.1.2
412-
`v1.1.2` introduced a small number of changes:
413-
414-
- The constructor for `SecureNamespacedKeyValueStore` now requires a `CryptoProvider` object.
415-
- The artifacts names have changed:
416-
- `org.thecommonsproject.commonhealth:common` is now `org.thecommonsproject:commonhealth-common`
417-
- `org.thecommonsproject.commonhealth:commonhealthclient` is now `org.thecommonsproject:commonhealth-client`
418-
- The artifacts are now hosted in Maven Central.
419-
420-
## Upgrading from v0.4.4 to v0.4.8
421-
`v0.4.8` introduced a number of large changes and enhancements to the API:
422-
423-
- CommonHealthStoreConfiguration now has a required NotificationPreferences property
424-
- AuthorizationResponses are now communicated as a notification to a subscriber contained in the CommonHealthStoreConfiguration
425-
- A new `getRecordUpdates` method was added to the CommonHealthStore to help determine changes to the data
426-
- A `NEW_DATA_AVAILABLE` notificationType is added to support receiving updates asynchronously from CommonHealth
427-
- The `isCommonHealthAvailable` method was removed in favor of the new `getCommonHealthAvailability`
428-
429-
## Upgrading from v0.4.0 to v0.4.4
430-
`v0.4.4` introduced a small number of changes to the API:
431-
432-
- Scope requests can now be limited to a specific set of codes within a data type.
433-
- The `inactive` value was added to the `CommonHealthAuthorizationStatus` enum.
434-
- The optional `fetchedAfter` parameter was added to the `readSampleQuery` interface method. This parameter can be used to limit responses to resources added or updated after a certain date.
435-
436-
Additionally, the following maven repo is now required:
437-
438-
maven { url "https://jitpack.io" }
439-
440-
## Upgrading from v0.3.0 to v0.4.0
441-
No functional changes to the API were introduced in `v0.4.0`.
442-
443-
## Upgrading from v0.2.0 to v0.3.0
444-
`v0.3.0` introduced a number of changes:
445-
446-
- Introduced the `CommonHealthAuthorizationActivityResponse` class to assist with decoding responses from `AuthorizationManagementActivity`.
447-
- Connections now timeout after 90 days. After that, the client application will need to request authorization again OR the user can also renew the connection via client application detail view in the CommonHealth application. If the connection has timed out, the `checkAuthorizationStatus` method will return `CommonHealthAuthorizationStatus.connectionExpired`.
448-
- The `readSampleQuery` performs additional validation on `before` and `after` parameters.
449-
- Public `CommonHealthStore` methods have been annotated to indicate that they throw.
450-
451-
## Upgrading from v0.1.0 to v0.2.0
452-
453-
`v0.2.0` introduced a number of changes, some of them breaking.
454-
455-
- Introduced `AuthorizationManagementActivity.USER_CANCELED` activity status code that is returned to the initiating activity in the case that the user cancels authorization.
456-
- Removed requirement that applications perform initialization on the `Tink` and `AndroidThreeTen` libraries. This also results in removing application build dependencies on these libraries.
457-
- `CommonHealthStoreConfiguration.Builder` class has been removed. Applications should create instances of this class directly.
458-
- Removed the `CommonHealthStoreProvider` interface and dependency on the custom Application implementation to adopt the interface. Implementers should instead initialize the `CommonHealthStore` singleton via the `CommonHealthStore.initialize` static method. The `CommonHealthStore.getSharedInstance` static method is provided for accessing the `CommonHealthStore` singleton.
459-
- Removed the requirement for applications to include SDK specific `service`, `broadcastreciever`, and `activity` components in the application manifest. These have been moved to the SDK manifest file and will be merged in during the build process. We've added a requirement that applications define the `interappAuthRedirectScheme`, `interappAuthRedirectHost`, and `interappAuthRedirectPath` manifest placeholders in the app's `build.gradle` file.
460-
- Replaced the `CommonHealthStore` `executeDataQuery` method with `readSampleQuery`.

0 commit comments

Comments
 (0)