Generate cloud endpoint client library update libraries - android

On eclipse (appengine -> android) , how can i update the libraries that are generated by the command
'Generate cloud endpoint client library', so that it will then always generate the updated version ?
I mean google-api-client-1.18.0.jar to google-api-client-1.20.0.jar for example.
Where do they come from?
Thanks!

Your endpoint libraries are updated automatically each time you generate them from the backend project. If you don't see a class or a method, most probably it is due to one of the following:
1. a method is marked static and public. Make it private and manually add the #Apimethod annotation.
2. Also, sometimes the name of the endpoint library is different from the original class name in the backend project. Pay attention to the name attribute of the #Api annotation on the class name.
You may find these links useful:
https://cloud.google.com/appengine/docs/java/endpoints/annotations#api_api-scoped_annotations
https://cloud.google.com/developers/articles/google-cloud-endpoints-for-android/
Hope this resolves ur issue

Related

Fragment not Generated in AppSync Sample App

I'm going through the sample app for AppSync as described here.
I found a sample Android client app on GitHub here and am trying to just get it to run with my data but for some reason the fragments aren't being generated.
events.graphql has what appears to be the events fragment definition.
fragment Event on Event {
id
description
name
when
where
comments {
items {
eventId
commentId
content
createdAt
}
}
I've tried adding it to the schema in the appsync web interface and it saves the schema but then doesn't actually add the fragment. I'm just now trying GraphQL tonight so I'm not really sure where to even put the fragment definition and Google doesn't seem to have anything about this.
Going to need more information here before answering, but I'm working on the same sample project and was able to get it working so I might be of some help.
Is your project syncing and building? That's a good first step.
It looks like your .graphql files are being autogenerated in your app-> source -> appsync -> com file, but the classes are not being generated in the app -> build -> source -> appsync -> com folder.
Something I learned in the process of working on this project was that it's important to have all your resolvers and the backend set up fairly completely in the AWS console before calling the amplify add api command. Have you setup the back end with resolvers?
If you have and it's still not working, try running in the app terminal amplify gql-compile then running amplify pushto pull the data back into your app from the console, then resync and rebuild as necessary. This should build your Query/Mutation/Subscription classes for you, as well as the Fragment.class, which are the resolvers in your program for the .graphql queries/etc that you want to run in your application.
If that doesn't work, make sure you've completed all the necessary steps in the amplify API like amplify add api, amplify update api. It appears that you've already done that since you have generated .graphql files in the app-> source directory, but in case you haven't, those are first steps. You can also check to make sure that you're actually connected to the DB (and correct api in the console) by running amplify status. Are you connected to the console API that you need to be connected to?
As a last resort, you can copy the Event.class file from github and paste it into the appropriate file/subdirectory, along with the rest of the Query/Mutation/etc .class files that should have been generated by the ApolloGraphql plugin.

Creating sheet via execution API

I'm trying to create a google sheets document via script, and I'm using the execution API example google provides here:
https://developers.google.com/apps-script/guides/rest/quickstart/android
The only change I've made was a line on the script:
function getFoldersUnderRoot() {
var sheet = SpreadsheetApp.create("MySheet"); //This line.
var root = DriveApp.getRootFolder();
var folders = root.getFolders();
var folderSet = {};
while (folders.hasNext()) {
var folder = folders.next();
folderSet[folder.getId()] = folder.getName();
}
return folderSet;
}
But, even though i can run the code correctly, it just doesnt create the sheet. Maybe some authorization problem? I couldnt find it... Id thank you so much for your help... I really need this to my project.
Based from this guidelines, before using the API you need to do the following to meet the above requirements:
Create an Apps Script project to call, with the functions you want to use. The API can also be used to call existing scripts that were created for other projects. Open the project in the Apps Script editor.
Deploy the script project for execution by selecting Publish > Deploy as API executable. Choose a version (or create a new one) and who has access, then click Deploy. The new dialog that opens shows your script's ID, listed under "Current API ID". Make note of this ID — you need to enter it into the application code so that the API knows which script to call. If you need to find it again later, select Publish > Deploy as API executable in the code editor to see it.
Choose a Cloud Platform project and ensure both the calling application and the target script share it. If you use the script's default Cloud Platform project, the calling application should use that project to set up its OAuth credentials. This requires you to have access to the default Cloud Platform project, which may not be the case if the script resides in Team Drive. If you are using a new or existing Cloud Platform Project, you need to switch the Apps Script project to use it if you have not done so already.
Enable the Google Apps Script Execution API in the Cloud Platform project. You can find directions for doing this in the Execution API Java Quickstart.
Create a valid Client ID and client secret for the application in the Cloud Platform project. This is covered in the Execution API Java Quickstart.
In the application code, generate an OAuth access token for the API call. This is not a token the API itself uses, but rather one the script requires. The token must be built using the Client ID and the scopes from the script (in the editor, under File > Project properties > Scopes). This also requires prompting the user to authorize the script. The Google client libraries, while not strictly necessary, can greatly assist in handling OAuth for the application.
Hope this helps.

Android Studio cloud end point newly anotated method not showing up

I m new to google cloud endpoint.I m using android studio-0.8.14. I made a new GCM End Point module with the default template.Then I added annotations for find method (which is by default NOT annotated)
#ApiMethod(name = "findDevice")
private RegistrationRecord findRecord(#Named("regId") String regId)
{
return ofy().load().type(RegistrationRecord.class).filter("regId", regId).first().now();
}
After rerunning this module,I dont get the new api for find in my api explorer.I tried rebuilding the project but no luck.I think I need to regenerate the end point library for client. Eclipse had such option but android studio doesnt have that.What if I make a entity model class and then add end point class for that all by myself, without using studio template code, will it show up in explorer?
At last I got it to work BUT after updating the android studio and using their NEW TEMPLATE for endpoint module. The module I created was created before the android studio update beta-0.8.14.That means there must be a bug. Normally a public endpoint method should be exposed to api explorer even if u dont annotate.But in my case it didnt with or without annotation. I did everything ,rebuilding the project, restarting the module backend etc but still no luck. Then I created another project and build anther module with A NEW module-building wizard, I found that the whole project structure changed A LOT...A LOT. Then I added a module (with and without annotation) which just showed up in the API explorer after restarting the backend module. Hence I think the problem must have been in the earlier module template code or somewhere else.

ACRA formkey where to get it?

So I tried to follow instructions of https://github.com/ACRA/acra/wiki/BasicSetup but its too old or something.
Using my own gmail account I did import the csv file but there is no option "Create a LEGACY Form" in tools menu but only "Create form". If I create a form there are no fields of imported csv file (like I can see on screenshot in BasicSetup document) but it prompts to add fields manually using "Add item". And there is no any formkey around. The http link of form is looks like: https://docs.google.com/forms/d/1KNF_R4_Re0X0giFfEXwqXY50mpnFvQUvp0NLkKxyI/edit# or if I choose "view live form" it is https://docs.google.com/forms/d/1KNF_R4_Re0X0giFfEXwqXY50mpnFvQUvp0NLkKxyI/viewform As you can see there is no formkey included.
So the question is there I can find that fomkey now?
As the use of Google Docs is deprecated for ACRA I recommend you to use BugSense as your Back-End service:
1. Go to their site and sign in: http://www.bugsense.com/
2. Create a new project to monitor in BugSense site, as a result you will receive an API Key for this application.
3. Finally add this line to you Application class in you project:
#ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=YOUR_API_KEY", formKey="")
You can also check this blog post I wrote on:
Crash Reports and Usage Monitoring
Google spreadsheets are not supported on ACRA. Use a third party provider like BugSense instead or write your own error collector.
I have tried ACRA with my custom domain which handled by google and at that time i could not found any option to create to
Create a LEGACY Form
then after i have tried with my personal gmail account and its works .
so i came to conclusion is that :
ACRA dose not support Third party domain even-though they provided
google .

How to use Google's auto complete places api in Android application

I want to use Google Places API in my android application. I have API Key I got it from Google's API console. I am following the Perform Autocomplete section in this tutorial.
Now the problem I am facing is exactly which jar file I need for this. I have tried with two:
google-api-client-1.6.0-beta.jar
In this case I am getting exception when creating the object of class where I have implemented these methods and imported the packages of above library
google-http-client-1.6.0-beta.jar
GoogleHeaders cannot be resolved to a type
If I comment the code where I am setting header to request it does not shows any error but
when I execute the code I get the following error:
java.lang.NoClassDefFoundError: com.google.common.base.Preconditions
I have also added all the dependency jars.
There is no need to use a specific client. Just use any library that can make HTTP requests (like Apache HttpClient), then parse the JSON (or XML) that you get back from the Places API.

Categories

Resources