I am trying to use Simple-Facebook. Everything looks great and i have no errors....until i run it....
Then i get this error
Add reference from Simple Facebook project to FacebookSDK project.
It says that something is wrong here
#Override
public void onCreate() {
super.onCreate();
APP_ID = getString(R.string.facebook_app_id);
// set log to true
//Logger.DEBUG_WITH_STACKTRACE = true;
// initialize facebook configuration
Permission[] permissions = new Permission[] {
Permission.PUBLIC_PROFILE,
Permission.PUBLISH_ACTION,
Permission.PUBLIC_PROFILE
};
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId(APP_ID)
.setNamespace(APP_NAMESPACE)
.setPermissions(permissions)
// .setDefaultAudience()
.setAskForAllPermissionsAtOnce(false)
.build();
SimpleFacebook.setConfiguration(configuration);
// Utils.printHashKey(this);
}
}
I have absolutely no idea what to do...I saw somewhere that it does this if you dont have the FaceBook SDK imported.... but i believe i do. I am able to access all of the facebook buttons like "LoginButton" and so on... PLEASE HELP
Related
I have a standalone Java application that uses a OneDrive Java API I found on github. Everything works nicely.
So I already have a clientid, a client secret, an authorization code and a refresh token which work flawlessly
Now I wanted to switch over to Android, but I wasn't successfull in using the same Java API. That's why I wanted to move to the official OneDrive Android SDK provided by Microsoft.
Everything seems to be different there. I tried the following, using my already known clientid
final Activity me = this;
final MSAAuthenticator msaAuthenticator = new MSAAuthenticator() {
#Override
public String getClientId() {
return clientid;
}
#Override
public String[] getScopes() {
return new String[] { "onedrive.appfolder" };
}
};
final IClientConfig oneDriveConfig = DefaultClientConfig.createWithAuthenticator(
msaAuthenticator);
final IOneDriveClient oneDriveClient = new OneDriveClient.Builder()
.fromConfig(oneDriveConfig)
.loginAndBuildClient(me);
oneDriveClient
.getDrive()
.buildRequest()
.get(new ICallback<Drive>() {
#Override
public void success(final Drive result) {
final String msg = "Found Drive " + result.id;
Toast.makeText(me, msg, Toast.LENGTH_SHORT)
.show();
}
#Override
public void failure(ClientException ex) {
final String msg = "Error";
Toast.makeText(me, msg, Toast.LENGTH_SHORT)
.show();
}
});
It ends up in a seemingly endless loop while executing the line .loginAndBuildClient(me)
In logcat I see that it suppressed an Exception
07-13 12:32:17.082 28175-28271/org.xxxxxxx.xxxxxxxxx E/MSAAuthenticator$5[onAuthComplete] - 314:
Failed silent login, interactive login required
com.onedrive.sdk.authentication.ClientAuthenticatorException: Failed silent login, interactive login required
at com.onedrive.sdk.authentication.MSAAuthenticator$5.onAuthComplete(MSAAuthenticator.java:312)
There are also some info messages:
07-13 12:32:17.079 28175-28271/org.xxxxxxx.xxxxxxxxx I/LiveAuthClient:
No refresh token available, sorry!
07-13 12:32:17.079 28175-28271/org.xxxxxxx.xxxxxxxxx I/LiveAuthClient:
All tokens expired, you need to call login() to initiate interactive logon
Obviously it somehow wants to perform an interactive login and fails terribly.
What I don't understand: I already have a perfectly valid refresh token which I want to reuse, but I did not find a way to do it in the MS OneDrive SDK.
Can someone help me here?
This post is a little old, but i wanted to share my solution to help others.
Instead of using this method "loginAndBuildClient" with only the Activity parameter, like this :
final IOneDriveClient oneDriveClient = new OneDriveClient.Builder()
.fromConfig(oneDriveConfig)
.loginAndBuildClient(me);
Declare a global OneDriveClient:
private IOneDriveClient mOneDriveClient;
Then use the "loginAndBuildClient" method with the Callback parameter. And assign your OneDriveClient in the "success" method :
new OneDriveClient.Builder()
.fromConfig(DefaultClientConfig.createWithAuthenticator(msaAuthenticator))
.loginAndBuildClient(MainActivity.this, new ICallback<IOneDriveClient>() {
#Override
public void success(IOneDriveClient iOneDriveClient) {
mOneDriveClient = iOneDriveClient;
}
#Override
public void failure(ClientException ex) {
mOneDriveClient = null;
}
});
I managed to implement access to the OneDrive API manually (without using the SDK) and it worked
Turns out I "only" forgot to set INTERNET permission for the app. Really strange that it caused my app to fail silently.
Recently I tested 'deferred deeplink' function by using facebook SDK.
But there is one problem.
# I did it.
First, I have completed all of setting for apps by using the "App Ads Helper" function from developers.facebook.com.
https://developers.facebook.com/tools/app-ads-helper
Second, so I obtained the good result by using "DeepLink Test" provided by"App Ads Helper".
And I could see what i want (AppLinkData)
06-04 12:58:25.598 11903-11925/? I/DEBUG_FACEBOOK_SDK﹕ Bundle[{com.facebook.platform.APPLINK_NATIVE_CLASS=, target_url=myapp://myapp.co.kr?test=1111, com.facebook.platform.APPLINK_NATIVE_URL=myapp://myapp.co.kr?test=1111}]
Third, here is the code what I used.
protected void onCreate(){
....
FacebookSdk.sdkInitialize(getApplicationContext());
AppLinkData.fetchDeferredAppLinkData(getApplicationContext(),
BSTracker.getInstance().getFacebookIdMeta() ,
new AppLinkData.CompletionHandler() {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
Bundle bundle = appLinkData.getArgumentBundle();
Log.i("DEBUG_FACEBOOK_SDK", bundle.toString());
} else {
Log.i("DEBUG_FACEBOOK_SDK", "AppLinkData is Null");
}
}
});
}
Finally. This is My App Setting
Ad Setting
It is My Ad setting.
i did input the DeepLink in "Get install of your App" Ad Product.
# Problem
When I created commercial ad at Facebook and released for the audience but I can't get Deferred DeepLink.
Please let me know, anything is wrong with it.
How to show a Dialog after crash by using Crashlytics.
for example: after crash I need open a dialog where user will put any comment(note) how he did that crash.
Is any option in Crashlytics?
Yes, definitely. It's also extremely easy.
Crashlytics.getInstance().setListener(new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution() {
// now it's the right time to show the dialog
}
});
Crashlytics.start(context);
EDIT (Deprecated as of July 2015)
If you're using the new Fabric integration, the code is slightly different (as seen here). It should look like this:
Fabric.with(this, new Crashlytics());
Crashlytics.getInstance().setListener(new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution() {
// now it's the right time to show the dialog
}
});
EDIT 2 (The latest Fabric SDKs have deprecated the setMethods)
final CrashlyticsListener listener = new CrashlyticsListener() {
#Override
public void crashlyticsDidDetectCrashDuringPreviousExecution(){
// now it's the right time to show the dialog
}
};
final CrashlyticsCore core = new CrashlyticsCore
.Builder()
.listener(listener)
.build();
Fabric.with(this, new Crashlytics.Builder().core(core).build());
To test your integration, you can simply call Crashlytics.getInstance().crash(). Simple but handy.
Hi I am running ADMMessenger sample application provided with SDK.
in which I am not able to get Registration ID in register() method of MainActivity.
Method is like this.
private void register()
{
final ADM adm = new ADM(this);
if (adm.isSupported())
{
if(adm.getRegistrationId() == null)
{
adm.startRegister();
} else {
// final MyServerMsgHandler srv = new MyServerMsgHandler();
// srv.registerAppInstance(getApplicationContext(), adm.getRegistrationId());
}
Log.v("log_tag","Reg_id:: "+adm.getRegistrationId());
}
}
in Log cat I am always getting Reg_id:: null
and onRegistrationError() method of SampleADMMessageHandler is calling.
and error at there is ERROR_SERVICE_NOT_AVAILABLE
I can not understand what is problem, please help me.
For the service to work correctly you need to be using the Kindle image (not a generic Android one) and also make sure you have logged into your account on the device (pull down the status bar at the top and ensure you have selected an account)
i am attempting to implement a built in controller that is part of the scoreloop library. the documentation states:
Basic Usage:
To invoke the TOS dialog if it was not accepted previously, the following code may be used:
final TermsOfServiceController controller = new TermsOfServiceController(new TermsOfServiceControllerObserver() {
#Override
public void termsOfServiceControllerDidFinish(final TermsOfServiceController controller, final Boolean accepted) {
if(accepted != null) {
// we have conclusive result.
if(accepted) {
// user did accept
}
else {
// user did reject
}
}
}
});
controller.query(activity);
but when i paste this into my code i get the following syntax errors:
am i using this incorrectly? how and where would this be used any ideas?
EDIT: after moving the statement to the method where i want to show the dialog i now get the following error:
You seem to be calling controller.query(activity) in a class body where a declaration is expected. Move the statement controller.query(activity) to a method where you would like to show the dialog.