Android Open and Save String to/from Google Drive SDK - java

I have read allot about Google drive integration and I want to save STRING into Google drive and also to retrieve, I have used this demo but it is giving me errors.
please anyone provide me demo for my requirement

First, let's clear the confusion here. Your original question refers to a demo that uses the original RESTful API (aka DriveSDKv2), where Simple Plan mentions a different API, the new Google Drive Android API (GDAA).
The GDAA, does not have the full functionality at the moment, but it can be combined with the DriveSDKv2 to supplement what's missing (delete, description, indexable, ...). On the other hand, the GDAA takes care of all synchronization, offline and caching issues. You just create, retrieve, update the files as if they were local and the magic of up/down synchronization is left to GDAA. And the missing functionality is promised soon.
If you decide to dive into GDAA, there are 3 demos available on Github at the moment:
quick start
full-blown demo
trivial example with wrapper class to create, retrieve files/folders
Both demo and trivial examples have the create functionality with a text written to a file. If you pull any of them and step through, you'll get the idea.

Related

Integrating 3rd party API with jhipster based webapp

I am trying to build a simple web app using jHipster. Currently I am trying to build a simple stock entity that will enable a user to input the stock name and the entity should generate a listing of that stock with open, high, low and close data. I am unable to figure out how to integrate the web app with a third party API that supplies the data. I could not find any documentation regarding this issue online. Thank you.
I found this tutorial on implementing API's that might help.
What you need to do is create an HTTP client that can access your API.
I'm not too familiar with jHipster but finding the proper library to import seems like a good first step. Good luck.
Source:
https://zapier.com/learn/apis/chapter-8-implementation/
If you aren't sure which language to choose, a great way to narrow down the selection can be to find an API you want to implement and see if the company provides a client library. A library is code that the API owner publishes that already implements the client side of their API. Sometimes the library will be individually available for download or it will be bundled in an SDK (Software Development Kit). Using a library saves you time because instead of reading the API documentation and forming raw HTTP requests, you can simply copy and paste a few lines of code and already have a working client.

How do you store app data locally using android studio?

I'm just getting started in android studio and app development overall. I've done a few tutorials to learn the interface and basics for Android Studio (activities, textviews, buttons, etc) and I've taken a college course in Object Oriented Programming in Java. Now, here's what I'm trying to do:
I'm making a very basic app that's meant to help the user budget their money. The app "acts" as your account and you add the amount of money you've recently been paid. From here, you can allocate your money to savings, checking, and so on. The data I need to store would be the numbers representing dollar values, the different allocations the users made, and the respective dollar amounts to those allocations.
I've managed to contain the data relatively fine within the Java data structures (I developed some algorithms in eclipse to get started). Do I need to serialize this data? Or try writing it to a text file? I've looked around for some tutorials and most low level ones are confusing or require advanced techniques with SQL. I'm interested in simply locally storing just as you would with a to-do list app that keeps record of tasks you entered.
Any and all insight is appreciated.
If I were you I would go the sql route. It's really not hard to get started with sqlite for android. If you haven't already seen Google's own tutorial on the subject, check it out here.
That said though, you can also look at the other methods mentioned here if you feel a database is overkill. Realistically the other choices would be internal storage or external storage if it's something like a todo list. Shared preferences are most often used for persisting user settings.
If you choose to go the file route and don't want to save the data as something like a csv then you need to make your java objects implement the Serializable interface and write them to the file with an ObjectOutputStream.
For example:
FileOutputStream fos = new FileOutputStream("/some/file/path/filename.ser", true);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(yourSerializableObject);
First important thing is that Activities, TextViews, Buttons and other view components are not part of Android Studio. They are part of android framework. Android Studio is IDE as Eclipse, NetBeans and etc.
Regarding your requirement, there are more ways of persisting data in android. You can use files, SharePreferences and sql (sqlite).
Please take a look at following document:
https://developer.android.com/guide/topics/data/
Also i would suggest you to follow Google android official documentation.
https://developer.android.com/guide/
Best Regards,
Milan
There are several ways to store your data locally on the device:
SharedPreferences - usually they are used to store app settings (Such as first name, last name, etc.).
Databases - used to store structured data, best solution when app needs to store large amount of data. Also, thay has powerful and flexible mechanisms of read/write operations.
Files - Not the best way to save structured data, no build-in mechanisms. Also app needs additional permissions to write/read operations (if you decides to save data on external storage), which can be denied by user(if your app is targeting api 23 and greater you should use runtime permissions)
The most effective way to store app data in your case is databases.
Google has developed Room Persistence library, which provides abstraction level over SQlite and makes all things simple and easy to understand.
Here is a nice example on Medium, which provides easy to understand tutorial for Room Persistence library.

Is Google Dictionary API now comes under Google custom engine?

I asked the same question on google developer forum, looking for clear direction for the same.
I am working on a project to get meaning of English word. And Google search engine provides result comprehensively. I would like to have those results (meaning of words, it's synonym, audio source from gstatic, usage graph since 1800, etc...) as input to my program for further processing. Is Custom search engine has exposed API or Google have explicit API for this? Earlier i thought of screen scraping, but it would be much easier if Google provide API for this as well.
Thanks in Anticipation.
Check out Wikitionary
Wiktionary (whose name is a blend of the words wiki and dictionary) is
a multilingual, web-based project to create a free content dictionary
of all words in all languages. It is available in 172 languages and in
Simple English. Like its sister project Wikipedia, Wiktionary is run
by the Wikimedia Foundation, and is written collaboratively by
volunteers, dubbed "Wiktionarians". Its wiki software, MediaWiki,
allows almost anyone with access to the website to create and edit
entries.
You can access their data using the MediaWiki API, no need to scrape google search results.

Delete / trash file from android using android.gms.drive

I need to delete files from Google Drive using com.google.android.gms.drive. From what I've read here and across the web there is no support for file deletion in the "new API". Is that (still) correct? I mean the API isn't that new anymore ...
I also read about the "clear contents and forget"-strategy, but I'd like not to follow that approach.
Part 2 of the question: Given it's still impossible to delete files via the API mentioned above; is there any easy way to combine the REST API w/ the code I've already written? Something like
get token from GoogleApiClient
fire DELETE request w/ token and file id
???
profit
edit: The new Google Play Services (version 7.0.0 / March 2015) finally features a trash() method. See https://developer.android.com/reference/com/google/android/gms/drive/DriveResource.html for further details.
.
edit2: Apparently you cannot use trash() on files from the app folder: Cannot trash App Folder or files inside the App Folder. :((
edit3: As of May 28th, it's now possible to actually delete files.
UPDATE (May 2015)
Addition of trash / delete functionality to GDAA 7.5 renders the answer below irrelevant.
ORIGINAL ANSWER:
The sequence is:
Get DriveId from GDAA (file or folder)
Get ResourceId from DriveId.getResourceId() (may be null if file/folder is not committed yet)
use ResourceId (rsid) in this REST call:
com.google.api.services.drive.Drive.files().trash(rsid).execute()
com.google.api.services.drive.Drive.files().delete(rsid).execute()
finally realize that you can't do it since you'll see the file in GDAA long after it has been deleted / trashed. You can even write in it, create files in that folder you've just trashed, ... That's why people introduced the "clear contents and forget" strategy nobody likes.
Needless to say, this applies to any delete / trash action you may perform outside of GDAA universe (manually trash/delete using web interface etc...)
So, to wrap it up. 'pinoyyid' is right, each of the APIs is different and the GDAA can not replace the REST (yet). You'll quickly realize it when you try to work a little deeper, like getting thumbnail url, fighting latency issues etc... On the other hand GDAA has advantages, since it can work off-line without your app handling it. When using REST, your app should do all the Drive calls in some kind of sync service to separate your UI actions from network issues (delays, off-line, ...). GDAA handles this for you, but on it's own timing terms. And with no delete functionality.
I put a piece of code on github, that has both these API's used side-by-side and you may use it to play with different scenarios before committing yourself to one of them.
It would be nice to hear clearly from Google what the final strategy is, i.e.
Is GDAA going to replace REST one day, after all the REST functionality is in?
Will they retire the REST afterwards?
Good Luck
Delete is supported by the Google Drive Android API as of Google Play services 7.5 using the DriveResource.delete() method.
Delete is permanent, and recommended only for App Folder content, where trash is not available.

1-D barcode scanner(using images from a capturing device) implementation in java

I am a student and as a project i have to implement a barcode(1-D) based attendance marking system.While surfing across the web i came to know that barcode readers are a bit costly toys to purchase,so now what I want to do is I want to capture images of barcodes through a capturing device(mostly a webcam) and then process them to get the content stored in it.
I found a few projects on the internet that do the same but they use .NET f/w and I am not so familiar with .NET technology. The only project that uses java is http://sourceforge.net/projects/javabarcoderead/ but somehow i am not able to run the jar file they are providing.
SO, I would like to know about the algorithms or methods that can be used for the same or even any project from where i can get some insight on how to move further with this...
Happy Coding...
You're right, it would be very difficult to use a library with no documentation and no source code.
I'd suggest using ZXing. It's a well-documented library with lots of examples.

Categories

Resources