Android PlusOneButton does not initialize - android

I am trying to include a PlusOneButton to my Android App.
I created the app on google cloud console with the SHA-1 from my debug.keystore as described by google (https://developers.google.com/+/mobile/android/getting-started?hl=en).
In my XML-Layout I add the +1-Button:
<com.google.android.gms.plus.PlusOneButton
android:id="#+id/btnPlusOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
plus:size="standard" />
In my Activity I override onResume() method. Of course I retrieve the object via findViewById(...) first:
public void onResume() {
super.onResume();
btnPlusOne.initialize("http://www.google.de", REQUEST_CODE_PLUS_ONE);
}
I also give the permissions in Manifest:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
But if I start my app, the PlusOneButton looks gray. If I click on it, a progress bar appears in the button and runs infinitely. On Logcat I get this message:
18367-18367/? W/PlusOneButtonView﹕ Failed to establish connection with status: 8
If I check this in API-Doc (http://developer.android.com/reference/com/google/android/gms/common/ConnectionResult.html#INTERNAL_ERROR) it says something like internal error. But currently I have no idea what could solve this problem?

With new Google Play Services 4.1 release this issue was solved in my case.
https://code.google.com/p/google-plus-platform/issues/detail?id=704

The button is frozen because with the new update of google play services library, you can only +1 when the user is signed in.The previous library was better as it signed in the user when clicking +1 button but with the new one you have to first sign in the user then the google plus button will be activated. Fellow googlers told me they are working on the fix but we still dont know when the update will be ready.
So if there is a need for google plus sign in, you can include sign in button, then the plus one will work fine but it looks irrelevant to add sign in button just for plus one. I hope Google will fix this soon.

Related

No permission to access this object error

I am trying to upload files using firebase. The code works fine on devices with only internal storage but while trying on devices with external storage(SD card) it shows User does not have permission to access this object. Code: -13021 HttpResult: 403 error.
My manifest file contains following permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
The default security rules for storage buckets require you to sign in with firebase authentication. You can use any authentication method. At a minimum, you must you anonymous signin by:
enable anonymous signin in the "Auth" tab of the Firebase website
follow the steps here to add code to sign in: https://firebase.google.com/docs/auth/android/anonymous-auth#authenticate-with-firebase-anonymously
You can also set your rules to allow access to anyone -- including those who have not yet authenticated. But this is not recommended as your data will not be secure.
You will just need to use request.auth in your rules instead of just auth.
See StorageException: StorageException has occurred. User does not have permission to access this object.
Also Secure User Data to get more idea.
I hope its helps you.
Check if target SDK version in build.gradle is 23, if so you need to implement runtime permissions or change it to 22
Do not build your project with targetSdk set to anything higher than 22 if your project requires additional permissions, because you must then support Runtime Permissions. As a quick solution, change targetSdk to 22, clean and rebuild your project and you will be fine.
1.Go to your firebase console
2.Go to your app
3.Click on the authentication button in the left hand side
4.Click on the sign-in method tab
5.Hover on the anonymous item below in the list
6.Click on the pencil button at the right side of the item
7.Click on enable and then save
This should work
just go to the authentication and allow sign in method for anonymous and your problem will completely finish

Facebook on Android — Debug popup Hashkey keep appear

I'm trying to add the Facebook API in my application. I build it in ActionScript3-AIR to proceed an export on iOS/Android and use the GoViral API to apply the connection with Facebook.
After the creation of the application on Facebook Developer, it works on iOS, but not on Android.
When this line is read GoViral.goViral.initFacebook( XXXXXXX ), on Android, the application show a popup which display the Key Hashes Here, the screenshot:
Then, nothing happen. The connexion don't seem to be done and, if I try an authentication with GoViral.goViral.authenticateWithFacebook( "user_likes,user_photos,publish_actions" ) it does nothing. And by that, I really mean nothing in the way that it don't even return the GVFacebookEvent.FB_LOGIN_FAILED event.
I used the "Mail It" button on this popup. Took the hash key and pasted it in the Android section of my application in the Facebook Developer Here, the screenshot:
But, nothing changes and the popup always appears.
After that and by the results of some google research, I've try to make my own Hash Key, helped by some tutorials. The Key has been generated but didn't correct anything about the popup.
So, actually, I'm a little confuse about this issue.
Especially as I've try to put another fake App ID in the initFacebook method : the popup continues to appear. So I wonder if it can really see it.
For information, I created the application project on the Google Developers Console.
The manifest I use to apply the Facebook API is this one :
<uses-sdk android:targetSdkVersion="12"/>
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application>
<activity android:name="com.facebook.LoginActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="Login"/>
</application>
Thanks a lot to help me to fix this issue.
------ EDIT ------
I found the problem about the Debug Pop-up with the Hash Key. It was relative to the GoViral API which ( I didn't know this ) has two version : One normal and one for the debug which always makes appear the hash key in a pop-up at connection.
The Facebook connection still not working, but it's sound to be another problem so I can say this problem is solved.
I've found the solution which is way simple than I imagined. In the sources of GoViral, there was two ANE, I used the one which was makes for debug. It makes appear the popup to give us the hashkey. After what, we have to put the other ane to make it work.

Deep link shares to Google+, but link does nothing

I'm trying to use deep-linking from Google+ into an Android app, following http://developers.google.com/+/mobile/android/share/deep-link.
I can share to Google+. The link in the post is "clickable" (it highlights during touch), but does nothing on release. Also, the post contains a suspicious "undefined" line of text.
sample http://raw.github.com/concreterose/TestDeepLink/master/README_ASSETS/sample_share.png
I have enabled deep linking in Google Developers Console project credentials.
I'm using a signed-in PlusClient created with Scopes.PLUS_LOGIN, posting via:
Intent shareIntent = new PlusShare.Builder(this, plusClient)
.setText("Testing deep link")
.setType("text/plain")
.setContentDeepLinkId("deeplink",
"title",
"description",
Uri.parse(thumbnailUrl))
.getIntent();
startActivityForResult(shareIntent, 0);
I'm not sure if I need all of these, while trying to get things working I have:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
The handling activity (given as the first activity in the manifest):
<activity android:name=".ParseDeepLinkActivity">
<intent-filter>
<action android:name="com.google.android.apps.plus.VIEW_DEEP_LINK" />
<data android:scheme="vnd.google.deeplink" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
is:
public class ParseDeepLinkActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate");
throw new RuntimeException("got here");
}
}
I'm building with the release keystore and testing on a several real devices running 4.4.
I've tried:
Using the PlusShare.Builder(activity) constructor (without plusClient), no change.
Using addCallToAction(label, uri, deeplink) instead of setContentDeepLinkId. There is no call to action button, and clicking the post goes to uri and not the deep link.
Triple checking "Deep linking: Enabled" is set correctly in the developers console.
Building without proguard, no change.
Uninstalling the app then clicking the link (supposed to open the play store entry), does nothing.
Signing with a different key. Plus sign in fails (as expected).
Using different versions of play services (4.0.30 vs 3.2.+).
adb shell setprop log.tag.GooglePlusPlatform VERBOSE does not generate any log messages.
Fetching my API access token and verifying it has auth/plus.login, it does.
Can anyone tell me what I'm doing wrong? Thanks!!
Update: This is now working, apparently fixed by a Google Play Services update.
It turns out this a known issue that will be fixed with the next Google+ update:
Google+ Interactive shares on android are broken in version 4.2.4.58179886
Its generally best to share a URL marked up with schema.org rather than passing the title, description and image. Because there is no URL, the link will never be clickable on web (you need to use setContentURL to have that) - but it should open the application on Android.
That said, the undefined does indeed look suspicious. There are two concerning things there, the first being that the link doesn't work, and the second that description is no longer generally shown in regular shares. There is a known issue with interactive posts to Android, which hopefully should be resolved early in the new year, and I am wondering if that is also effecting the sharing of deeplinks.
To narrow it down, could you try testing with schema.org marked up URL in setContentURL (e.g. https://developers.google.com/+/web/snippet/examples/thing), and passing null for title, image and description on the setContentDeeplink call?

Map not being displayed after refactoring to change the name of the project and package

I'm close to finish my first app so I change its name and the corresponding packages. To do so, I used the Android Tools from Eclipse and everything works after one or two attemps (there where a couple of things that I had to change manually), but in general, following the comments from this response, there were not further problems. Except for the Google Maps. Now they are not being displayed anymore and I'm getting the following error:
Google Maps Android API(12251): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I know that there is no connection problem because I'm getting other kind of info from the internet and because the following sentence is true:
int availabilityCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(availabilityCode == ConnectionResult.SUCCESS){
The first thing that I did was to go to the Google API and change the package name in the place where you generate the key to make it match the new one. That didn't work, so I deleted the key and created a new one. I pasted the new API key in the Android Manifest but it is not working. Any clues? I'm missing any steps?
In the manifest I still have the needed permissions set, like
<permission
android:name="com.alvarosantisteban.pathos.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
etc.
I think it was a combination of the three things commented here:
That the api key was not valid anymore (but when I posted the question, I already had that done, as I mentioned on it)
But specially that I had to clean the data. I actually deleted the app, because, thanks to the help of android_hungry I went to check my apps and saw that my app appeared two times, one with the maps workings and the other one, the one that is on my desktop as a shortcut, not.
Additionally, it might have happened what silver_man mentioned, I'm not sure.
Thanks to all for the help. :)
You have to create a new api key, as the fingerprint is made from your package name. https://developers.google.com/maps/documentation/android/start?hl=es#obtaining_an_api_key

Tasks API and OAuth 2.0 on Android sample

i'm very new to android devolopment
i tried to run the sample project given in this example
http://code.google.com/p/google-api-java-client/source/browse/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java?repo=samples
but when i run it, it gives a force close error. after a messing around i figure that it has only list activity not activity class as others. why? how to fix it?
. my idea is to create a android software which i can push tasks from the server to the app then the app will add those as tasks in the phone? any sample apps like that?
Maybe you forgot to set the permission for Oauth?
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
New Task sample required Google Play Service Library to run you need to set up it and added into build path of your application.

Categories

Resources