Tasks API and OAuth 2.0 on Android sample - android

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.

Related

Installation failed with message INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE possibilities

(if you came here by googling looking for a solution for this error,below links will give you an answer,also my question has kind of an explanation!)
Possible duplicate of
INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE
Error -505 INSTALL_FAILED_DUPLICATE_PERMISSION
Wait!
I got this error today in a live project.User came with the 505 error unable to install the app.Then i ran it on IDE!
If you download an app with this mentioned issue from play store you will get an error with 505 when you try to install.
If you try to run it using your IDE you will get the error like in above image! (correct me if I am wrong)
Then I was looking for reasons.
This was my issue!
<permission
android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="in.wptrafficanalyzer.locationroutedirectionmapv2.permission.MAPS_RECEIVE" />
Surprise thing was another developer's app on a particular users phone used the same signature! Damn, those copy pastes met each other today!!
I think if I try to declare same permission in two applications with
same package name this error can occur.(correct me if I am wrong)
Here are my 2 questions?
1.Do they need to be with the same permission? anyway they will get this thing when its same. lets say app A users a pkg.name with permission permission.RECEIVE app B use same package with another permission CONFIGURE_SIP.Can this occur when they meet each other?(seems like a stupid question but I want to confirm the other app that was there in the client's mobile had the same thing!)
2.What are/is there any other the possibilities that this error can occur?
An application defines a custom permission using signature level security
You attempt to update the installed app with a version signed with a different key
The test device is running Android 21 or newer with support for multiple users
Got those 1 2 3 from this post ! Are they true? If yes any good explanation about them will be great or any additional reason for this error?
There are many good answers in the mentioned posts!Not asking how to fix this! But how it gets generated! Also if I mentioned/understood something wrong please do note it down!!
Thank you.
Edit : As I mentioned please note that the issue came form an app which is already in the Play Store. And about the other app I have no idea! It's there in the client's mobile.Probably its also from play store because even developer options was not activated till I try to run on that mobile.He did not had any previous apps from my company as well.He just tried to download the app got 505 error and came to fix it.
And also my first option was the removal of that permission an it made the app install successfully(not the right thing but to confirm where the issue was). That is the reason that I need to know the possibilities of this error!
#commonsware blogs has explain it in details in Custom Permission Vulnerability and the 'L' Developer Preview:
Near as I can tell, the “L” Developer Preview requires that all apps
with a <permission> element for the same android:name value be signed
by the same signing key. The actual protectionLevel or other values
inside the <permission> does not matter. Even if they are identical, an
app trying to define the <permission> will fail to install if an
existing installed app already defines the <permission>. Specifically,
the installation of the second app will fail with an
INSTALL_FAILED_DUPLICATE_PERMISSION error.
Here the answer from #commonsware: https://stackoverflow.com/a/11730133/4758255
Your problem isn't permissions. It's impossible to have two apps with the same manifest package name.It must be unique. So system think that user try to reinstall/update old app with new signing certificate. From android developers blog
If the signing certificate changes, trying to install the new application on to the device will fail until the old version is uninstalled.
EDIT:
I run some tests with permissions. I think, behavior is very similar with application package name. Error occur only if 100% matching. Results:
app A(package test.test) vs app B(package test.test2)
package="test.test">
<permission
android:name="test2.example.h"
android:protectionLevel="signature" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.test2">
<permission
android:name="test.example.hr"
android:protectionLevel="signature" />
permission A - test.example.h vs B - test.example.h - DUPLICATE_PERMSSIONS error
test.example vs test.example.h - success
test.example.g vs test.example.h - success
uses-permission doesn't affect on errors/installations. But I think you can get SeciurityException in runtime, if try to use others permissions.

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.

Android PlusOneButton does not initialize

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.

Android RevMob Can't Display Advertisement

When i integrated the RevMob into my application, it shows me the following error :
No ads for this device/country right now
Is there a way to solve that issue ?
Do you give permition in manifest<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
It means what it says. Revmob doesn't have any publisher for your country. Revmob has invested much in gaining developers rather than advertisers, thus they have lack of ads sometimes.
Just to check if you have done everything fine, try using VPN on your device for UK or US. They normally have ads for those countries.
To check the implementation you can use the test mode:
EnvironmentConfig.setTestingMode(true);
This is described on the sdk documentation http://sdk.revmob.com/android
It can be a temporary outage of campaigns for your device/country etc. It must be solved in the server/sales side automatically. But you can check your implementation using the testing mode, like Diogo said.
In the newest versions, you must use the following code:
RevMob revmob = RevMob.start(this, APPLICATION_ID);
revmob.setTestingMode(RevMobTestingMode.WITH_ADS);

Categories

Resources