Facebook登录崩溃应用程序的解析实现

时间:2015-07-30 15:38:46

标签: java android parse-platform

我将Parse用于我的项目。但由于某种原因,应用程序崩溃没有显示任何错误。

我已按照Parse文档中的说明操作。 我在这里缺少什么?

我已经尝试阅读并尝试了类似帖子中的一些建议,但没有任何运气

我拥有所有最新的api,并将它们包含在我的lib和gradel中。

我的 MainActivity.java

...
    import com.parse.LogInCallback;
    import com.parse.Parse;
    import com.parse.ParseException;
    import com.parse.ParseFacebookUtils;
    import com.parse.ParseObject;
    import com.parse.ParseUser;

    import java.util.Arrays;
    import java.util.List;


    public class MainActivity extends AppCompatActivity {

        //Defining Variables
        private Toolbar toolbar;
        private NavigationView navigationView;
        private DrawerLayout drawerLayout;

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);


            List<String> permissions = Arrays.asList("public_profile", "email");

            ParseFacebookUtils.logInWithReadPermissionsInBackground(this, permissions, new LogInCallback() {
                @Override
                public void done(ParseUser user, ParseException err) {
                    if (user == null) {
                        Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
                    } else if (user.isNew()) {
                        Log.d("MyApp", "User signed up and logged in through Facebook!");
                    } else {
                        Log.d("MyApp", "User logged in through Facebook!");
                    }
                }
            });



        }


        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            ParseFacebookUtils.initialize(this);


            // Enable Local Datastore.
            Parse.enableLocalDatastore(this);

            Parse.initialize(this, "G************X", "P************Q");


            //Testing connection to parse    
            ParseObject testObject = new ParseObject("TestObject");
            testObject.put("foo", "bar");
            testObject.saveInBackground();
...

的Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="gapp.rider" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />


    <application

        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:label="@string/app_name" />

        <provider
            android:authorities="com.facebook.app.FacebookContentProvider4*******7"
            android:name="com.facebook.FacebookContentProvider"
            android:exported="true" />

        <activity

            android:name="gapp.rider.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN" />

                <category
                    android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

0 个答案:

没有答案