Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Jpmobile
Lay Rails on “Galapagos”
Jpmobile: A Rails Plugin for Japanese Mobile Phones
œ {Ruby             c200 8   Sf[^



   œ { Œ ^ Cg       Ł




   œ { Œ ^ Cg   ¨




   œ { Œ ^ Cg       Ł


             ...
The Market of Japanese Cellphones
                          œ {Ruby             c200 8   Sf[^




has evolved Exclusively,...
Japanese mobile phones have a lot of
fascinating features ...




                           œ {Ruby              c200 8  ...
However, these features are provided
with Cell-phone-operator-specific
specifications,




                           œ {Rub...
which is sometimes undocumented.




                          œ {Ruby              c200 8   Sf[^



                     ...
Example.
Requesting GPS location of device:




                         œ {Ruby              c200 8   Sf[^



           ...
for DoCoMo:
<a href=quot;[URL]quot; lcs>GPS</a>
for au:
<a href=quot;device:gpsone?url=
[URL]&amp;ver=1&amp;datum=0&amp;un...
Of course, the responses are also in
various formats!




                             œ {Ruby              c200 8   Sf[^
...
I guess you shouldn’t want to know
them!




                           œ {Ruby              c200 8   Sf[^



            ...
In short,




            œ {Ruby              c200 8   Sf[^



            œ { Œ ^ Cg       Ł




            œ { Œ ^ Cg ...
working on websites for Japanese
mobiles is




                           œ {Ruby              c200 8   Sf[^



         ...
collecting boring “know-hows.”




                           œ {Ruby              c200 8   Sf[^



                      ...
But we cannot give up the fascinating
features of Japanese mobile phones ...




                            œ {Ruby      ...
Motivation:
want to build websites for Japanese
mobile phones in Rails way.




                           œ {Ruby        ...
My answer:




             œ {Ruby              c200 8   Sf[^



             œ { Œ ^ Cg       Ł




             œ { Œ ^...
for DoCoMo:
<a href=quot;[URL]quot; lcs>GPS</a>
for au:
<a href=quot;device:gpsone?url=




     before
[URL]&amp;ver=1&am...
after
 for all Japanese mobiles:
<%= get_position_link_to quot;GPSquot;,
                         :action=> ... %>
       ...
Jpmobile is introduced in ...




                                œ {Ruby              c200 8   Sf[^



                  ...
Who am I?




            œ {Ruby              c200 8   Sf[^



            œ { Œ ^ Cg       Ł




            œ { Œ ^ Cg ...
SHIDARA Yohji dara
‣ Jpmobile         the author of Jpmobile
‣ http://d.hatena.ne.jp/darashi
    http://twitter.com/darash...
My recent work:




                  œ {Ruby              c200 8   Sf[^



                  œ { Œ ^ Cg       Ł




     ...
http://buzztter.com
extracts buzzphrases from twitter.com




                            œ {Ruby              c200 8   Sf...
By the way,




              œ {Ruby              c200 8   Sf[^



              œ { Œ ^ Cg       Ł




              œ {...
I love soupcurry!
(a typical Sapporo food)




                           œ {Ruby              c200 8   Sf[^



          ...
œ {Ruby              c200 8   Sf[^



œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨




œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨
œ {Ruby              c200 8   Sf[^



œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨




œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨
so that I made a website:




                            œ {Ruby              c200 8   Sf[^



                          ...
œ {Ruby              c200 8   Sf[^



                        œ { Œ ^ Cg       Ł




http://soupcurry.info
               ...
œ {Ruby              c200 8   Sf[^



                        œ { Œ ^ Cg       Ł




http://soupcurry.info
               ...
You can find the nearby soupcurry
restaurants with your mobile (using
GPS). -- if you are in Japan ;-)




                ...
You can find the nearby soupcurry
restaurants with your mobile (using
GPS). -- if you are in Japan ;-)




                ...
The reusable component dragged out
from soupcurry.info is the origin of
Jpmobile.




                            œ {Ruby ...
Features of Jpmobile




                       œ {Ruby              c200 8   Sf[^



                       œ { Œ ^ Cg   ...
Detecting mobile phones and its
operator




                            œ {Ruby              c200 8   Sf[^



           ...
is the most fundamental procedure to
handle mobile phones




                           œ {Ruby              c200 8   Sf[...
It’s not so easy ...


Various User-Agents:
‣ DoCoMo/2.0 SH902i(c100;TB;W24H12)
‣ KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI)...
with Jpmobile,




     <% if request.mobile? %>
       from mobile!
     <% else %>
       from PC!
     <% end %>       ...
case request.mobile
when Jpmobile::Mobile::Docomo
  # for DoCoMo
when Jpmobile::Mobile::Au
  # for au
when Jpmobile::Mobil...
Switching templates for mobiles




                            œ {Ruby              c200 8   Sf[^



                    ...
If you want to switch templates for PCs
and for mobiles, or for each operator,




                            œ {Ruby    ...
just put mytemplate.html.erb and
mytemplate_mobile.html.erb, or




                           œ {Ruby              c200 8...
put mytemplate_mobile_docomo.html.erb
and mytemplate_mobile_au.html.erb.
(DoCoMo and au are cell-phone-operators)




    ...
Supporse that we have these templates.




  mytemplate_mobile_docomo.html.erb


  mytemplate_mobile.html.erb
            ...
Access from PC:




  mytemplate_mobile_docomo.html.erb


  mytemplate_mobile.html.erb
                          œ {Ruby  ...
Access from DoCoMo:




  mytemplate_mobile_docomo.html.erb


  mytemplate_mobile.html.erb
                          œ {Ru...
Access from mobiles except DoCoMo:




  mytemplate_mobile_docomo.html.erb


  mytemplate_mobile.html.erb
                ...
Getting position of mobile-phones




                            œ {Ruby              c200 8   Sf[^



                  ...
in a view:

<%= get_position_link_to quot;GPSquot;,
                       :action=> :gps %>

in a controller, ‘gps’ actio...
Getting production-numbers and/or
subscriber-identifiers.




                          œ {Ruby              c200 8   Sf[^
...
It should be frustrating to input the
password with your mobile every time
you are going to login.




                   ...
Usually the identifier of the device or
the subscriber can be obtained.




                             œ {Ruby           ...
Of course they are based on the various
specifications!




                            œ {Ruby              c200 8   Sf[^
...
with Jpmobile,




request.mobile.ident_device
request.mobile.ident_subscriber

request.mobile.ident
 = ident_subscriber |...
Note that they are not creditable
because these identifiers are just
passed as plain text.




                            ...
The security will be slightly improved
with combining IP-address verification.




                            œ {Ruby     ...
Validation of IP-address range




                            œ {Ruby              c200 8   Sf[^



                     ...
We may want to block PCs for some
(marketing?) reasons,




                          œ {Ruby              c200 8   Sf[^

...
or we may want to check if the
identifiers (for a device or a subscribe)
is surely passed from mobile.




                ...
The operators provides the information
of the IP-address ranges on the website




                            œ {Ruby    ...
of course in various formats, and even
worse, usually they are not machine
readable (dirty scraping is needed).




      ...
Since Jpmobile contains the tables
obtained from these machine-unfriendly
websites,




                           œ {Ruby...
Just do




     request.mobile.valid_ip?


                        œ {Ruby              c200 8   Sf[^



                ...
Adding session IDs to URL and FORM




                           œ {Ruby              c200 8   Sf[^



                  ...
Some devices does not support cookies.




                           œ {Ruby              c200 8   Sf[^



              ...
For them, you need to pass the session
ID via URL and FORM parameters.




                            œ {Ruby            ...
class MyController <
           ApplicationController
  trans_sid
end
                        œ {Ruby              c200 8 ...
Getting specs of the screen




                              œ {Ruby              c200 8   Sf[^



                      ...
The screensize differs according to the
model.




                             œ {Ruby              c200 8   Sf[^



    ...
In order to optimize the output, we
need the information about the screen.




                            œ {Ruby        ...
The information may be passed via
HTTP header, or not.




                           œ {Ruby              c200 8   Sf[^

...
We need to scrape the official websites
in case that the information in the
header is not available.




                  ...
request.mobile.display.colors
request.mobile.display.width
request.mobile.display.height

                      œ {Ruby   ...
Conversion of the Emoticons




                              œ {Ruby              c200 8   Sf[^



                      ...
Lots of lovely emoticons are available
in Japanese mobiles.




                             œ {Ruby              c200 8  ...
Each operator have own set of
emoticons and own encoding.




                           œ {Ruby              c200 8   Sf[...
The specifications are so complex that I
can make another presentation.




                             œ {Ruby           ...
The mappings (between operators) are
also complex and not publicly available
in machine-readable format.




             ...
Jpmobile maps all emoticons (of all
operators) into Unicode Private Area,
and




                            œ {Ruby     ...
the output is transparently converted
into the format appropriate for the
target device.




                            œ...
in a controller:


class MyController <
            ApplicationController
  mobile_filter
end
                        œ {R...
I’m going to add the feature to send
emoticons PCs with embedding images.




                          œ {Ruby           ...
Some mobiles do not support UTF-8 or
stop sending emoticons under UTF-8
communication.




                           œ {R...
We need to communicate with them in
Shift-JIS (a legacy but one of the most
commonly used encoding).




                 ...
in a controller:


class MyController <
            ApplicationController
  mobile_filter
end
                        œ {R...
Summary:




           œ {Ruby              c200 8   Sf[^



           œ { Œ ^ Cg       Ł




           œ { Œ ^ Cg   ¨
...
Japanese mobile phones have a lot of
fascinating features.




                           œ {Ruby              c200 8   Sf...
But we need lots of boring know-hows
to build websites for Japanese mobile
phones.




                           œ {Ruby ...
Jpmobile helps you!




                      œ {Ruby              c200 8   Sf[^



                      œ { Œ ^ Cg      ...
Finally, I want to ask your help:




                              œ {Ruby              c200 8   Sf[^



                ...
I’m a student, so I don’t have many
mobile-phones to test Jpmobile on.




                            œ {Ruby            ...
I often ask my colleagues for help,
paying a canned coffee.




                             œ {Ruby              c200 8  ...
So, if you find out some problems or if
you make any improvement of
Jpmobile, please let me know.




                     ...
It may take long, but I’d like to work
on it.




                             œ {Ruby              c200 8   Sf[^



     ...
œ {Ruby              c200 8   Sf[^



                        œ { Œ ^ Cg       Ł




                        œ { Œ ^ Cg   ...
œ {Ruby              c200 8   Sf[^



œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨




œ { Œ ^ Cg       Ł




œ { Œ ^ Cg   ¨
Upcoming SlideShare
Loading in …5
×

ガラパゴスに線路を敷こう: 携帯電話用RailsプラグインJpmobile

4,704 views

Published on

Published in: Business
  • Be the first to comment

ガラパゴスに線路を敷こう: 携帯電話用RailsプラグインJpmobile

  1. 1. Jpmobile Lay Rails on “Galapagos” Jpmobile: A Rails Plugin for Japanese Mobile Phones
  2. 2. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł Photo taken by Kath B http://flickr.com/photos/kathb/2196643434/ œ { Œ ^ Cg ¨
  3. 3. The Market of Japanese Cellphones œ {Ruby c200 8 Sf[^ has evolved Exclusively, œ { Œ ^ Cg Ł just like Galapagos. œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł Photo taken by Kath B http://flickr.com/photos/kathb/2196643434/ œ { Œ ^ Cg ¨
  4. 4. Japanese mobile phones have a lot of fascinating features ... œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  5. 5. However, these features are provided with Cell-phone-operator-specific specifications, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  6. 6. which is sometimes undocumented. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  7. 7. Example. Requesting GPS location of device: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  8. 8. for DoCoMo: <a href=quot;[URL]quot; lcs>GPS</a> for au: <a href=quot;device:gpsone?url= [URL]&amp;ver=1&amp;datum=0&amp;unit=0 quot;>GPS</a> (officially undocumented) for SoftBank 3G: <a href=location:auto?[URL]>GPS</a> for SoftBank 2G: <a href=quot;[URL]quot; z>GPS</a> œ {Ruby c200 8 Sf[^ for Willcom: œ { Œ ^ Cg Ł <a href=quot;http://location.request/ œ { Œ ^ Cg ¨ dummy.cgi?my=[URL]&pos=$locationquot;>GPS</a> œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  9. 9. Of course, the responses are also in various formats! œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  10. 10. I guess you shouldn’t want to know them! œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  11. 11. In short, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  12. 12. working on websites for Japanese mobiles is œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  13. 13. collecting boring “know-hows.” œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  14. 14. But we cannot give up the fascinating features of Japanese mobile phones ... œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  15. 15. Motivation: want to build websites for Japanese mobile phones in Rails way. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  16. 16. My answer: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  17. 17. for DoCoMo: <a href=quot;[URL]quot; lcs>GPS</a> for au: <a href=quot;device:gpsone?url= before [URL]&amp;ver=1&amp;datum=0&amp;unit=0 quot;>GPS</a> (officially undocumented) for SoftBank 3G: <a href=location:auto?[URL]>GPS</a> for SoftBank 2G: <a href=quot;[URL]quot; z>GPS</a> œ {Ruby c200 8 Sf[^ for Willcom: œ { Œ ^ Cg Ł <a href=quot;http://location.request/ œ { Œ ^ Cg ¨ dummy.cgi?my=[URL]&pos=$locationquot;>GPS</a> œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  18. 18. after for all Japanese mobiles: <%= get_position_link_to quot;GPSquot;, :action=> ... %> œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  19. 19. Jpmobile is introduced in ... œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  20. 20. Who am I? œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  21. 21. SHIDARA Yohji dara ‣ Jpmobile the author of Jpmobile ‣ http://d.hatena.ne.jp/darashi http://twitter.com/darashi in Japanese) ‣ born in Sapporo, live in Sapporo, love Sapporo -- 1.5hrs. from Tokyo by air œ {Ruby c200 8 Sf[^ ‣ a graduate studentœ { Œ ^ Cg Ł ‣ Ruby Sapporo Staff œ { Œ ^ Cg ¨ ‣ RubyKaigi2008 Staff œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  22. 22. My recent work: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  23. 23. http://buzztter.com extracts buzzphrases from twitter.com œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  24. 24. By the way, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  25. 25. I love soupcurry! (a typical Sapporo food) œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  26. 26. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  27. 27. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  28. 28. so that I made a website: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  29. 29. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł http://soupcurry.info œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  30. 30. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł http://soupcurry.info œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  31. 31. You can find the nearby soupcurry restaurants with your mobile (using GPS). -- if you are in Japan ;-) œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  32. 32. You can find the nearby soupcurry restaurants with your mobile (using GPS). -- if you are in Japan ;-) œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  33. 33. The reusable component dragged out from soupcurry.info is the origin of Jpmobile. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  34. 34. Features of Jpmobile œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  35. 35. Detecting mobile phones and its operator œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  36. 36. is the most fundamental procedure to handle mobile phones œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  37. 37. It’s not so easy ... Various User-Agents: ‣ DoCoMo/2.0 SH902i(c100;TB;W24H12) ‣ KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0 ‣ SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/ NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 ‣ Vodafone/1.0/V903SH/SHJ001/SN000000000000000 Browser/UP.Browser/7.0.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext- V-Profile/VSCL-2.0.0 œ {Ruby c200 8 Sf[^ ‣ J-PHONE/4.3/V603SH/SNXXXX0000000 SH/0007aa Profile/ œ { Œ ^ Cg Ł MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/ JSCL-1.3.2 œ { Œ ^ Cg ¨ ‣ Mozilla/3.0(WILLCOM;KYOCERA/WX310K/ 2;1.2.2.16.000000/0.1/C100) Opera 7.0 œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  38. 38. with Jpmobile, <% if request.mobile? %> from mobile! <% else %> from PC! <% end %> œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  39. 39. case request.mobile when Jpmobile::Mobile::Docomo # for DoCoMo when Jpmobile::Mobile::Au # for au when Jpmobile::Mobile::Softbank # for SoftBank when Jpmobile::Mobile::Willcom # for Willcom when Jpmobile::Mobile::Emobile # for EMOBILE œ {Ruby c200 8 Sf[^ else œ { Œ ^ Cg Ł # for PC œ { Œ ^ Cg ¨ end œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  40. 40. Switching templates for mobiles œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  41. 41. If you want to switch templates for PCs and for mobiles, or for each operator, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  42. 42. just put mytemplate.html.erb and mytemplate_mobile.html.erb, or œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  43. 43. put mytemplate_mobile_docomo.html.erb and mytemplate_mobile_au.html.erb. (DoCoMo and au are cell-phone-operators) œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  44. 44. Supporse that we have these templates. mytemplate_mobile_docomo.html.erb mytemplate_mobile.html.erb œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł mytemplate.html.erb œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  45. 45. Access from PC: mytemplate_mobile_docomo.html.erb mytemplate_mobile.html.erb œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł mytemplate.html.erb œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  46. 46. Access from DoCoMo: mytemplate_mobile_docomo.html.erb mytemplate_mobile.html.erb œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł mytemplate.html.erb œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  47. 47. Access from mobiles except DoCoMo: mytemplate_mobile_docomo.html.erb mytemplate_mobile.html.erb œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł mytemplate.html.erb œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  48. 48. Getting position of mobile-phones œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  49. 49. in a view: <%= get_position_link_to quot;GPSquot;, :action=> :gps %> in a controller, ‘gps’ action: request.mobile.position.lat œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ request.mobile.position.lng œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  50. 50. Getting production-numbers and/or subscriber-identifiers. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  51. 51. It should be frustrating to input the password with your mobile every time you are going to login. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  52. 52. Usually the identifier of the device or the subscriber can be obtained. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  53. 53. Of course they are based on the various specifications! œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  54. 54. with Jpmobile, request.mobile.ident_device request.mobile.ident_subscriber request.mobile.ident = ident_subscriber || ident_device œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  55. 55. Note that they are not creditable because these identifiers are just passed as plain text. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  56. 56. The security will be slightly improved with combining IP-address verification. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  57. 57. Validation of IP-address range œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  58. 58. We may want to block PCs for some (marketing?) reasons, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  59. 59. or we may want to check if the identifiers (for a device or a subscribe) is surely passed from mobile. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  60. 60. The operators provides the information of the IP-address ranges on the website œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  61. 61. of course in various formats, and even worse, usually they are not machine readable (dirty scraping is needed). œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  62. 62. Since Jpmobile contains the tables obtained from these machine-unfriendly websites, œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  63. 63. Just do request.mobile.valid_ip? œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  64. 64. Adding session IDs to URL and FORM œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  65. 65. Some devices does not support cookies. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  66. 66. For them, you need to pass the session ID via URL and FORM parameters. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  67. 67. class MyController < ApplicationController trans_sid end œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  68. 68. Getting specs of the screen œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  69. 69. The screensize differs according to the model. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  70. 70. In order to optimize the output, we need the information about the screen. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  71. 71. The information may be passed via HTTP header, or not. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  72. 72. We need to scrape the official websites in case that the information in the header is not available. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  73. 73. request.mobile.display.colors request.mobile.display.width request.mobile.display.height œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  74. 74. Conversion of the Emoticons œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  75. 75. Lots of lovely emoticons are available in Japanese mobiles. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  76. 76. Each operator have own set of emoticons and own encoding. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  77. 77. The specifications are so complex that I can make another presentation. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  78. 78. The mappings (between operators) are also complex and not publicly available in machine-readable format. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  79. 79. Jpmobile maps all emoticons (of all operators) into Unicode Private Area, and œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  80. 80. the output is transparently converted into the format appropriate for the target device. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  81. 81. in a controller: class MyController < ApplicationController mobile_filter end œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  82. 82. I’m going to add the feature to send emoticons PCs with embedding images. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  83. 83. Some mobiles do not support UTF-8 or stop sending emoticons under UTF-8 communication. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  84. 84. We need to communicate with them in Shift-JIS (a legacy but one of the most commonly used encoding). œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  85. 85. in a controller: class MyController < ApplicationController mobile_filter end œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  86. 86. Summary: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  87. 87. Japanese mobile phones have a lot of fascinating features. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  88. 88. But we need lots of boring know-hows to build websites for Japanese mobile phones. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  89. 89. Jpmobile helps you! œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  90. 90. Finally, I want to ask your help: œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  91. 91. I’m a student, so I don’t have many mobile-phones to test Jpmobile on. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  92. 92. I often ask my colleagues for help, paying a canned coffee. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  93. 93. So, if you find out some problems or if you make any improvement of Jpmobile, please let me know. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  94. 94. It may take long, but I’d like to work on it. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  95. 95. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ http://jpmobile-rails.org œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨
  96. 96. œ {Ruby c200 8 Sf[^ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨ œ { Œ ^ Cg Ł œ { Œ ^ Cg ¨

×