I am share to bitmap into facebook all are working fine when app is installed in mydevice.problem when app is not in installed in device.Why this happen i didn't understand.I am using HelloFacebookSample.Java
and i am adding following code Into Manifest.xml file
<activity
android:name=".HelloFacebookSampleActivity"
android:screenOrientation="portrait"
android:theme="#style/AppBaseTheme"/>
<activity android:name="com.facebook.LoginActivity" android:screenOrientation="portrait"/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/app_id"/>
<provider android:authorities="com.facebook.app.NativeAppCallContentProviderXXXXX92272288220"
android:name="com.facebook.NativeAppCallContentProvider"
android:exported="true"/>
and am adding all permissions also.I am research alot i didn't findout mistake where i done.Advance thanks to all .Sorry ,to my poor english.
When the app is not installed, you can do one of two things:
fallback to a web dialog, but there's no support for sharing a bitmap via a web dialog, so you can only share a link.
Ask for the publish_actions permission, and upload the photo via the Graph API (see https://developers.facebook.com/docs/reference/android/current/class/Request/#newUploadPhotoRequest).
You should always wrap your FacebookDialog calls with a canPresentShareDialog check. See the sample code https://developers.facebook.com/docs/android/share or in the HelloFacebookSample. It will tell you if the share dialog feature is available (if the app is installed and it's of the right version), and you can decide the proper fallback technique to use.
Related
I have Implemented google pay using stripe payment processor and it is in test Environment. When I used to test google pay with real card payment it shows a dialog box that
"Request Failed"
UnExpected developer error, Please try again later.
I am unclear why this error is showing. How to resolve these issue. Can Anyone help me out?
Manifest file
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="myproject"
android:roundIcon="#drawable/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
More detailed information is shared in the logs. Make sure to remove any process/application specific filtering, since these logs emanate away from your application. If you filter using a keyword such as "wallet", you should be able to see more specific hints into your problem.
Let me know whether that helps.
The Android Facebook SDK is always making a network request to graph.facebook.com when calling FacebookSdk.sdkInitialize(context) even if nothing of the SDK has been used yet.
So if we're initializing it in the Application.onCreate() there will always be at least one network request. Even if the setting is as follows:
<meta-data
android:name="com.facebook.sdk.AutoLogAppEventsEnabled"
android:value="false" />
We've took a closer look at this because a user complained that he is not using the Facebook Login (which is why we have the Facebook SDK in the first place) and still there is "user data" transferred to Facebook. In times of GDPR and suspicious users, this is a very unfavourable behaviour!
What we're doing now is calling FacebookSdk.sdkInitialize(context) only when the user wants to use the Facebook Login (at the time when the user clicks on the button). Additionally, we removed the meta-data for android:name="com.facebook.sdk.ApplicationId" from the AndroidManifest. This prevents the initial network request but then there is the following crash appearing in the CurrentAccessTokenExpirationBroadcastReceiver:
java.lang.RuntimeException: Unable to start receiver com.facebook.CurrentAccessTokenExpirationBroadcastReceiver: The SDK has not been initialized, make sure to call FacebookSdk.sdkInitialize() first.
at com.facebook.internal.Validate.sdkInitialized(Validate.java:143)
at com.facebook.FacebookSdk.getApplicationContext(FacebookSdk.java:518)
at com.facebook.AccessTokenManager.getInstance(AccessTokenManager.java:86)
at com.facebook.CurrentAccessTokenExpirationBroadcastReceiver.onReceive(CurrentAccessTokenExpirationBroadcastReceiver.java:34)
Now there are several questions:
Why is Facebook still making a request at start? If they want to validate the auth token, they can do it as soon as the SDK is really used...
Does Facebook know and tolerate crashes when sdkInitialize() is not called? Because I fear when this NullPointerException is removed there will be other crashes...
Most important: Are there any other ways to prevent network requests from the Facebook SDK when its features are not used?
I have noticed that the Facebook SDK (at least in version 4.33) adds a provider (com.facebook.internal.FacebookInitProvider) in the manifest of your app, which automatically calls FacebookSdk.sdkInitialize with the application context.
Even if you have added:
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false" />
in your manifest, at least 2 requests will be made to Facebook:
a graph request to get app settings
an Events request "fb_sdk_initialize" which logs all the Facebook frameworks that are included into your app
So to prevent these requests (that we don't want as long as the user didn't allow them (GDPR)), I think you did everything we need to do:
Do not add <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/> in the manifest
Add <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false"/> in the manifest
Only initialize Facebook SDK when you need it.
Like this for example:
FacebookSdk.setApplicationId(<context>.getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(<context>);
AppEventsLogger logger = AppEventsLogger.newLogger(<context>); // I don't use FB Login for my project but app events.
But regarding your crash, I don't know why it happens since it seems that the broadcast "com.facebook.sdk.ACTION_CURRENT_ACCESS_TOKEN_CHANGED" is sent locally.
Nevertheless, I think you can prevent it by adding this to your manifest:
<provider
android:name="com.facebook.internal.FacebookInitProvider"
tools:node="remove" />
<receiver
android:name="com.facebook.CurrentAccessTokenExpirationBroadcastReceiver"
tools:node="remove" />
However, doing this may have bad consequences with the use of Facebook SDK and I think you will have to provide (and register in your manifest) your own BroadcastReceiver:
public class CustomCurrentAccessTokenExpirationBroadcastReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
if (AccessTokenManager.ACTION_CURRENT_ACCESS_TOKEN_CHANGED.equals(intent.getAction())) {
new CurrentAccessTokenExpirationBroadcastReceiver().onReceive(context, intent); // Call it only if you have initialized the Facebook SDK!
}
}
}
According to Facebook Support,
If you would like to temporarily disable automatic events collection, such as to get end-user consent before collecting data, you can set the value of AutoLogAppEventsEnabled to false in the app's AndroidManifest.xml in the application tag.
For example:
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false"/>
To re-enable collection, such as after an end-user provides consent, call the setAutoLogAppEventsEnabled() method of the FacebookSDK class.
For example: setAutoLogAppEventsEnabled(true);
If you need to suspend collection again for any reason, you can call setAutoLogAppEventsEnabled(false); and collection will be suspended until re-enabling it.
I have setup Facebook sharing with the below, build type specific content provider:
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderXXX${applicationId} ...
applicationId is different per build type, so that I am able to run debug and live builds side by side on one device.
This setup gives me an error on Facebook (image file) sharing:
IllegalStateException: A ContentProvider for this app was not set up in the AndroidManifest.xml, please add com.facebook.app.FacebookContentProviderXXX as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.
How can I overcome this problem? How can I get Facebook to take into account my applicationId?
You Manifest code look like below for facebook login and sharing:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/{facebook_app_id}" />
<!-- To use Facebook Login or Share, also add the FacebookActivity to the manifest:-->
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<!-- If you're sharing links, images or video via the Facebook for Android app, you also need to declare
the FacebookContentProvider in the manifest. -->
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider${facebook_app_id}"
android:exported="true" />
NOTE:
Your app is currently live and available to the public.
Follow below step to make your facebook app live and public:
1) Goto https://developers.facebook.com/
2) Select your app and goto App Review tab.
3) Check YES for Your app is currently live and available to the public. option.
See I am new How do I make my app live on FB
Your “applicationId” probably is "com.myname.blabla", and XXX your facebook app id?
I think you should switch to using 2 facebook APP_ID's, and not "applicationId". Put the facebook APP_ID's in your build types and reference them in your manifest. You then don't need to add the "applicationId" from your app.
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider${FACEBOOK_APP_ID}"
android:exported="true" />
Try with this:
If your APP_ID is 95xxx3xx60xx73xx, then it should be like:
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider95xxx3xx60xx73xx"
android:exported="true" />
For more information, you can follow this link.
I have made an app in flash for android and I have followed everything as said here: http://www.adobe.com/devnet/air/articles/admob-ane-android.html to show ads in my app, but the ads ain't showing up, if I place this code:
if(AdMob.isSupported)
{
AdMob.init("my publisher id");
}
else
{
trace("AdMob won't work on this platform!");
return;
}
AdMob.addEventListener(AdMobErrorEvent.FAILED_TO_RECEIVE_AD,onFailedReceiveAd);
function onFailedReceiveAd(e:AdMobErrorEvent):void
{
trace("Ad failed to load.");
}
AdMob.showAd(AdMobAdType.BANNER,AdMobAlignment.LEFT,AdMobAlignment.BOTTOM);
above all the other code nothing works anymore and if I place this code below all the rest code the app works but the ads never show up, does someone know how I can show my ads??
AdMob.isSupported will always return false if you're testing on the simulator. So you've to test on device to be able to test AdMob in general.
I manage to notice that milkmangames Admob ANE has some issues. Just out of the sudden no ads and i mean not a single ad is displayed under intervals of time. milkman games ads aren't displayed without notice. At first i thought it was google fault but unity ads are working perfectly. People are loosing serious amounts of money because of this.
Perhaps google is blocking ads for milkman games ANE?
I had a similar problem, and wrote to Milkman. They politely suggested I read the manual - GettingStarted.pdf, and sure enough, in there is a note about setting up your -app.xml properly.
You need to include certain manifestAdditions in the android section of -app.xml:
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<!-- this meta-data tag is required for AdMob -->
<meta-data android:name="com.google.android.gms.version" android:value="4452000"/>
<!-- this activity is required for AdMob -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
</application>
</manifest>
]]></manifestAdditions>
</android>
I am using inmobi in my android application.
For that i am using InMobiAdTrackerAndroid.jar with this jar i am following documentation.
1: We are using following codes inmy application Launcher class
IMAdTrackerUtil.setLogLevel(LOG_LEVEL.VERBOSE);
IMAdTrackerAnalytics.getInstance().startSession(getApplicationContext(),Constants.INMOBI_APP_ID);
2: We are using this constants in place of above bold text
public static final String INMOBI_APP_ID = "5cd90875-04c7-476d-aa6e-ee7cf0ac70f6";
3: In AndroidManifest.xml class we add following code
<receiver
android:name="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
4: InMobiAdTrackerAndroid.jar is the library which we are using for inmobi and this library is added in build path.
On InMobi site in Reporting i am not getting an Application's name.(Application is present in DashBoard not present in Reporting)
I tested application using qrcode of my application and it forwarded me to google play where my application is present.
So what is the reason my application is not showing on Reportings.
here i a using samsung Tablet with sdk version 11.
You need to make a call to
IMAdTrackerAnalytics.getInstance().reportInstallGoal()
and
IMAdTrackerAnalytics.getInstance().reportGoal("Any custom goal").
Then you will see the reports in the UI.
Install goal and all other custom goals defined by you,needs to be reported by the api call.
Also dont miss the following activty in the manifest
and the required permissions.
Hope this helps.