DropBox in Android Application - java

I am pretty new to Android and am trying to have my android app to have access to the Dropbox on the same phone. I would want to have the authorization happen on the first activity that shows up on my app.
I've tried looking at the DropBox API information on their developers site but they don't have any details on how to implement authorization (just on how to loop through files etc..not that helpful)
I have tried looking here at: https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/DropboxActivity.java#L22
But I can't even have FileThumbnailRequestHandler.java class compile since Picasso.LoadedFrom.NETWORK returns a LoadedFrom and not an integer.
I'm pretty stuck and theres not a lot of documentation online on how to implement so help would be VERYYYYY appreciated!

To use Dropbox API v2 in Android, we recommend you use the official Dropbox API v2 Java SDK:
https://github.com/dropbox/dropbox-sdk-java
There isn't a step by step tutorial for that in particular, but there's an example Android app that uses it included with the SDK, with instructions for running it:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
Though, it's probably easier to just install a released version of the Dropbox SDK rather than compile it locally, as long as you don't need to make changes to the Dropbox SDK. That is, in build.gradle, replace:
implementation group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '0-SNAPSHOT', changing: true
with:
implementation 'com.dropbox.core:dropbox-core-sdk:3.1.3'
You should refer to that example app as an example of how to implement the app authorization flow, which is accomplished via OAuth 2.
Your AndroidManifest.xml should be set up as shown here:
https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/AndroidManifest.xml#L33
You start the flow by calling startOAuth2Authentication as shown here:
https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/UserActivity.java#L34
You complete the flow by calling getOAuth2Token as shown here:
https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/DropboxActivity.java#L22
Your app can store and re-use the resulting access token for that user, as the example does here:
https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/DropboxActivity.java#L25
Make sure you follow the instructions for installing the SDK. Gradle or Maven should automatically install the right versions of the dependencies for you. I just tried it and it worked for me. That is, I didn't get the Picasso compilation error you mentioned, so I suspect you have a different version of the dependency installed.

Related

How can I get the newest version of google play services on an AVD?

I'm trying to develop an Android app that has a native Google Maps control. Seems simple enough, but unfortunately I've run into a lot of trouble setting it up.
I have very carefully followed the instructions here multiple times with no success. Every time I try to load up my app, I get the message <my app> won't run without Google Play services, which are not supported by your device. I have confirmed in the settings that I do in fact have Google Play services on the device.
I have tried to uninstall and reinstall downloaded google services apk's, but abd does not allow me to uninstall it with the error DELETE_FAILED_INTERNAL_ERROR, I assume it is because I don't have root access.
You need to update your SDK and install the latest Google Play Services library under "Extras" section. The AVD can be launched using "android" binary under your SDK tools folder.
So I found the answer to my own question. I made a dumb mistake...
In my manifest, I entered my api key where it says API_KEY: android:name="com.google.android.geo.API_KEY but it should just be API_KEY. Changing this, and using Google Play services 9 instead of 10 fixed it.

AppWidget provider cannot see layout

I decided to add a App Widget to my application , I follow this guide on official Android developer page (link). Done everything what they have there and still I get this error:
I have my app-widget provider in /res/xml. Having widget layout in /layout folder and having AppWidgetProvider.java in Java folder.
So everything should be fine. Also I am using latest Android Studio with latest SDK (23) and latest build tools (23.0.2) and also using appcompat-v7 suppport library.
I pasted code from the page, just to be sure everything is in order. Seems like it's not.
I am frustrated after several hours of trying everything. My appplication is long term project, I am almost at the code version 200, so I have some experience, but not with this. I also read almost the whole thing.
PS: Any code would be useless to post in here, since it's the same code from that official Android Developer page. I wanted to do "prototype", which I can then customize to my needs. I never worked with widgets.

Making IPTVCore to work

I am new to android and java development although I am an expert with IPTV and I have made the biggest Greek and Cyprus IPTV but since there is a lack of Greek IPTV android apps I decided to make one application.I found IPTVCore on playstore which is made by the developer of the IPTV app.In the description it has a link on an app that uses iptv core github
I downloaded the zip changed the icons and renamed the files. In MainActivity.java I removed the first comments and added my playlist url and changed package name.
I have android studio and eclipse with android addons.
How to make it an apk?
If you mean to simply be able to load it onto a devices to test then both Eclipse and Studio will allow you do this when you elect 'Run' and have a device attached via the USB (with USB debugging enabled). This will actually install the apk on your device so you can test it.
If you mean actually making the apk available for others (via the play store for example) then you should look and the Android publishing documentation:
http://developer.android.com/tools/publishing/publishing_overview.html
In very broad terms, you develop the app, build it, test it etc and then when it is ready for release you build it for release (remove all debug code, test data etc), sign the app, and release it via a marketplace like Play Store, or avi email or your own web site.
One important thing to remember is to version the app properly - the is important for all the obvious reasons (users or support wanting to know the version) but also because the marketplace update mechanisms may use it to check what versions can be updated etc.
Update - answering the question in the comment below:
There are two approaches suggested in the Readme file with the project:
To build you custom IPTV app you can do one of the following:
Clone iptv.example project, change app name, launcher icon, and
package name.
Blockquote
Create new Android project with empty activity and use
the code from MainActivity.java
The second one might actually be simpler for you if you know how to create a simple Android project - just do that and then replace the MainActivity code in the newly created project with the code in the MainActivity file (the only java source file) in the githib project you have downloaded.

Google Maps fragment activity

I am really sorry to ask such a bland and stupid question, but I am having the greatest of frustrations with trying to load the Google Maps project library into my project resources.
I have downloaded all the tools and necessities needed from the SDK to get Google Maps.
However, whenever I try to load the Google Maps library, I get 2 errors.
The first is that for some reason,
the Class known as FragmentActivity is missing. I have no idea what
it is or where to find it to get things going with an Android project.
The second distinct problem is that the console shoots off the following message:
"google_maps] Unable to resolve target 'android-16'"
Although I have a fairly strong idea of what this means, I don't quite know how to troubleshoot so that the library is built towards the desired API level.
I do apologize as I am new to Android and absolutely love the platform, but this one really has me dumbfounded. Any and all information and suggestions is always most appreciated.
Thanks and once again, sorry for asking something so silly.
Well for the first question:
FragmentActivity is part of the google-support-v4 library and designed for application that are developed to SDK < 11 for supporting fragments. So you didn't added the referencing of this library to you project.
you can get a better idea of the imports you need to make and how to make them by reading this
blog post I wrote on Google Map API V2:
Google Map API V2 guide
about your second question, you probably trying to run this project against an API level you didn't downloaded from the SDK Manager, you have two options:
downloaded the needed API package from the SDK Manager.
right click on your project -> Properties -> Android -> change the project build target to a target that you have its API level downloaded.
Try this answer, Generate Google Map key for android - step by step.
Or take a look to this very helpful step by step tutorial. I struggle for 3 days with the maps stuff, but that tutorial showed me the light.

phonegap 1.0 android facebook plugin login fail

i'm adding facebook post button to my app (phonegap 1.0), it seems that the only method to have this working is using the plugin here:
https://github.com/jos3000/phonegap-plugins/tree/master/Android/Facebook
But it's not working for me, first i saw in the log PluginManager not found, reading the docs it seems plugins are not being loaded like that anymore.
But the intent and dialog of facebook appear when calling
window.plugins.facebook.authorize(appID, function(res){...})
I can see the facebook page being loaded but just after it finished the page automatically goes back with no response.
Anyboy has used succesfully this plugin??. actually the whole phonegap-plugin system seems to be very buggy... but i can't change the framework right now all the rest of the app is working.
At the end i managed to have it working by changing the Facebook authentication option in the java file, not using single sign on.
By the way i do NOT recommend phonegap... it seems to me the library is still full of bugs
I've only ever had very minor issues working with PhoneGap and iOS. Most we were able to find quick workarounds to resolve.
The issue is Android itself. I'm trying to avoid supporting it until Google steps in and enforces standards on every phone device manufacturer. Otherwise, you're guaranteeing yourself a swiss cheese codebase to deal with workarounds on every single device out there.

Categories