I'm using Google Play Service's map fragment in my application. On a page on its own the fragment works just fine. However, when used in another page where the fragment replaces another fragment with an ImageView in it (loaded via Picasso), the app and my phone crash with an obscure exception:
10-24 16:07:15.097 D/REQUEST ( 7454): Connection opened to:https://clients4.google.com/glm/mmap/api
10-24 16:07:15.097 D/REQUEST ( 7454): Open Connection
10-24 16:07:15.167 W/ResourceType( 7454): CREATING STRING CACHE OF 44 bytes
10-24 16:07:15.187 D/USER_EVENTS( 7454): Event: type=78, status: MD, data: T
10-24 16:07:15.197 D/dalvikvm( 7454): GC_CONCURRENT freed 2154K, 4% free 60989K/63412K, paused 4ms+2ms, total 41ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 22ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 14ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.227 D/USER_EVENTS( 7454): Event: type=113, status: mc, data:
10-24 16:07:15.247 D/REQUEST ( 7454): Add Data Request: 147
10-24 16:07:15.287 D/USER_EVENTS( 7454): Event: type=58, status: gl, data: |r=8|g=8|b=8|a=0|d=24|s=8|v=Qualcomm|i=OpenGL ES-CM 1.1|c=Adreno (TM) 330|e=t|
10-24 16:07:15.407 E/mono-rt ( 7454):
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454): Got a SIGSEGV while executing native code. This usually indicates
10-24 16:07:15.407 E/mono-rt ( 7454): a fatal error in the mono runtime or one of the native libraries
10-24 16:07:15.407 E/mono-rt ( 7454): used by your application.
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454):
10-24 16:07:15.407 F/libc ( 7454): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 8262 (DataRequestDisp)
10-24 16:07:15.457 W/ ( 7454): Thread 0x80484638 may have been prematurely finalized
This happens exactly at the time Google Maps is trying to load the data.
As I mentioned, the MapFragment replaces another Fragment that contains an ImageView whose content is loaded via Picasso. If I remove the ImageView the crash doesn't occur. Any ideas? Completely stumped.
So, after lots of head scratching I found what was causing the problem.
I was using this Xamarin Picasso binding: https://github.com/jacksierkstra/Picasso
Unfortunately this hadn't been updated in a while and contained a reference to an old version of Square's ok-Http library.
This version of Ok-HTTP seemed to change the global SSL context, thereby causing Google's MapFragment to break when requesting data via HTTPS. I found about the issue here: https://github.com/square/okhttp/issues/184
Thankfully, this has since been fixed so I created my own Xamarin.Picasso Binding and all is now going swimmingly.
This answer helped me start looking in the right direction:
AbstractGoogleClient: Fatal signal 11 (SIGSEGV)
What a headache of a bug... It took me some time to figure it out, thank you for your post! I tried your library but it fails to bind. I did find a pretty simple workaround. Add this line of code at the beginning of your application and it should do the trick!
URL.setURLStreamHandlerFactory(new OkHttpClient());
Related
I am making an app when I started my app in emulator like bluestack then it show this logcat and finish it self
02-25 00:32:21.401 850-850/com.tricknearn.app D/dalvikvm: Late-enabling CheckJNI
02-25 00:32:21.601 850-850/com.tricknearn.app D/dalvikvm: GC_FOR_ALLOC freed 70K, 28% free 2690K/3728K, paused 20ms, total 40ms
02-25 00:32:21.651 850-850/com.tricknearn.app I/dalvikvm-heap: Grow heap (frag case) to 9.065MB for 6720012-byte allocation
02-25 00:32:21.661 850-859/com.tricknearn.app D/dalvikvm: GC_FOR_ALLOC freed <1K, 11% free 9252K/10292K, paused 10ms, total 10ms
02-25 00:32:21.671 850-853/com.tricknearn.app D/dalvikvm: GC_CONCURRENT freed <1K, 11% free 9252K/10292K, paused 0ms+0ms, total 0ms
02-25 00:32:22.011 850-850/com.tricknearn.app I/PGA: Attempting to create new SOCKET connectionn pid = 850, tid = 850
02-25 00:32:22.031 850-850/com.tricknearn.app I/PGA: New SOCKET connection: com.tricknearn.app (pid 850, tid 850)
02-25 00:32:23.261 850-850/com.tricknearn.app W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
And when I start this app in mobile device it shows logcat :
02-25 00:38:10.804 17347-17347/com.tricknearn.app V/PhoneWindow: updateColorViewInt()if drawable=null color=-14057287
what does these means and how to fix these. I don't know about that I tried to find this but i did't get usefull information.Need help guys. Thanks in advance.
Output from your phone is correct. Last message means -> if drawable wasn't set then background have white color (-14057287 == white). In output i see only debug, info, verbose and one warning - you don't get any error. Dalvik send to you info that garbage collector works and your heap are growing. What are your question?
I'm doing a black-box Espresso UI testing on an app which I only have the apk file. To run the Espresso test, the app to be tested and the test have to be signed with the same signature, so I have to resign the app apk.
I have tried to resign the app with these commands:
zip -d $APK META-INF/\*
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $KEYSTORE -storepass $STOREPASS $APK $ALIAS
jarsigner -verify -verbose -certs $APK
zipalign -v 4 $APK $ALIGNED_APK
The resigned app was installed successfully. But, it couldn't be launched. Here is the log from logcat:
11-03 11:12:08.546: I/ActivityManager(1020): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.zg.zl/.ui.SplashActivity u=0} from pid 1128
11-03 11:12:08.546: W/WindowManager(1020): Failure taking screenshot for (246x410) to layer 21005
11-03 11:12:08.556: D/dalvikvm(795): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-03 11:12:08.586: D/dalvikvm(795): GC_EXPLICIT freed 37K, 4% free 7917K/8195K, paused 0ms+1ms, total 27ms
11-03 11:12:08.586: D/dalvikvm(795): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-03 11:12:08.596: D/dalvikvm(795): GC_EXPLICIT freed <1K, 4% free 7917K/8195K, paused 0ms+1ms, total 5ms
11-03 11:12:08.596: I/ActivityManager(1020): Start proc com.zg.zl for activity com.zg.zl/.ui.SplashActivity: pid=1587 uid=10044 gids={3003, 1015, 1006, 3002, 1028}
11-03 11:12:08.606: D/dalvikvm(795): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-03 11:12:08.606: D/dalvikvm(795): GC_EXPLICIT freed <1K, 4% free 7917K/8195K, paused 1ms+1ms, total 6ms
11-03 11:12:08.617: E/Trace(1587): error opening trace file: No such file or directory (2)
11-03 11:12:08.646: D/dalvikvm(1587): WAIT_FOR_CONCURRENT_GC blocked 0ms
11-03 11:12:08.716: D/dalvikvm(1587): GC_CONCURRENT freed 155K, 3% free 8200K/8391K, paused 21ms+1ms, total 40ms
11-03 11:12:08.756: D/dalvikvm(1587): GC_CONCURRENT freed 118K, 3% free 8497K/8711K, paused 15ms+0ms, total 21ms
11-03 11:12:08.806: D/dalvikvm(1587): GC_CONCURRENT freed 127K, 3% free 8808K/9031K, paused 12ms+0ms, total 17ms
11-03 11:12:08.816: I/ActivityThread(1587): Pub com.zg.zl.db.preferencesprovider: com.zg.zl.db.PreferencesProvider
11-03 11:12:08.826: D/dalvikvm(1587): Trying to load lib /mnt/asec/com.zg.zl-1/lib/libzl_native_lib.so 0xb55cfc48
11-03 11:12:08.826: D/dalvikvm(1587): Added shared lib /mnt/asec/com.zg.zl-1/lib/libzl_native_lib.so 0xb55cfc48
11-03 11:12:08.826: D/dalvikvm(1587): Trying to load lib /mnt/asec/com.zg.zl-1/lib/libzl_native_lib.so 0xb55cfc48
11-03 11:12:08.826: D/dalvikvm(1587): Shared lib '/mnt/asec/com.zg.zl-1/lib/libzl_native_lib.so' already loaded in same CL 0xb55cfc48
11-03 11:12:08.826: I/AndroidRuntime(1587): VM exiting with result code 0, cleanup skipped.
11-03 11:12:08.846: I/ActivityManager(1020): Process com.zg.zl (pid 1587) has died.
11-03 11:12:08.846: W/ActivityManager(1020): Force removing ActivityRecord{b59377c8 com.zg.zl/.ui.SplashActivity}: app died, no saved state
11-03 11:12:08.886: W/InputMethodManagerService(1020): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b59228a0 attribute=null
11-03 11:13:16.597: D/dalvikvm(1116): GC_CONCURRENT freed 384K, 7% free 8482K/9031K, paused 0ms+0ms, total 7ms
(If I remove the META-INF folder from the resigned apk, and add the META-INF folder which is from the original APK. The app can be installed and run normally.)
I think the app is protected against being resigned with a different certificate. How can I work around this problem?
As I read somewhere, knowing how to pick a lock doesn't make you a robber.
Since this question haven't received any answers. I would like to point someone
at the right direction if they are interested.
First, you need to decomile/desassemble the app to smali code. A wellknown tool
for this is apktool/baksmali. dex2jar and jd-gui can be used to reverse
the app to java code which is useful to understand the smali code.
Second, If an app have some types of protection, it must make certain API calls. By
searching for the API call, you can identify what code you need to modify. In
this case, the java code could be like this:
Context mContext = MainApplication.getApplicationContext();
byte[] signatureByteArray = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 64).signatures[0].toByteArray();
The equivalent smali code would be:
:try_start_0
invoke-static {}, Lcom/zing/zalo/app/MainApplication;->it()Landroid/content/Context;
move-result-object v1
invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
invoke-virtual {v1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v1
const/16 v3, 0x40
invoke-virtual {v2, v1, v3}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v1
iget-object v1, v1, Landroid/content/pm/PackageInfo;->signatures:[Landroid/content/pm/Signature;
const/4 v2, 0x0
aget-object v1, v1, v2
invoke-virtual {v1}, Landroid/content/pm/Signature;->toByteArray()[B
move-result-object v1
In practice, apps are usually obfuscated and the app can be protected against
modification by other means such as checking the file size. Here is just a
general idea.
I am making a SIP client using PortSIP library made based on AndroidSIPSample project. I get the following error:
01-09 02:00:52.730: A/libc(750): Fatal signal 11 (SIGSEGV) at 0x00000c0d (code=1), thread 750 (ovative.innovox)
The error is not coming when I am running AndroidSIPSample project downloaded from PortSIP website.
Following is my logcat output:
01-09 02:00:47.910: D/dalvikvm(750): Trying to load lib /data/app-lib/in.innovative.innovox-2/libportsipcore.so 0x416fc190
01-09 02:00:47.981: D/dalvikvm(750): Added shared lib /data/app-lib/in.innovative.innovox-2/libportsipcore.so 0x416fc190
01-09 02:00:48.400: D/dalvikvm(750): GC_FOR_ALLOC freed 63K, 8% free 2656K/2876K, paused 81ms, total 91ms
01-09 02:00:48.432: I/dalvikvm-heap(750): Grow heap (frag case) to 5.087MB for 2457616-byte allocation
01-09 02:00:48.510: D/dalvikvm(750): GC_FOR_ALLOC freed 2K, 5% free 5053K/5280K, paused 70ms, total 70ms
01-09 02:00:49.530: D/dalvikvm(750): GC_FOR_ALLOC freed 28K, 4% free 5351K/5540K, paused 53ms, total 57ms
01-09 02:00:49.550: I/dalvikvm-heap(750): Grow heap (frag case) to 6.451MB for 1127536-byte allocation
01-09 02:00:49.630: D/dalvikvm(750): GC_FOR_ALLOC freed 1K, 3% free 6450K/6644K, paused 73ms, total 73ms
01-09 02:00:51.990: I/Choreographer(750): Skipped 167 frames! The application may be doing too much work on its main thread.
01-09 02:00:52.010: D/gralloc_goldfish(750): Emulator without GPU emulation detected.
01-09 02:00:52.730: A/libc(750): Fatal signal 11 (SIGSEGV) at 0x00000c0d (code=1), thread 750 (ovative.innovox)
I don't know what is causing it, I even put images in xhdpi drawable folder for xhdpi devices according to this answer. But still getting the error.
Please help me solve this error.
I was getting the error because I was passing wrong argument to a method of the PortSIP library, so because of that the library was throwing error.
My problem is that I used to have the super.Loadurl code with cordova leading to the file:///android_asset/ directory, and it worked fine.. everything was 100% , took a bit to load but it was working fine. I then made my files hosted on my website to take off the whopping 197mb off the app to make it lighter and uploadable, but it gave me a "Application error- the connection to the server was unsuccessful" I then tried using the "webview" code and used it with the example "www.google.com" , that worked fine. I tried using my site, and it would change the color of the screen to the bg in my site, BUT nothing else would show up. So then I tried making a simple html file with just a small text and changed the index.html to it, and it loaded the text fine.. I'm lost, I have no idea what to try or what to do. Please someone lead me in the right direction.
`110-06 12:15:26.355: D/dalvikvm(1102): GC_FOR_ALLOC freed 46K, 5% free 2933K/3084K, paused 61ms, total 63ms
10-06 12:15:26.565: D/dalvikvm(1102): GC_FOR_ALLOC freed 291K, 12% free 3156K/3548K, paused 18ms, total 20ms
10-06 12:15:26.604: D/dalvikvm(1102): GC_FOR_ALLOC freed 2K, 9% free 3258K/3548K, paused 25ms, total 26ms
10-06 12:15:26.604: I/dalvikvm-heap(1102): Grow heap (frag case) to 4.353MB for 1127536-byte allocation
10-06 12:15:26.654: D/dalvikvm(1102): GC_FOR_ALLOC freed <1K, 7% free 4359K/4652K, paused 43ms, total 43ms
10-06 12:15:27.074: E/ActivityThread(1102): Failed to find provider info for com.google.plus.platform
10-06 12:15:27.084: I/Ads(1102): To get test ads on this device, call adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
10-06 12:15:27.714: D/dalvikvm(1102): DexOpt: --- BEGIN 'ads1928896260.jar' (bootstrap=0) ---
10-06 12:15:27.734: D/dalvikvm(1102): GC_FOR_ALLOC freed 322K, 9% free 4657K/5080K, paused 107ms, total 111ms
10-06 12:15:27.734: I/Choreographer(1102): Skipped 51 frames! The application may be doing too much work on its main thread.
10-06 12:15:27.994: D/gralloc_goldfish(1102): Emulator without GPU emulation detected.
10-06 12:15:28.084: D/dalvikvm(1102): DexOpt: --- END 'ads1928896260.jar' (success) ---
10-06 12:15:28.084: D/dalvikvm(1102): DEX prep '/data/data/com.croruptdesigns.gtav_themanual/cache/ads1928896260.jar': unzip in 1ms, rewrite 362ms
10-06 12:15:28.335: I/Ads(1102): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"17339870006830476368","seq_num":"1","slotname":"a1524e277372095","u_w":384,"msid":"com.croruptdesigns.gtav_themanual","cap":"m,a","js":"afma-sdk-a-v6.4.1","bas_off":0,"net":"ed","app_name":"1.android.com.croruptdesigns.gtav_themanual","hl":"en","gnt":3,"carrier":"310260","u_audio":4,"kw":[],"u_sd":2,"simulator":1,"ms":"CGmAthrKkyRp6xWcusoVxk_ntS2ZN59H63Qd8Jjg0ndLToWFNwJl32PSa2X8m09vF106i8Jsf_2BuJ6sG8m0duqbSvh8sZ7wgCPg5Rd7Tvxb63ZyO_lYyx7SMxpGtRjsleR2hmBLkYsdXrymwWPZDidE1qlU-Ahhjj8WjSrOPeHz7UpgEfKdxe35Xsk9iIqZoGkqf_QBAINQO63dItJW95a3d0jl9R9CLcmrNoZUTC4JSY6KVJIuvXYBBcRst9hy8sGl7Mkmt399rTsYelv_ZNU_NGTiz8OkaWBfVgvzeqhxSmgN5Eabfs_bdWsuQfB9W7sfVGqVAgnBHg2KPZ1mnw","isu":"B3EEABB8EE11C2BE770B684D95219ECB","format":"320x50_mb","oar":0,"ad_pos":{"height":0,"visible":1,"y":1152,"x":736,"width":0},"u_h":592,"pt":1,"bas_on":0,"ptime":0});</script></head><body></body></html>
10-06 12:15:29.984: I/Ads(1102): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/gma?preqs=0&session_id=17339870006830476368&seq_num=1&u_w=384&msid=com.croruptdesigns.gtav_themanual&cap=m%2Ca&js=afma-sdk-a-v6.4.1&bas_off=0&net=ed&app_name=1.android.com.croruptdesigns.gtav_themanual&hl=en&gnt=3&carrier=310260&u_audio=4&kw&u_sd=2&ms=CGmAthrKkyRp6xWcusoVxk_ntS2ZN59H63Qd8Jjg0ndLToWFNwJl32PSa2X8m09vF106i8Jsf_2BuJ6sG8m0duqbSvh8sZ7wgCPg5Rd7Tvxb63ZyO_lYyx7SMxpGtRjsleR2hmBLkYsdXrymwWPZDidE1qlU-Ahhjj8WjSrOPeHz7UpgEfKdxe35Xsk9iIqZoGkqf_QBAINQO63dItJW95a3d0jl9R9CLcmrNoZUTC4JSY6KVJIuvXYBBcRst9hy8sGl7Mkmt399rTsYelv_ZNU_NGTiz8OkaWBfVgvzeqhxSmgN5Eabfs_bdWsuQfB9W7sfVGqVAgnBHg2KPZ1mnw&format=320x50_mb&oar=0&u_h=592&bas_on=0&ptime=0&imbf=%40installed_markets%40&u_so=p&output=html®ion=mobile_app&u_tz=-240&client_sdk=1&ex=1&slotname=a1524e277372095&kw_type=broad&gsb=3g&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_sdkAdmobApiForAds_di&eisu=gkAjAmBMj3pCXLD39t1g2jfXkfrdgaKxkUlUxErHyL8lbW_DZ0Ax-0lWPhmyI4kVmCb2BcERmMkOa1W4aP02QZQuDw2BKjE_biobCXoJnC_R0BL3LCfhPy1JOkAAUEIy&et=58&jsv=56" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
10-06 12:15:30.034: I/Ads(1102): Ad url modified to http://googleads.g.doubleclick.net:80/mads/gma?preqs=0&session_id=17339870006830476368&seq_num=1&u_w=384&msid=com.croruptdesigns.gtav_themanual&cap=m%2Ca&js=afma-sdk-a-v6.4.1&bas_off=0&net=ed&app_name=1.android.com.croruptdesigns.gtav_themanual&hl=en&gnt=3&carrier=310260&u_audio=4&kw&u_sd=2&ms=CGmAthrKkyRp6xWcusoVxk_ntS2ZN59H63Qd8Jjg0ndLToWFNwJl32PSa2X8m09vF106i8Jsf_2BuJ6sG8m0duqbSvh8sZ7wgCPg5Rd7Tvxb63ZyO_lYyx7SMxpGtRjsleR2hmBLkYsdXrymwWPZDidE1qlU-Ahhjj8WjSrOPeHz7UpgEfKdxe35Xsk9iIqZoGkqf_QBAINQO63dItJW95a3d0jl9R9CLcmrNoZUTC4JSY6KVJIuvXYBBcRst9hy8sGl7Mkmt399rTsYelv_ZNU_NGTiz8OkaWBfVgvzeqhxSmgN5Eabfs_bdWsuQfB9W7sfVGqVAgnBHg2KPZ1mnw&format=320x50_mb&oar=0&u_h=592&bas_on=0&ptime=0&imbf=8008&u_so=p&output=html®ion=mobile_app&u_tz=-240&client_sdk=1&ex=1&slotname=a1524e277372095&kw_type=broad&gsb=3g&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_sdkAdmobApiForAds_di&eisu=gkAjAmBMj3pCXLD39t1g2jfXkfrdgaKxkUlUxErHyL8lbW_DZ0Ax-0lWPhmyI4kVmCb2BcERmMkOa1W4aP02QZQuDw2BKjE_biobCXoJnC_R0BL3LCfhPy1JOkAAUEIy&et=58&jsv=56
10-06 12:15:30.034: I/Ads(1102): Request scenario: Online server request.
10-06 12:15:32.784: D/webviewglue(1102): nativeDestroy view: 0x2a1bf608
10-06 12:15:32.784: I/Ads(1102): onReceiveAd()
10-06 12:15:33.204: E/cutils-trace(1102): Error opening trace file: No such file or directory (2)
10-06 12:15:33.245: D/TilesManager(1102): Starting TG #0, 0x2a282a68
10-06 12:16:32.485: D/CordovaActivity(1102): Setting integer properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml
10-06 12:16:32.565: D/CordovaWebView(1102): CordovaWebView is running on device made by: unknown
10-06 12:16:32.585: D/JsMessageQueue(1102): Set native->JS mode to 2
10-06 12:16:32.614: E/PluginManager(1102): =====================================================================================
10-06 12:16:32.614: E/PluginManager(1102): ERROR: config.xml is missing. Add res/xml/plugins.xml to your project.
10-06 12:16:32.614: E/PluginManager(1102): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml
10-06 12:16:32.614: E/PluginManager(1102): =====================================================================================`
`import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import org.apache.cordova.*;
import com.google.ads.AdSize;
import com.google.ads.AdView;
public class Manual extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
super.loadUrl("http://croruptdesigns.com/gta/index.html");
}
}
I'm using Facebook SDK in my Android App. What I need is to get all the information of the user including the Name, Email, Birthday, Location. But all I can get is the Name and Email. Is there any permission to get the Birthday and Location? I also look at this link but if not working for me https://developers.facebook.com/docs/reference/api/user/.
Here is my way of getting the information.
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();
}
});
}
}
this is what log says
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.
I also got this one from my log cat
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.
thanks for anyone can help.
First, You are choosing the wrong tags to make the query for getting the User's location.
If you are using the Graph API, then the tag in question is: location. The user_location that you have used, is a permission.
Second, and perhaps more importantly, you are choosing these permissions: {"email", "publish_stream"}
To get the User's birthday and his / her location you will also need these permissions:
For the User logged into your app: user_location. And for getting the logged in user's friends location: friends_location
Similarly, for the birthday, you will need these permissions: user_birthday for the logged in user and friends_birthday for the logged in user's friends.
Take a look at the list of available fields for querying and getting results here: https://developers.facebook.com/docs/reference/api/user/
And for a list of all permissions, take a look at this page: https://developers.facebook.com/docs/reference/login/#permissions
EDIT 2:
Removing the earlier FQL suggestion and providing an alternate.
String testURL = "https://graph.facebook.com/me?fields=name,birthday,email,location&access_token=YOUR_ACCESS_TOKEN";
try {
HttpClient hc = new DefaultHttpClient();
HttpGet get = new HttpGet(testURL);
HttpResponse rp = hc.execute(get);
if (rp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String result = EntityUtils.toString(rp.getEntity());
JSONArray JAUserInfo = new JSONArray(result);
for (int i = 0; i < JAUserInfo.length(); i++) {
JSONObject JOUserInfo = JAUserInfo.getJSONObject(i);
Log.e("USER DETAILS", JOUserInfo.toString());
if (JOUserInfo.has("location") {
JSONObject JOLocation = JOUserInfo.optJSONObject("location");
String location = JOLocation.getString("name");
}
}
}
} catch (Exception e) {
// TODO: handle exception
}
NOTE: You need to provide an Access Token in this query. Without that, this will without doubt, fail. Just change the YOUR_ACCESS_TOKEN in the String testURL to your Access Token.