Specify AppEngine version in Android application - android

I'm trying to access a non-default version of my AppEngine application using an Android app. For clearance, my default version is 1, and my new version is 2. Note that I cannot (yet) let version 2 be the default version.
From the docs:
The element contains the version identifier for the latest version of the app's code. The version identifier can contain lowercase letters, digits, and hyphens. It cannot begin with the prefix "ah-" and the names "default" and "latest" are reserved and cannot be used. AppCfg uses this version identifier when it uploads the application, telling App Engine to either create a new version of the app with the given identifier, or replace the version of the app with the given identifier if one already exists. You can test new versions of your app using a URL using "-dot-" as a subdomain separator in the URL, e.g. http://_version_id_-dot-_your_app_id_.appspot.com. You can select which version of the app your users see, the "default" version, using the Admin Console.
Unfortunately, Android applications do not use this url directly. The ids my app uses are:
final String PROJECT_NUMBER = "123456789012";
final String WEB_CLIENT_ID = "123456789012-abcdefghijklmnopqrstuvwxyz012345.apps.googleusercontent.com";
final String ANDROID_AUDIENCE = WEB_CLIENT_ID;
The PROJECT_NUMBER is used for GCM registration, the ANDROID_AUDIENCE is used as follows:
mCredential = GoogleAccountCredential.usingAudience(context, "server:client_id:" + Ids.ANDROID_AUDIENCE);
How can I get my Android application to communicate with version 2 of my AppEngine application?

#dragonx provided a Python link, however, I'm using Java.
On this page, it says you can define a root and a version. This is what I've done to make this work:
Add version and root to my endpoint class:
.
#Api(version = "2", root="https://2-dot-my_app_id.appspot.com/_ah/api", name = "deviceinfoendpoint", clientIds = (...) )
public class DeviceInfoEndpoint {
Generate the Client Library
Deploy to AppEngine.
Now all calls made through my DeviceInfoEndpoint class are sent to version 2 of my AppEngine application.

Related

Why are android apps named com.something.something with cordova?

What is the naming convention for android apps?
I just kicked off my 1st cordova app and out of the box it is named com.example.hello..
If my app is called "guitars" can the id not just be that?
From: Android - Package Name convention
I understand the company name coming 1st.. but i don't follow why com is preceding it
Android apps have always been named like this. It comes from Java naming. If you have an app named "guitars" it would show as com.john.guitars
Com = commercial application (just like .com, most people register their app as a com app)
First level = always the publishing entity's' name
Second level (optional) = sub-devison, group, or project name
Final level = product name
In Android, in order to get a unique identifier you need to put something that is unique to your app, and here comes your domain into place since there is only one domain with the same name, like email for example.
This will help the device recognize your app. The reason for com at the beggining is because its an old convinient from java, it helps group apps in the same place. You can of course still do org.my.domain and it will work the same but will be in a different "folder" on the device.
So the naming convention is just your domain upside down + the name of the app, There for, guitars will be in the end if the name of the app is Guitars.
The appId can be any string. So you can set it to whatever you want, including just "guitars". However, the appId must be unique on a device. If another app that is already installed has the appId as "guitars" then your app will not install. To help avoid this, Google recommends that you use a "reverse domain name". For companies that already own a domain this can help avoid name collisions since com.google is "owned" by Google and com.samsung is clearly from Samsung.
This practice comes from using reverse domain names for Java packages. See What is the significance of the reverse domain name for java package structure for an explanation.

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.

Launch Adobe AIR app file (*.apk) from another Adobe Air application

I want to create the update mechanism of my Adobe Air-based Android app. In my special case with a private, very small app audience I use a direct distribution (without Google Play, via phisical installing on the users device) of the my application apk-file. But also I need to be able to install updates to it automatically (Let's say it will be a button 'Check updates' in my app UI). Can anybody help me with this task? How can I create this?
Now I have the idea:
I try to download the file with my app (using loaders and write the file using the File api) to the user storage... Then I want to use any Air Native Extension to launch that file. Is there any already created ANE to do that?
In my case for create auto update mechanism, I got local version number from app.xml and latest number from server.
Here is my settings.
app.xml
...
<name>mysomeapp</name>
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
<versionNumber>1.0.1</versionNumber>
...
actionscript
private var appVersion: String;
public function init():void
{
// Get local versionnumber from app.xml
var appDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appDescriptor.namespace();
appVersion = appDescriptor.ns::versionNumber; // In this case, it returns "1.0.1".
// Get latest versionnumber from server
var httpservice: HTTPService = new HTTPService();
httpservice.url = "http://myserver/foobar/version";
httpservice.method = URLRequestMethod.GET;
httpservice.addEventListener(ResultEvent.RESULT, checkVersionResult);
httpservice.send();
}
public function checkVersionResult(e: ResultEvent): void
{
// Compare latest number with local number.
if (e.result != appVersion)
{
// If the local version is not latest, download latest app from server.
navigateToURL(new URLRequest("http://myserver/foobar/androidAppDownload"));
}
}

Issue with Linkedin integration using socialauth in android

I had implmented linkedin integartion in my android app using socialauth a year ago. It was working fine till few days back. Now it gives following error:
"org.brickred.socialauth.exception.SocialAuthConfigurationException: Application keys are not correct. The server running the application should be same that was registered to get the keys."
Tried using following default keys also.
api.linkedin.com.consumer_key = bh82t52rdos6
api.linkedin.com.consumer_secret = zQ1LLrGbhDZ36fH8
Getting same error for keys of app generated previously, default app keys and for fresh created app.
Any idea why it is happening? Is there any change in linkedin APIs?
Libs included : socialauth-4.4.jar, socialauth-android-3.2.jar.
This is due to the change in the Linked in developer program.
Changes are mentioned here https://developer.linkedin.com/support/developer-program-transition.
You getting this error because the default scope setting in the r_fullprofile which is as part of the change no longer available.
So to apply this changes in the socialauth API you should pass the scope permission as <prop key="api.linkedin.com.custom_permissions">r_basicprofile,r_emailaddress</prop>
Linkedin have updated their Scope for API , they have updated their APIs link:https://developer.linkedin.com/support/developer-program-transition
The following selection of profile fields are available to all LinkedIn developers:
Basic Profile Fields
Location Fields
Position Fields
These fields are not
Full Profile Fields
Contact Info Fields
Company Fields
Publication Fields
Patent Fields
Language Fields
Skill Fields
Certification Fields
Course Fields
Education Fields
Volunteer Fields
Recommendation Fields.
Additionally
only these Profile API — /v1/people/~ Share API — /v1/people/~/shares Companies API — /v1/companies/{id} will work.
Check your scope.
LinkedIn locked many parts of its APIs on May 12, 2015 according to https://developer.linkedin.com/blog/posts/2015/developer-program-changes
Since you're using the socialauth library, you will have to wait for its developers to push a new version. :(
Downloading 4.9 library solves this issue
You can get the jar from Maven directly:
http://search.maven.org/remotecontent?filepath=org/brickred/socialauth/4.9/socialauth-4.9.jar

Changing package name of App-Engine side of App-Engine Connected Android Project not reflected on Android Side

I am working on an Appengine Connected Android Project. I am using Google Eclipse Plugin. Anyway, after finishing my project and having it working for a few days, I decided to change the package names of the server code. But then when I generate the Cloud Endpoint Client Library, the new package name is not reflected on the client. I still see the old name there: e.g. in endpoints-libs/…. Does anyone know how I might fix this?
But something else also happens that is very interesting. The app works fine with the new server. When I run the android app and look at the log, it is calling the new server by the appropriate new name. So clearly the mapping between App Engine and Android is correct. So why is the name not updating in the client? image my old package name was com.globs.game and the new name is now com.pans.game, if ever that helps.
I got the answer. It turns out I forgot to change my class's attributes:
#Api(name = "myappapi”,
namespace = #ApiNamespace(ownerDomain = "mycompany.com", ownerName = "mycompany.com", packagePath = ""),
version = "1",
description = "myapp API",
defaultVersion = AnnotationBoolean.TRUE)

Categories

Resources