i'm trying to make a Facebook app invite in Unity on Android platform. I'm currently using Facebook SDK 4.11.0 and Unity 2017.2.0.
The flow here would be:
- Facebook init at app launch
- User press app invite button
- Check if the user has publish_actions and user_friends read/write permissions.
- Ask for login in case the permissions are not granted.
- If success, then make a Facebook app invite through API.
The code of the app invite looks like this:
public void FbAppInvite(string message)
{
FacebookHelper.AuthenticateWithPublishPermissions(new List<string>() { "publish_actions" },
(bool publishSuccess) =>
{
if (publishSuccess)
{
FacebookHelper.AuthenticateWithReadPermissions(new List<string>() { "user_friends" }, (bool success) =>
{
if (success)
{
FB.Mobile.AppInvite(
new System.Uri("https://mycustomurl"),
new System.Uri("https://mycustomimage.png"),
(IAppInviteResult result) =>
{
if (string.IsNullOrEmpty(result.Error)
&& !result.Cancelled)
{
object o;
if (result.ResultDictionary != null
&& result.ResultDictionary.TryGetValue("did_complete", out o))
{
if (o.Equals(true))
{
// Success
}
}
}
}
);
}
});
}
}
);
}
At this point, the app tries to authenticate (which returns success) and finally makes the app invite call. Then the app freezes in a white screen for a couple of seconds and then nothing happens.. the friend dialog never gets displayed. This is the resumed log:
02-23 12:45:57.515: V/com.facebook.unity.FB(3209): sending to Unity OnLoginComplete({"access_token":"EAAYpxPZBpQAQBALx89AgtWMkwLXgDLTAJrI5xJILs6EvkqWzziPJIF9zp4HBm9is5DM20J09ArnJyF4OpPZCsLNX8KuZBnM9W51TOPxyUulj8EO2UZB92p3hkJeDBTw7O8xyne7GGgrKDuHfG7ZArcx0LfPwA1qNYFs9Vj89K6Q1mVo3tZBAMpp5GqvZA380gZBokIZBoylDNy4DaCgcaAuTW1eKCyFO5jRQ26odQhf8C3AZDZD","user_id":"104382067059532","callback_id":"5","key_hash":"kH5qC25dEVrn9wK4fwqWG5ubgbM=\n","permissions":"publish_actions,public_profile,user_friends","expiration_timestamp":"1524584697","last_refresh":"1519400757","opened":true,"declined_permissions":""})
02-23 12:45:58.756: V/com.facebook.unity.FB(3209): sending to Unity OnLoginComplete({"access_token":"EAAYpxPZBpQAQBAEbZC4bRSVAOiFZAkmaWYRdaODOHJVz1jfnq2Pj73Pj2VrjrFl6oshZAQTSihAtev2ZCEe5FCZAbUNRZAH411cjn5eJzdcC9aLrDTJgcFZA4g9Xv3ZAf4yXrVduwYVPyuczG0Xh1lNyoSOxRcf2YHAUgEdfKjXTqO9nhT1ru3IohzSSQbt7VPYSgIyIo21gelLoqeLSRId1NLuRLnKRvqe8rZBZAAJjyXrnU0KQHTyCfO7","user_id":"104382067059532","callback_id":"6","key_hash":"kH5qC25dEVrn9wK4fwqWG5ubgbM=\n","permissions":"publish_actions,public_profile,user_friends","expiration_timestamp":"1524584697","last_refresh":"1519400758","opened":true,"declined_permissions":""})
02-23 12:45:58.863: V/com.facebook.unity.FB(3209): AppInvite({"appLinkUrl":"https://polygonstudios.app.link/c1dstrdVKK","previewImageUrl":"http://polygontechstudios.com.ar/motormaniak/fbshare.png","callback_id":"7"})
02-23 12:45:58.865: I/ActivityManager(3512): START u0 {cmp=com.polygontech.motormaniak/com.facebook.unity.AppInviteDialogActivity (has extras)} from uid 10126
02-23 12:45:59.113: I/ActivityManager(3512): START u0 {act=com.facebook.platform.PLATFORM_ACTIVITY cat=[android.intent.category.DEFAULT] pkg=com.facebook.katana cmp=com.facebook.katana/com.facebook.platform.common.activity.PlatformWrapperActivity (has extras)} from uid 10126
02-23 12:45:59.308: W/PersistToDiskTh(29545): type=1400 audit(0.0:3535): avc: denied { read } for name="vmstat" dev="proc" ino=4026546034 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
02-23 12:45:59.312: D/AppStateLogger(29527): Activity com.facebook.platform.common.activity.PlatformWrapperActivity changed state to Created
02-23 12:45:59.313: D/AppStateMemParser(29527): Could not open vmstat file
02-23 12:45:59.313: D/AppStateMemParser(29527): java.io.FileNotFoundException: /proc/vmstat (Permission denied)
02-23 12:45:59.313: D/AppStateMemParser(29527): at java.io.FileInputStream.open0(Native Method)
02-23 12:45:59.313: D/AppStateMemParser(29527): at java.io.FileInputStream.open(FileInputStream.java:200)
02-23 12:45:59.313: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:150)
02-23 12:45:59.313: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:103)
02-23 12:45:59.313: D/AppStateMemParser(29527): at java.io.FileReader.<init>(FileReader.java:58)
02-23 12:45:59.313: D/AppStateMemParser(29527): at X.00n.run(:3877)
02-23 12:45:59.347: D/AppStateLogger(29527): Successfully dumped app state to log file
02-23 12:45:59.404: I/WindowManager(3512): Screen frozen for +503ms due to Window{6941acf u0 StatusBar}
02-23 12:45:59.428: W/PersistToDiskTh(29545): type=1400 audit(0.0:3536): avc: denied { read } for name="vmstat" dev="proc" ino=4026546034 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
02-23 12:45:59.432: D/AppStateLogger(29527): Activity com.facebook.platform.common.activity.PlatformWrapperActivity changed state to Started
02-23 12:45:59.433: D/AppStateMemParser(29527): Could not open vmstat file
02-23 12:45:59.433: D/AppStateMemParser(29527): java.io.FileNotFoundException: /proc/vmstat (Permission denied)
02-23 12:45:59.433: D/AppStateMemParser(29527): at java.io.FileInputStream.open0(Native Method)
02-23 12:45:59.433: D/AppStateMemParser(29527): at java.io.FileInputStream.open(FileInputStream.java:200)
02-23 12:45:59.433: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:150)
02-23 12:45:59.433: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:103)
02-23 12:45:59.433: D/AppStateMemParser(29527): at java.io.FileReader.<init>(FileReader.java:58)
02-23 12:45:59.433: D/AppStateMemParser(29527): at X.00n.run(:3877)
02-23 12:45:59.446: D/AppStateLogger(29527): Activity com.facebook.platform.common.activity.PlatformWrapperActivity changed state to Resumed
02-23 12:45:59.469: D/AppStateLogger(29527): Successfully dumped app state to log file
02-23 12:45:59.495: W/PersistToDiskTh(29545): type=1400 audit(0.0:3537): avc: denied { read } for name="vmstat" dev="proc" ino=4026546034 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
02-23 12:45:59.501: D/AppStateMemParser(29527): Could not open vmstat file
02-23 12:45:59.501: D/AppStateMemParser(29527): java.io.FileNotFoundException: /proc/vmstat (Permission denied)
02-23 12:45:59.501: D/AppStateMemParser(29527): at java.io.FileInputStream.open0(Native Method)
02-23 12:45:59.501: D/AppStateMemParser(29527): at java.io.FileInputStream.open(FileInputStream.java:200)
02-23 12:45:59.501: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:150)
02-23 12:45:59.501: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:103)
02-23 12:45:59.501: D/AppStateMemParser(29527): at java.io.FileReader.<init>(FileReader.java:58)
02-23 12:45:59.501: D/AppStateMemParser(29527): at X.00n.run(:3877)
02-23 12:45:59.536: D/AppStateLogger(29527): Activity com.facebook.platform.common.activity.PlatformWrapperActivity changed state to Paused
02-23 12:45:59.542: D/AppStateLogger(29527): Successfully dumped app state to log file
02-23 12:45:59.610: D/AppStateLogger(29527): Activity com.facebook.platform.webdialogs.PlatformWebDialogsActivity changed state to Created
02-23 12:45:59.651: D/AppStateLogger(29527): Activity com.facebook.platform.webdialogs.PlatformWebDialogsActivity changed state to Started
02-23 12:45:59.805: D/AppStateLogger(29527): Activity com.facebook.platform.webdialogs.PlatformWebDialogsActivity changed state to Resumed
02-23 12:45:59.820: I/ActivityManager(3512): Start proc 4133:com.android.chrome:sandboxed_process0/u0i447 for webview_service com.facebook.katana/org.chromium.content.app.SandboxedProcessService0
02-23 12:45:59.833: E//system/bin/webview_zygote32(4133): Failed to make and chown /acct/uid_99447: Permission denied
02-23 12:45:59.833: E/Zygote(4133): createProcessGroup(99447, 0) failed: Permission denied
02-23 12:45:59.836: I//system/bin/webview_zygote32(4133): Late-enabling -Xcheck:jni
02-23 12:45:59.934: I/GoogleInputMethod(4974): onStartInput() : Dummy InputConnection bound
02-23 12:45:59.981: I/ActivityManager(3512): Displayed com.facebook.katana/com.facebook.platform.webdialogs.PlatformWebDialogsActivity: +413ms (total +1s63ms)
02-23 12:46:00.010: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'node_id' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.011: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'include_comments_disabled_fields' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.016: I/ActivityManager(3512): Process com.google.android.gm (pid 1502) has died: cch+6CEM
02-23 12:46:00.016: W/zygote64(3512): kill(-1502, 9) failed: No such process
02-23 12:46:00.017: I/zygote64(3512): Successfully killed process cgroup uid 10091 pid 1502 in 1ms
02-23 12:46:00.027: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_reactions' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.028: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_reactions_icons' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.029: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'max_reactors' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.031: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_ranked_replies' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.032: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_private_reply' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.032: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_replies_most_recent' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.033: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'max_comment_replies' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.033: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_shares' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.034: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_reactions' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.034: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'enable_comment_reactions_icons' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.035: E/fb4a.GRAPHQL_QUERY_STRING(29527): Trying to set unknown parameter 'max_reactors' on query 'ImportantFeedStorySubV2'
02-23 12:46:00.056: E/asset(4147): setgid: Operation not permitted
02-23 12:46:00.060: W/ActivityManager(3512): Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{f75e551 29527:com.facebook.katana/u0a125} (pid=29527, uid=10125) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG
02-23 12:46:00.060: W/ContentService(3512): Ignoring content changes for content://call_log/calls from 10125: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{f75e551 29527:com.facebook.katana/u0a125} (pid=29527, uid=10125) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG
02-23 12:46:00.160: W/ActivityManager(3512): Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.google.android.music.dial.DialMediaRouteProviderService} from pid=29527, uid=10125 that is not exported from uid 10084
02-23 12:46:00.538: W/PersistToDiskTh(29545): type=1400 audit(0.0:3540): avc: denied { read } for name="vmstat" dev="proc" ino=4026546034 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0
02-23 12:46:00.543: D/AppStateMemParser(29527): Could not open vmstat file
02-23 12:46:00.543: D/AppStateMemParser(29527): java.io.FileNotFoundException: /proc/vmstat (Permission denied)
02-23 12:46:00.543: D/AppStateMemParser(29527): at java.io.FileInputStream.open0(Native Method)
02-23 12:46:00.543: D/AppStateMemParser(29527): at java.io.FileInputStream.open(FileInputStream.java:200)
02-23 12:46:00.543: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:150)
02-23 12:46:00.543: D/AppStateMemParser(29527): at java.io.FileInputStream.<init>(FileInputStream.java:103)
02-23 12:46:00.543: D/AppStateMemParser(29527): at java.io.FileReader.<init>(FileReader.java:58)
02-23 12:46:00.543: D/AppStateMemParser(29527): at X.00n.run(:3877)
I'm using a test user (configured in app console) loged in facebook app and my real user configured as administrator.
Looks like there is a file vmstat in the device that is trying to open which it does not have permission, don't really know why.
I've tried granting all permissions asked by Facebook app in my device, still no luck.
I'm using the right permissions for this request? The idea is that the user share the app (install) to their friends.
My device is currently at Android 8.1.0. Could this be an issue?
Any ideas?