Friday, December 9, 2011

Android Homebrew Recipe Viewer

I have started a simple android app to provide electronic colourful labels/recipes for Homebrew. This has been an exercise in learning something more than anything else.

The idea is that with a web-page/qr code added to a bottle of homebrew a user could look to find details about the recipe. Ideas are to integrate with something to get feedback (ratings/reviews for when beer is left). If this was to go further there would need to be a web based view for those without android (I'm unlikely to pay $99/year to develop for IOS).
I might even get my brewing process software robust enough that the process could be published alongside the recipe for someone else to replicate. Given this has been a learning exercise how much motivation is left remains to be seen.

The app is fairly simple it takes reacts to an Intent providing a url to a BeerXMLv2 recipe file. There is an "extension" stanza adding a few extra bits of information.. longer term there should be a better answer.

An intent can be set as a link in a webpage, i.e. <a href="net.collie.mellon.recipeviewer://recipeviewer/recipeurl/">find recipe here</a>.
The recipeurl is a base64 encoded string providing the location of the recipe xml.

It would be nice to detect the useragent, if it's an android device link to the market or launch the application. I've got a few thoughts in that area but nothing robust yet.

1:  <?xml version="1.0" encoding="UTF-8"?>  
2:  <beer_xml xmlns="urn:beerxml:v2" xmlns:ferm="urn:beerxml:fermentable:v2" xmlns:hop="urn:beerxml:hop:v2" xmlns:step="urn:beerxml:mash:step:v2" xmlns:mash="urn:beerxml:mash:v2" xmlns:misc="urn:beerxml:miscellaneous:v2" xmlns:rec="urn:beerxml:recipe:v2" xmlns:style="urn:beerxml:style:v2" xmlns:unit="urn:beerxml:unit:v2" xmlns:water="urn:beerxml:water:v2" xmlns:yeast="urn:beerxml:yeast:v2" xmlns:xsi="" xsi:schemaLocation="urn:beerxml:v2 BeerXML.v2.xsd"     xmlns:extension="urn:aaa:extension">  
3:       <version>2.06</version>  
4:       <recipes>  
5:            <recipe>  
6:                 <rec:name>WV Bitter</rec:name>  
7:                 <rec:type>All-Grain</rec:type>  
8:                 <rec:author> </rec:author>  
9:                 <rec:batch_size volume="l">21</rec:batch_size>  
10:                 <rec:boil_size volume="l">0.0</rec:boil_size>  
11:                 <rec:boil_time duration="min">60.0</rec:boil_time>  
12:                 <rec:efficiency>68.0</rec:efficiency>  
13:                 <rec:style>  
14:                      <style:name>None</style:name>  
15:                 </rec:style>  
16:                 <rec:ingredients>  
17:                      <rec:grain_bill>  
18:                           <ferm:addition>  
19:                                <ferm:name>Maris Otter</ferm:name>  
20:                                <ferm:type>grain</ferm:type>  
21:                                <ferm:amount mass="g">4852.6</ferm:amount>  
22:                           </ferm:addition>  
23:                           <ferm:addition>  
24:                                <ferm:name>Crystal 120</ferm:name>  
25:                                <ferm:type>grain</ferm:type>  
26:                                <ferm:amount mass="g">485.3</ferm:amount>  
27:                           </ferm:addition>  
28:                           <ferm:addition>  
29:                                <ferm:name>Torrified Wheat</ferm:name>  
30:                                <ferm:type>grain</ferm:type>  
31:                                <ferm:amount mass="g">388.2</ferm:amount>  
32:                           </ferm:addition>  
33:                      </rec:grain_bill>  
34:                      <rec:adjuncts>  
35:                           <misc:addition>  
36:                                <misc:name>Honey</misc:name>  
37:                                <misc:type></misc:type>  
38:                                <misc:amount mass="g">320.3</misc:amount>  
39:                           </misc:addition>  
40:                      </rec:adjuncts>  
41:                      <rec:hop_bill>  
42:                           <hop:addition>  
43:                                <hop:name>Northdown</hop:name>  
44:                                <hop:form>leaf</hop:form>  
45:                                <hop:alpha_acid_units>8.60</hop:alpha_acid_units>  
46:                                <hop:amount mass="g">19.2</hop:amount>  
47:                                <hop:use>boil</hop:use>  
48:                                <hop:time duration="min">60.0</hop:time>  
49:                           </hop:addition>  
50:                           <hop:addition>  
51:                                <hop:name>Challenger</hop:name>  
52:                                <hop:form>leaf</hop:form>  
53:                                <hop:alpha_acid_units>8.50</hop:alpha_acid_units>  
54:                                <hop:amount mass="g">38.5</hop:amount>  
55:                                <hop:use>boil</hop:use>  
56:                                <hop:time duration="min">60.0</hop:time>  
57:                           </hop:addition>  
58:                           <hop:addition>  
59:                                <hop:name>Northdown</hop:name>  
60:                                <hop:form>leaf</hop:form>  
61:                                <hop:alpha_acid_units>8.60</hop:alpha_acid_units>  
62:                                <hop:amount mass="g">19.2</hop:amount>  
63:                                <hop:use>boil</hop:use>  
64:                                <hop:time duration="min">15.0</hop:time>  
65:                           </hop:addition>  
66:                           <hop:addition>  
67:                                <hop:name>Saaz</hop:name>  
68:                                <hop:form>leaf</hop:form>  
69:                                <hop:alpha_acid_units>3.80</hop:alpha_acid_units>  
70:                                <hop:amount mass="g">18.0</hop:amount>  
71:                                <hop:use>boil</hop:use>  
72:                                <hop:time duration="min">15.0</hop:time>  
73:                           </hop:addition>  
74:                           <hop:addition>  
75:                                <hop:name>Saaz</hop:name>  
76:                                <hop:form>leaf</hop:form>  
77:                                <hop:alpha_acid_units>3.80</hop:alpha_acid_units>  
78:                                <hop:amount mass="g">18.0</hop:amount>  
79:                                <hop:use>boil</hop:use>  
80:                                <hop:time duration="min">0.0</hop:time>  
81:                           </hop:addition>  
82:                      </rec:hop_bill>  
83:                      <rec:yeast_additions>  
84:                           <yeast:addition>  
85:                                <yeast:name>Yeast Slurry</yeast:name>  
86:                                <yeast:amount volume="g">11.0</yeast:amount>  
87:                           </yeast:addition>  
88:                      </rec:yeast_additions>  
89:                 </rec:ingredients>  
90:                 <rec:notes>A bitter which will be brewed to start using some old hops.</rec:notes>  
91:                 <rec:original_gravity>1.0512</rec:original_gravity>  
92:                 <rec:final_gravity>1.0138</rec:final_gravity>  
93:            </recipe>  
94:       </recipes>  
95:       <extension>          <brewDate>1318586400</brewDate>          <bottleDate>1319972400</bottleDate>          <extension:actualOg>1.0500</extension:actualOg>          <extension:breweryName>Wards View Brewing</extension:breweryName>          <extension:brewcost>19.21</extension:brewcost>  
96:       </extension>  
97:  </beer_xml>