Android のアプリケーション名を設定するには

/res/values/strings.xml

↑のファイルを編集する

<string name="app_name">MiraiZ カレンダー</string>

↑こんな感じです。

Facebook OAuth で投稿する (PHPバージョン)

ドキュメントを見ていると、

curl -F 'access_token=...' \
     -F 'message=Hello, Arjun. I like this new API.' \
     https://graph.facebook.com/arjun/feed

こんな感じになっていて、 curl使うのか・・・っと少し面倒な気分になっていたのですが、
駄目もとで、普通にPOSTしてみたら、上手くいきました。
※curlのことをよくわかっていませんが、苦手意識があります。

上手くいったPHPのコード↓


$data = array(
  'access_token' => $access_token,
  'message' => $message
  );
$data = http_build_query($data, '', '&');
$header = array(
     "Content-Type: application/x-www-form-urlencoded",
     "Content-Length: ".strlen($data)
 );
$context = array(
     "http" => array(
         "method"  => "POST",
         "header"  => implode("\r\n", $header),
         "content" => $data
     )
 );
$url = "https://graph.facebook.com/me/feed";
echo file_get_contents($url, false, stream_context_create($context));

 
結果:{"id":"xxxxx_xxxxxxxxx"}
↑こんな感じで、投稿のIDがjsonでかえってきます。 

Facebook OAuth でユーザー情報を取得する

https://graph.facebook.com/me?metadata=1&access_token=ここに取得したアクセストークン

これにアクセスするだけで取得できます。
プロフィール画像は、上記URLの json にも書かれていますが、

https://graph.facebook.com/me/picture?access_token=ここに取得したアクセストークン
 
で取ることができます。 

winChain で iPhone アプリを Windows で開発する

Android では、 WebView + HTML5 でアプリを開発しています。同じように iPhone でもブラウザ + HTML5でアプリを開発したいわけですが、ブラウザアプリを作るためだけに、Mac を買うのは、すごく勿体ない・・・
Windows でなんとか開発できないか・・・っとググって見つけたのが、winChain。
WindowsにiPhoneアプリ開発環境を構築してくれるアプリらしいです。素晴らしいですね。
早速試してみたいと思います。

まずは、winChainをダウンロード。500M近くあるので、本日は、ダウンロードまで。

Facebook OAuth の有効期限をなくす方法。

Facebook の OAuth(?) のメモ。

まずは、アクセストークンの取得までの流れ。

  1. https://graph.facebook.com/oauth/authorize?client_id=ここにID&redirect_uri=http://リダイレクト先/
  2. http://↑でリダイレクトで指定したURL/?code=リクエストトークン(?)
    ↑こんな感じでリダイレクトで戻ってきます。
  3. https://graph.facebook.com/oauth/access_token?client_id=ここにID&redirect_uri=http://リダイレクト先/&client_secret=ここに鍵(?)&code=↑でとれたリクエストトークン(?)
これだけで、アクセストークンが取れます。
しかしながら、上記だけだと、expires(有効期限?)がついてきてしまいます。
この有効期限の取り方は、1. に scope=offline_accessというパラメータを足すだけです。
まだ試していませんが、ご参考までに。

追記:3. でリダイレクト先を指定していますが、実際は、アクセストークンが表示されるだけで、リダイレクトされません。必要なんでしょうか?

追記:リダイレクト先を指定しないと、"Missing redirect_uri parameter."というエラーになりました。且、1.で指定したURLと同じものを指定する必要があるそうです。鍵の一つになっているのでしょうか。

Twitter API の 機能一覧

≪Twitter API の 機能一覧≫

※http://watcher.moe-nifty.com/memo/docs/twitterAPI49.txt より

タイムライン関連のAPI
 public_timeline
  公開(かつ、自分のアイコンを設定済みの)ユーザの最新のステータス(発言)を取得する (最大20件)
  http://twitter.com/statuses/public_timeline.format
 home_timeline
  自分と自分の friend の過去24時間以内に update されたステータス(retweetを含む)から最大20件(count引数使用時は最大200件)を取得する。
  http://twitter.com/statuses/home_timeline.format
 friends_timeline
  自分の friend の過去24時間以内に update されたステータスから最大20件(count引数使用時は最大200件)を取得する。
  http://twitter.com/statuses/friends_timeline.format
  http://twitter.com/statuses/friends_timeline/id.format
 user_timeline
  自分の過去24時間以内に update されたステータスから最大20件(count引数使用時は最大200件)を取得する。
  http://twitter.com/statuses/user_timeline.format
  http://twitter.com/statuses/user_timeline/id.format
 replies
  自分に対する返信(冒頭が @ユーザ名 で始まるステータス)の一覧を取得する (最大20件)
  http://twitter.com/statuses/replies.format
 mentions
  自分に対する言及(@ユーザ名 が含まれるステータス)の一覧を取得する (最大20件)
  http://twitter.com/statuses/mentions.format
 retweeted_by_me
  自分が投稿した retweet の一覧を取得する (最大20件)
  http://twitter.com/statuses/retweeted_by_me.format
 retweeted_to_me
  自分の friends が投稿した retweet の一覧を取得する (最大20件)
  http://twitter.com/statuses/retweeted_to_me.format
 retweetes_of_me
  自分が投稿した発言のうち(自分以外の)誰かによって retweet されたものの一覧を取得する (最大20件)
  http://twitter.com/statuses/retweets_of_me.format

ステータス関連のAPI
 show
  指定した ID のステータス(1件)を取得する
  http://twitter.com/statuses/show/id.format
 update
  自分のステータスを更新(update)する。引数 status は必須。
  http://twitter.com/statuses/update.format
 destroy
  ステータスを削除する。ステータスIDの指定は必須。
  http://twitter.com/statuses/destroy/id.format
 retweet
  指定したステータスを retweet する。ステータスIDの指定は必須。
  http://twitter.com/statuses/retweet/id.format
 retweets
  指定したステータスを retweet しているユーザの一覧のうち最初の100人分を取得する
  http://twitter.com/statuses/retweets/id.format

ユーザ情報関連のAPI
 friends
  自分の friend の一覧を(各 friend の最新ステータス付きで)取得する
  http://twitter.com/statuses/friends.format
 followers
  自分の follower の一覧を(各 follower の最新ステータス付きで)取得する
  http://twitter.com/statuses/followers.format
 show
  指定ユーザに関する詳細な情報を取得する。
  http://twitter.com/users/show/id.format
 search
  指定条件に一致する Twitter ユーザを検索する。
  http://api.twitter.com/1/users/search.format

ダイレクトメッセージ関連のAPI
 direct_messages
  自分宛てのダイレクトメッセージの一覧を取得する (最大20件)
  http://twitter.com/direct_messages.format
 sent
  自分が送信したダイレクトメッセージの一覧を取得する (最大20件)
  http://twitter.com/direct_messages/sent.format
 new
  ダイレクトメッセージを送信する。宛先と本文の指定は必須。
  http://twitter.com/direct_messages/new.format
 destroy
  ダイレクトメッセージを削除する。メッセージIDの指定は必須。
  http://twitter.com/direct_messages/destroy/id.format

フレンド関連のAPI
 create
  指定ユーザを自分の friend (following) にする
  http://twitter.com/friendships/create/id.format
 destroy
  指定ユーザを自分の friend (following) から外す
  http://twitter.com/friendships/destroy/id.format
 exists
  指定した2ユーザの間の friend 関係を調べる
  http://twitter.com/friendships/exists.format
 show
  指定した2ユーザの間の関係を詳細に調べる
  http://twitter.com/friendships/show.format

ソーシャルグラフ関連のAPI
 friends/ids
  自分の、あるいは指定したユーザが follow しているユーザ(friends)のID一覧(配列)を取得する
  http://twitter.com/friends/ids.format
 followers/ids
  自分を、あるいは指定したユーザを follow しているユーザ(followers)のID一覧(配列)を取得する
  http://twitter.com/followers/ids.format

アカウント関連のAPI
 verify_credentials
  (BASIC認証による)セッションを開始する。認証に成功すると HTTP 200 OK の応答とともに当該ユーザに関する情報(と cookie)が返る。
  http://twitter.com/account/verify_credentials.format
 end_session
  verify_credentials で開始したセッションを終了する(本API実行後、空の cookie が返る)
  http://twitter.com/account/end_session.format
 update_location
  自分の profile の location 欄に表示する情報を更新する
  http://twitter.com/account/update_location.format
 update_delivery_device
  自分の device を設定する
  http://twitter.com/account/update_delivery_device.format
 update_profile_colors
  Twitter 上の自分の profile ページの色を設定する
  http://twitter.com/account/update_profile_colors.format
 update_profile_image
  自分の profile ページの画像(ユーザアイコンとしても使用される)を設定する
  http://twitter.com/account/update_profile_image.format
 update_profile_background_image
  自分の profile ページの背景画像を設定する
  http://twitter.com/account/update_profile_background_image.format
 rate_limit_status
  自分の「API 制限状況」(この1時間以内にあと何回APIを実行できるか)を取得する。本APIの実行自体はAPI制限の対象外である(何回でも実行できる)
  http://twitter.com/account/rate_limit_status.format
 update_profile
  自分の profile (アカウント情報) を変更する
  http://twitter.com/account/update_profile.format

お気に入り関連のAPI
 favorites
  自分または指定したユーザの favorites(お気に入り) に登録されている「発言」のうち、最新のものから最大20件取得する
  http://twitter.com/favorites.format
 create
  指定ステータスを自分の「お気に入り」に登録する。
  http://twitter.com/favorites/create/id.format
 destroy
  指定ステータスを自分の「お気に入り」から外す。
  http://twitter.com/favorites/destroy/id.format

「指定デバイス」関連のAPI
 follow
  指定ユーザ(following)の発言を「指定デバイス」に送信するようにする
  http://twitter.com/notifications/follow/id.format
 leave
  指定ユーザ(following)の発言を「指定デバイス」に送信するのをやめる
  http://twitter.com/notifications/leave/id.format

ブロック関連のAPI
 create
  指定ユーザをブロックする。指定ユーザが friend だった場合、friend から外した上でブロックする
  http://twitter.com/blocks/create/id.format
 destroy
  指定ユーザのブロックを解除する
  http://twitter.com/blocks/destroy/id.format
 exists
  指定したユーザをブロックしているかどうかを調べる。
  http://twitter.com/blocks/exists/id.format
 blocking
  自分がブロックしているユーザの一覧を取得する
  http://twitter.com/blocks/blocking.format
 blocking/ids
  自分がブロックしているユーザのID一覧(配列)を取得する
  http://twitter.com/blocks/blocking/ids.format

補助API
 test
  成功すれば(Twitter が正常に稼動していれば)、"ok" という文字列を http ステータスコード 200 OK で返す
  http://twitter.com/help/test.format

spam 報告関連のAPI
 report_spam
  指定ユーザをスパマーであると報告し、ブロックする
  http://twitter.com/report_spam.format

list 関連のAPI
 POST lists
  list を作成する
  http://api.twitter.com/1/user/lists.format
 POST list id
  指定 list を更新する
  http://api.twitter.com/1/user/lists/id.format
 GET lists
  指定ユーザの list の一覧を取得する。自分自身の list の一覧を取得する場合は、非公開の list も一覧に含まれる
  http://api.twitter.com/1/user/lists.format
 GET list id
  指定ユーザの指定 list に関する情報を取得する。自分自身の list を取得する場合は、非公開の list であっても情報を取得可能である
  http://api.twitter.com/1/user/lists/id.format
 DELETE list id
  指定 list を削除する
  http://api.twitter.com/1/user/lists/id.format
 GET list statuses
  指定した list に登録されているメンバーのみで構成されるタイムラインを取得する
  http://api.twitter.com/1/user/lists/list_id/statuses.format
 GET list memberships
  指定したユーザが登録されている list の一覧を取得する
  http://api.twitter.com/1/user/lists/memberships.format
 GET list subscriptions
  指定したユーザが購読している list の一覧を取得する
  http://api.twitter.com/1/user/lists/subscriptions.format

list の登録内容に関する API
 GET list members
  指定した list に登録されているメンバーの一覧を取得する
  http://api.twitter.com/1/user/list_id/members.format
 POST list members
  指定した list にメンバーを追加する。1つの list に最大500人まで登録できる
  http://api.twitter.com/1/user/list_id/members.format
 DELETE list members
  指定した list からメンバーを削除する
  http://api.twitter.com/1/user/list_id/members.format
 GET list members id
  指定したユーザが、指定した list のメンバーであるかどうかを確認する。
  http://api.twitter.com/1/user/list_id/members/id.format

list の購読に関する API
 GET list subscribers
  指定した list を購読している人の一覧を取得する
  http://api.twitter.com/1/user/list_id/subscribers.format
 POST list subscribers
  指定した list を購読する
  http://api.twitter.com/1/user/list_id/subscribers.format
 DELETE list subscribers
  指定した list の購読を解除する
  http://api.twitter.com/1/user/list_id/subscribers.format
 GET list subscribers id
  指定したユーザが、指定した list の購読者であるかどうかを確認する。
  http://api.twitter.com/1/user/list_id/subscribers/id.format

検索関連のAPI
 search
  指定した検索条件を満たす「発言」を返す。特に件数を指定しない場合は最大15件分の結果を返す
  http://search.twitter.com/search.format
 trends
  いま、Twitter でホットな話題(最大10件)を取得する
  http://search.twitter.com/trends.format
 trends/current
  いま、Twitter でホットな話題(最大10件)を取得する
  http://search.twitter.com/trends/current.format
 trends/daily
  指定した日のホットな話題(最大20件)を取得する
  http://search.twitter.com/trends/daily.format
 trends/weekly
  指定した日を含む週のホットな話題(最大30件)を取得する
  http://search.twitter.com/trends/weekly.format

地域情報検索関連のAPI
 trends/available
  ホットな話題が存在する地域の情報(配列)を取得する
  http://api.twitter.com/1/trends/available.format
 trends/location
  WOEID で指定した地点の付近のホットな情報を取得する (最大10件)
  http://api.twitter.com/1/trends/woeid.format

位置情報関連のAPI
 geo/reverse_geocode
  緯度、経度で指定した場所の geocode を取得する
  http://api.twitter.com/1/geo/reverse_geocode.json
 geo/id
  geo/reverse_geocode で取得した geocode の場所に関する詳細な情報を取得する
  http://api.twitter.com/1/geo/id/ID.json

検索条件保存
 saved_searches
  「(自分の)保存済みの検索条件」を返す
  http://twitter.com/saved_searches.format
 saved_searches/show
  IDで指定した「(自分の)保存済みの検索条件」を返す
  http://twitter.com/saved_searches/show/id.format
 saved_searches/create
  指定した「検索条件」を保存する
  http://twitter.com/saved_searches/create.format
 saved_searches/destroy
  指定した「保存済み検索条件」を破棄する
  http://twitter.com/saved_searches/destroy.format

ストリーミングAPI
 firehose
  public な情報を全て取得する。 (REST API の statuses/public_timeline の「応答」中の status 要素に相当するものがストリームとして流れてくる)
  http://stream.twitter.com/1/statuses/firehose.format
 gardenhose
  public な情報のうち、データマイニング・各種調査用アプリケーション向けにサンプリング・最適化したものを取得する。
  http://stream.twitter.com/gardenhose.format
 sample
  public な情報のうち、ある一定割合のものを取得する (gardenhose の精度の悪いバージョン。要するに、全てのデータが得られる保証はない。データ抜けがある可能性がある)
  http://stream.twitter.com/1/statuses/sample.format
 birddog
  ID で指定したユーザの public な情報を取得する (private 設定しているユーザの情報は取得できない)
  http://stream.twitter.com/birddog.format
 shadow
  ID で指定したユーザの public な情報を取得する  (private 設定しているユーザの情報は取得できない) [birddog の規模縮小版]
  http://stream.twitter.com/shadow.format
 filter
  1件以上のフィルターを設定し、絞り込んだ情報(public な情報に限定)を取得する (birddog, shadow の精度の悪い版)
  http://stream.twitter.com/1/statuses/filter.format
 links
  http: または https: を含むステータスをすべて取得する
  http://stream.twitter.com/1/statuses/links.format
 retweet
  retweet されているステータスをすべて取得する
  http://stream.twitter.com/1/statuses/retweet.format

Facebook、「Facebook Connect」ブランドを廃止へ

OAuth が使えるようになっているっぽいです。
まだちゃんと読んでいませんが、
http://developers.facebook.com/docs/authentication/
マニュアルには、それらしきものが書かれていました。

Android から WebView上の Javascript を呼び出す。

逆は、addJavascriptInterface で連携するだけ。
Android から js を呼ぶのは・・・
webView.loadUrl("javascript:function名()");
↑こんな感じ。「んーそりゃそうか」 という感じ。

解決法: unable to start service intent

<service android:name=".クラス名" />
とAndroidManifest.xmlに書いてあげる。

Android + WebView + HTML5 で最大の問題は・・・

HTML5 の Web SQL Database を使って開発をしています。
ここで、今ものすごく悩まされているのが、以下の問題。

DBに少し大き目のテキスト(500文字くらい?)を10レコードくらいInsertすると、ときどきAndroidのCPU使用率が100%になり、3~10秒 フリーズしてしまいます。
様々な方法で理由を調べてみましたが、現時点では不明です・・・

本件が Android のバグで Android 2.2 にバージョンアップすることで直ることを祈るばかりです。

近々リリースするかも知れないAndroid用スケジュール管理アプリ


画面キャプチャが取れるようになったので、早速近々リリースする『かもしれない』アプリのキャプチャをアップします。詳細は、リリース後!

Android端末の画面キャプチャ (スクリーンショット) を取る方法

今のところAndroidで画面キャプチャを取るアプリなどはないっぽいです。
Androidマーケットにアプリを登録する際に画面キャプチャを登録する個所があるのですが、あれは、どうやって取るんだろう?っと思っていたのですが、PCに接続して、PCで取るということでした。
これだけ聞くと、「非常に面倒な作業がいりそうだな・・・」っと感じるのですが、意外に簡単(5分程度)で取ることができました。(SDKインストール状態で)

詳しくは、こちら→http://magmanotubo.wordpress.com/2010/01/23/android%E3%81%AE%E7%AB%AF%E6%9C%AB%E7%94%BB%E9%9D%A2%E3%81%AE%E3%82%AD%E3%83%A3%E3%83%97%E3%83%81%E3%83%A3%EF%BC%88%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/

Desire が Android 2.2 にバージョンアップ

6月23日に Desire が Android 2.2 にバージョンアップするかも知れません。
JavaScriptが2~3倍高速化されるということで、かなり楽しみです。
バージョンアップされるといいな!

Xperia (Android 1.6)のHTML5対応状況

http://html5test.com/ で調べたところ、39点(?)でした。
個人的に最も必要とする
Geolocation、Storage、Offline Web Applications は0点でした。
Android + HTML5 は Android 2.1 以降対応ということになりそうです。

Windows Vista で HTC Sync が動かない

CAPI_Worker Moduleは動作を停止しました。
っと出てHTC Desire と HTC Sync が上手くシンクできません。。
色々調べてみたところ、
http://www.htc-fan.jp/modules/newbb/viewtopic.php?topic_id=1349&forum=77
↑こんな感じで、結論的には「出来ない」っぽいです。
諦めて、Windows7 で再インストール中。

追記:
Windows7 でも駄目でした。
自宅のXPで実施してみます。

追記:
XPではばっちり。
しかし。。。HTC Syncの機能は以下の通り。
HTC Sync^(TM) はお使いのPCと連絡先や予定表等を、OutlookやWindows Address Book (Outlook Express)などと同期するソフトウェアです。 

全く不要のものでした。
iTunesのようにOSのバージョンやアプリを管理できるツールだと思ったら、全くそんな機能はありませんでした。
誰が使うんだろう。

Android マーケット デベロッパー登録を行いました。

Android マーケット のデベロッパー登録を行う上で、詰まるところは恐らく電話番号。
Include country code and area code. と言われても・・・っと調べていたら Flat Labs さん ( http://blog.flatlabs.net/20100426_062547/ )に回答が。
インターネットって素晴らしいですね。無事に登録完了しました。Flat Labs さんありがとうございました。