AndroidアプリでFacebookSDKを使用しています。私が必要としているのは、名前、電子メール、誕生日、場所など、ユーザーのすべての情報を取得することです。しかし、私が得ることができるのは名前と電子メールだけです。誕生日と場所を取得する許可はありますか?私もこのリンクを見ていますが、うまくいかない場合は https://developers.facebook.com/docs/reference/api/user/。
これが私の情報取得方法です。
if(fb.isSessionValid()){
button.setImageResource(R.drawable.logout_button);
JSONObject obj = null;
URL img = null;
try {
String jsonUser = fb.request("me");
obj = Util.parseJson(jsonUser);
String id = obj.optString("id");
String name = obj.optString("name");
String bday = obj.optString("birthday");
String address = obj.optString("location");
String email = obj.optString("email");
((TextView) findViewById(R.id.txt)).setText("Welcome! "+name);
((TextView) findViewById(R.id.txtbday)).setText("Birthday: "+bday);
((TextView) findViewById(R.id.txtaddress)).setText("Address: "+address);
((TextView) findViewById(R.id.txtemail)).setText("Email: "+email);
img = new URL("http://graph.facebook.com/"+id+"/picture?type=normal");
Bitmap bmp = BitmapFactory.decodeStream(img.openConnection().getInputStream());
pic.setImageBitmap(bmp);
} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
this is my authorized
fb.authorize(MainActivity.this,new String[] {"email", "user_location", "user_birthday","publish_stream"}, new DialogListener() {
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), ""+e, Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
public void onError(DialogError e) {
// TODO Auto-generated method stub
//Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();
}
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
Editor editor = sp.edit();
editor.putString("access_token", fb.getAccessToken());
editor.putLong("access_expires", fb.getAccessExpires());
editor.commit();
updateButtonImage();
}
public void onCancel() {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "Cancel", Toast.LENGTH_SHORT).show();
}
});
}
}
これはログが言うことです
11-14 14:05:40.399: E/Trace(1293): error opening trace file: No such file or directory (2)
11-14 14:05:41.699: D/dalvikvm(1293): GC_CONCURRENT freed 290K, 6% free 6173K/6535K, paused 71ms+76ms, total 201ms
11-14 14:05:42.509: I/Choreographer(1293): Skipped 82 frames! The application may be doing too much work on its main thread.
11-14 14:05:42.519: D/gralloc_goldfish(1293): Emulator without GPU emulation detected.
11-14 14:05:42.679: I/Choreographer(1293): Skipped 30 frames! The application may be doing too much work on its main thread.
これも丸太猫からもらった
11-14 14:19:28.339: D/AndroidRuntime(1359): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-14 14:19:28.339: D/AndroidRuntime(1359): CheckJNI is ON
11-14 14:19:28.379: D/dalvikvm(1359): Trying to load lib libjavacore.so 0x0
11-14 14:19:28.389: D/dalvikvm(1359): Added shared lib libjavacore.so 0x0
11-14 14:19:28.409: D/dalvikvm(1359): Trying to load lib libnativehelper.so 0x0
11-14 14:19:28.409: D/dalvikvm(1359): Added shared lib libnativehelper.so 0x0
11-14 14:19:29.059: D/AndroidRuntime(1359): Calling main entry com.android.commands.pm.Pm
11-14 14:19:29.089: W/ActivityManager(146): No content provider found for permission revoke: file:///data/local/tmp/facebook.apk
11-14 14:19:29.119: W/ActivityManager(146): No content provider found for permission revoke: file:///data/local/tmp/facebook.apk
11-14 14:19:29.249: I/PackageManager(146): Removing non-system package:com.example.facebook
11-14 14:19:29.249: I/ActivityManager(146): Force stopping package com.example.facebook uid=10054
11-14 14:19:29.249: I/ActivityManager(146): Killing proc 1339:com.example.facebook/u0a54: force stop
11-14 14:19:29.249: W/ActivityManager(146): Force removing ActivityRecord{411f5b90 com.example.facebook/.MainActivity}: app died, no saved state
11-14 14:19:29.279: I/WindowState(146): WIN DEATH: Window{41263720 com.example.facebook/com.example.facebook.MainActivity paused=false}
11-14 14:19:29.429: I/Choreographer(263): Skipped 64 frames! The application may be doing too much work on its main thread.
11-14 14:19:29.429: I/PackageManager(146): Package com.example.facebook codePath changed from /data/app/com.example.facebook-1.apk to /data/app/com.example.facebook-2.apk; Retaining data and using new
11-14 14:19:29.479: W/InputMethodManagerService(146): Got RemoteException sending setActive(false) notification to pid 1339 uid 10054
11-14 14:19:29.559: I/PackageManager(146): Running dexopt on: com.example.facebook
11-14 14:19:30.549: D/dalvikvm(1369): DexOpt: load 142ms, verify+opt 469ms, 833796 bytes
11-14 14:19:30.569: W/PackageManager(146): Code path for pkg : com.example.facebook changing from /data/app/com.example.facebook-1.apk to /data/app/com.example.facebook-2.apk
11-14 14:19:30.569: W/PackageManager(146): Resource path for pkg : com.example.facebook changing from /data/app/com.example.facebook-1.apk to /data/app/com.example.facebook-2.apk
11-14 14:19:30.579: I/ActivityManager(146): Force stopping package com.example.facebook uid=10054
11-14 14:19:30.659: D/dalvikvm(146): GC_FOR_ALLOC freed 681K, 9% free 9626K/10567K, paused 81ms, total 81ms
11-14 14:19:30.759: D/PackageManager(146): New package installed in /data/app/com.example.facebook-2.apk
11-14 14:19:30.839: I/ActivityManager(146): Force stopping package com.example.facebook uid=10054
11-14 14:19:30.849: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-14 14:19:30.920: D/dalvikvm(330): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-14 14:19:30.949: D/dalvikvm(263): GC_EXPLICIT freed 185K, 36% free 9272K/14471K, paused 7ms+14ms, total 92ms
11-14 14:19:31.009: D/dalvikvm(146): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-14 14:19:31.059: I/InputReader(146): Reconfiguring input devices. changes=0x00000010
11-14 14:19:31.170: D/dalvikvm(146): GC_EXPLICIT freed 475K, 11% free 9461K/10567K, paused 38ms+10ms, total 163ms
11-14 14:19:31.189: D/PackageManager(146): generateServicesMap(android.accounts.AccountAuthenticator): 3 services unchanged
11-14 14:19:31.210: D/PackageManager(146): generateServicesMap(android.content.SyncAdapter): 5 services unchanged
11-14 14:19:31.219: D/BackupManagerService(146): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.facebook flg=0x8000010 (has extras) }
11-14 14:19:31.219: D/dalvikvm(330): GC_EXPLICIT freed 169K, 6% free 6320K/6663K, paused 5ms+6ms, total 293ms
11-14 14:19:31.259: D/PackageManager(146): generateServicesMap(android.accounts.AccountAuthenticator): 3 services unchanged
11-14 14:19:31.279: D/PackageManager(146): generateServicesMap(android.content.SyncAdapter): 5 services unchanged
11-14 14:19:31.299: D/BackupManagerService(146): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.facebook flg=0x8000010 (has extras) }
11-14 14:19:31.299: V/BackupManagerService(146): removePackageParticipantsLocked: uid=10054 #1
11-14 14:19:31.310: I/InputReader(146): Reconfiguring input devices. changes=0x00000010
11-14 14:19:31.429: V/BackupManagerService(146): addPackageParticipantsLocked: #1
11-14 14:19:31.699: I/Choreographer(263): Skipped 259 frames! The application may be doing too much work on its main thread.
11-14 14:19:31.909: I/Choreographer(263): Skipped 33 frames! The application may be doing too much work on its main thread.
11-14 14:19:32.179: D/dalvikvm(263): GC_CONCURRENT freed 1331K, 38% free 9017K/14471K, paused 29ms+9ms, total 116ms
11-14 14:19:32.179: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 62ms
11-14 14:19:32.179: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 80ms
11-14 14:19:32.439: D/dalvikvm(263): GC_CONCURRENT freed 415K, 34% free 9614K/14471K, paused 30ms+7ms, total 84ms
11-14 14:19:32.439: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 54ms
11-14 14:19:32.439: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 70ms
11-14 14:19:32.449: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 60ms
11-14 14:19:32.449: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 67ms
11-14 14:19:32.639: D/dalvikvm(263): GC_FOR_ALLOC freed 929K, 37% free 9199K/14471K, paused 41ms, total 47ms
11-14 14:19:32.649: I/dalvikvm-heap(263): Grow heap (frag case) to 10.257MB for 1286224-byte allocation
11-14 14:19:32.779: D/dalvikvm(263): GC_FOR_ALLOC freed 7K, 28% free 10448K/14471K, paused 128ms, total 134ms
11-14 14:19:32.920: D/dalvikvm(263): GC_CONCURRENT freed 1K, 27% free 10681K/14471K, paused 16ms+38ms, total 134ms
11-14 14:19:32.969: D/dalvikvm(146): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-14 14:19:33.269: W/InputMethodManagerService(146): Found no subtypes in a system IME: com.android.inputmethod.pinyin
11-14 14:19:33.349: W/RecognitionManagerService(146): no available voice recognition services found
11-14 14:19:33.899: D/dalvikvm(263): GC_CONCURRENT freed 3879K, 43% free 8263K/14471K, paused 34ms+10ms, total 114ms
11-14 14:19:33.949: I/Choreographer(263): Skipped 303 frames! The application may be doing too much work on its main thread.
11-14 14:19:34.249: D/dalvikvm(263): GC_FOR_ALLOC freed 115K, 40% free 8702K/14471K, paused 50ms, total 51ms
11-14 14:19:34.369: D/dalvikvm(263): GC_FOR_ALLOC freed 327K, 38% free 8973K/14471K, paused 39ms, total 42ms
11-14 14:19:34.619: D/dalvikvm(263): GC_CONCURRENT freed 767K, 37% free 9191K/14471K, paused 39ms+6ms, total 94ms
11-14 14:19:34.619: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 44ms
11-14 14:19:34.619: D/dalvikvm(263): WAIT_FOR_CONCURRENT_GC blocked 47ms
11-14 14:19:34.789: D/dalvikvm(263): GC_FOR_ALLOC freed 232K, 37% free 9257K/14471K, paused 49ms, total 55ms
11-14 14:19:34.799: I/dalvikvm-heap(263): Grow heap (frag case) to 10.314MB for 1286224-byte allocation
11-14 14:19:34.879: D/dalvikvm(263): GC_FOR_ALLOC freed 3K, 28% free 10509K/14471K, paused 78ms, total 78ms
11-14 14:19:35.009: D/dalvikvm(263): GC_CONCURRENT freed 26K, 28% free 10510K/14471K, paused 27ms+7ms, total 132ms
11-14 14:19:35.149: D/dalvikvm(146): GC_EXPLICIT freed 520K, 10% free 9550K/10567K, paused 116ms+516ms, total 2113ms
11-14 14:19:35.159: D/AndroidRuntime(1359): Shutting down VM
11-14 14:19:35.179: D/dalvikvm(1359): GC_CONCURRENT freed 101K, 78% free 459K/2048K, paused 0ms+1ms, total 10ms
11-14 14:19:35.179: D/jdwp(1359): Got wake-up signal, bailing out of select
11-14 14:19:35.179: D/dalvikvm(1359): Debugger has detached; object registry had 1 entries
11-14 14:19:35.189: I/AndroidRuntime(1359): NOTE: attach of thread 'Binder_3' failed
11-14 14:19:35.759: D/AndroidRuntime(1377): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
11-14 14:19:35.759: D/AndroidRuntime(1377): CheckJNI is ON
11-14 14:19:35.799: D/dalvikvm(1377): Trying to load lib libjavacore.so 0x0
11-14 14:19:35.799: D/dalvikvm(1377): Added shared lib libjavacore.so 0x0
11-14 14:19:35.829: D/dalvikvm(1377): Trying to load lib libnativehelper.so 0x0
11-14 14:19:35.829: D/dalvikvm(1377): Added shared lib libnativehelper.so 0x0
11-14 14:19:36.509: D/AndroidRuntime(1377): Calling main entry com.android.commands.am.Am
11-14 14:19:36.529: I/ActivityManager(146): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.facebook/.MainActivity u=0} from pid 1377
11-14 14:19:36.539: W/WindowManager(146): Failure taking screenshot for (164x246) to layer 21020
11-14 14:19:36.579: D/AndroidRuntime(1377): Shutting down VM
11-14 14:19:36.590: D/dalvikvm(1377): GC_CONCURRENT freed 102K, 77% free 489K/2048K, paused 1ms+1ms, total 11ms
11-14 14:19:36.590: D/jdwp(1377): Got wake-up signal, bailing out of select
11-14 14:19:36.590: D/dalvikvm(1377): Debugger has detached; object registry had 1 entries
11-14 14:19:36.599: I/AndroidRuntime(1377): NOTE: attach of thread 'Binder_3' failed
11-14 14:19:36.609: D/dalvikvm(1387): Not late-enabling CheckJNI (already on)
11-14 14:19:36.630: I/ActivityManager(146): Start proc com.example.facebook for activity com.example.facebook/.MainActivity: pid=1387 uid=10054 gids={3003, 1028}
11-14 14:19:36.630: I/Choreographer(263): Skipped 46 frames! The application may be doing too much work on its main thread.
11-14 14:19:36.929: E/Trace(1387): error opening trace file: No such file or directory (2)
11-14 14:19:38.359: D/dalvikvm(1387): GC_CONCURRENT freed 284K, 6% free 6199K/6535K, paused 72ms+84ms, total 206ms
11-14 14:19:39.219: I/Choreographer(1387): Skipped 39 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.239: D/gralloc_goldfish(1387): Emulator without GPU emulation detected.
11-14 14:19:39.279: I/ActivityManager(146): Displayed com.example.facebook/.MainActivity: +2s710ms
11-14 14:19:39.443: I/Choreographer(1387): Skipped 60 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.449: I/Choreographer(263): Skipped 51 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.459: I/Choreographer(146): Skipped 57 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.551: I/Choreographer(146): Skipped 44 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.679: I/Choreographer(146): Skipped 49 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.759: I/Choreographer(146): Skipped 49 frames! The application may be doing too much work on its main thread.
11-14 14:19:39.852: I/Choreographer(146): Skipped 43 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.122: I/Choreographer(146): Skipped 43 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.239: I/Choreographer(146): Skipped 48 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.319: I/Choreographer(146): Skipped 44 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.391: I/Choreographer(146): Skipped 44 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.471: I/Choreographer(146): Skipped 43 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.568: I/Choreographer(146): Skipped 44 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.681: I/Choreographer(146): Skipped 43 frames! The application may be doing too much work on its main thread.
11-14 14:19:41.761: I/Choreographer(146): Skipped 44 frames! The application may be doing too much work on its main thread.
11-14 14:20:00.092: I/Choreographer(217): Skipped 43 frames! The application may be doing too much work on its main thread.
誰でも助けてくれてありがとう。