tagged: hockeyapp

HockeyApp: Generating release notes from git

The problem with uploading to HockeyApp is the release notes are not automatically created.
And we can create them by looking at all the git commit logs since the last build.
For this to happen we need to know what the last commit was.
Although we can specify this in our upload, when we query the builds we can't get this information back. Instead, we'll add the commit SHA to the release notess.
Our plan will be
  1. Look at the app versions via HockeyApp's API
  2. Find the lastest version
  3. Look at the release notes that and retrieve our added commit SHA
  4. Make git output all our commit logs since then
  5. Make release notes out of that (including the current git commit)
Here's the entire commented shell script:

# We need an initial bullet point for our list of commit logs
echo -n "* "
# Get the latest app uploads
curl -H "X-HockeyAppToken: $HOCKEYAPP_TOKEN" \
"https://rink.hockeyapp.net/api/2/apps/YOUR_HOCKEYAPP_APP_ID/app_versions?page=1" | \
# Put every property on a separate line
sed 's/,/\n/g' | \
# Remove all the quotation marks
sed 's/"//g' | \
# Look at only the notes properties
grep notes | \
# Look at the first one, i.e. the latest app upload
head -n 1 | \
# Find the commit information at the bottom of the notes
sed -n 's/.*(commit:\([^)]*\)).*/\1/p' | \
# Let's find all the logs since that commit
xargs -I '{}' git log {}..HEAD --pretty=format:'%s' --no-merges | \
# Add a star to each newline to make the list
awk '$0="* "$0'
# The end of the revision log must have the latest commit
# This is so later we can do the above again
echo -n "* (commit:" 
git rev-parse HEAD | xargs echo -n
echo -n ')'

And when we upload to HockeyApp, via travis-ci, we can include it like so:

- bash release_notes_for_hockeyapp.sh > release_notes
- >
  -F "status=2"
  -F "notify=1"
  -F "notes=<release_notes"
  -F "notes_type=0"
  -F "ipa=@app/build/outputs/apk/YOUR_APK.apk"
  -H "X-HockeyAppToken: $HOCKEYAPP_TOKEN"

hockeyapp git travis-ci

Android: Continuous Deployment with HockeyApp

Continuous Deployment is automatically distributing new app to your testers, and automatically reporting crashes. This guide shows you how to use HockeyApp for the distribution aspect.
I'm going to assume you've got a basic Android App in development.
  1. First, sign up to https://HockeyApp.net
  2. Click add new app, and choose to add it manually
  3. Give it the same package name as appears in your AndroidManifest.xml
  4. Now it's created, click on integrate HockeyApp quick tutorial. It will tell you add these parts to your app:
      repositories {
      android {
        defaultConfig {
          manifestPlaceholders = [HOCKEYAPP_APP_ID: "IT_WILL_TELL_YOU_YOUR_APP_ID"]
      dependencies {
        compile 'net.hockeyapp.android:HockeySDK:4.0.1'
 app/src/main/AndroidManifest.xml (within the application tag):
      <meta-data android:name="net.hockeyapp.android.appIdentifier" android:value="${HOCKEYAPP_APP_ID}" />
 In your Activity:
      public void onCreate(Bundle savedInstanceState) {
        // Your own code to create the view
        // ...
      public void onResume() {
        // ... your own onResume implementation
      public void onPause() {
      public void onDestroy() {
      private void checkForCrashes() {
      private void checkForUpdates() {
        // Remove this for store builds!
      private void unregisterManagers() {

0. Now build and install that on your phone, and upload the APK to HockeyApp via the upload version button, clicking through all the dialog boxes until you can see the version on the Overview.
0. Now change something in the app, like some text, and update the versionCode in app/build.grade. Build it, but do not install this to your device (so we can see automatic updates on our phone - you don't normally do this)
0. With this newly build version, upload it to HockeyApp as before.
Now when you open the app again, or do something to trigger onResume(), it will ask you if you want to update to the latest version.
Click update, and voila - you and your testers will see the newest app, and any crashes will be reported to you with a stacktrace and device information.
We don't yet automatically upload our APK to HockeyApp via a build server / continuous integration environment, or send up the release notes, but we can do that in a later tutorial.

android hockeyapp

Android: Upload to HockeyApp on every Travis-CI build

I assume you have setup [HockeyApp](https://newfivefour.com/android-hockeyapp-continuous-deployment.html), that you have setup [Travis-CI](https://newfivefour.com/android-setup-travis-ci.html) and that you have a build which is signed with a [constant keystore signature](https://newfivefour.com/android-debug-build-constant-signed-keystore.html).
If our build is created by the above link, we will need the CI_KEYSTORE_PASSWORD environmental variable to sign the build. Go to your application settings in Travis-CI and create the environmental variable. (Ensure you have not toggled "display value in build log" for privacy)
Now go to account settings on the HockeyApp site, and then click API Tokens and create one with upload access to your application. With that, go to your application on Travis-CI and add another environmental variable, HOCKEYAPP_TOKEN.
Now we have HOCKEYAPP_TOKEN available in our Travis-CI environment, we can add a curl command to our .travis.yml script section to upload our signed build to HockeyApp:

  - >
    -F "status=2"
    -F "notify=1"
    -F "notes=Some new features and fixed bugs."
    -F "notes_type=0"
    -F "ipa=@app/build/outputs/apk/YOUR_SIGNED_BUILD.apk"
    -H "X-HockeyAppToken: $HOCKEYAPP_TOKEN"

Now on every build, we'll upload the APK to HockeyApp, using our HOCKEYAPP_TOKEN, for distribution to our testers.
Note: We are not automatically updating the android versionCode, although putting versionCode System.getenv("TRAVIS_BUILD_NUMBER") as Integer ?: 999 will do that, and the version notes are static, which we can approach in another tutorial.

travis-ci hockeyapp android

HockeyApp: Get date of last upload

You may want to find out when the last date of the last upload was.
With this data, you may want to use git to find all the last commits from that date, for example.
Get the last uploads with this:

curl   -H "X-HockeyAppToken: $MY_TOKEN" "https://rink.hockeyapp.net/api/2/apps/YOURAPPID/app_versions"

Then use sed, grep and head on that to convert the ,s to line breaks, remove the qutotation marks, find the created_at lines, list only the first therefore more recent one, and then remove everyting put the date:

cat a | sed 's/,/\n/g' | sed 's/"//g' | grep created_at | head -n 1 | sed 's/created_at://'

You should then have something like 2016-08-12T10:40:46Z which you have pass to git log --since.


Page 1 of 1