Problem with the new App engine connected android application projects for the google eclipse plugin? This is the "Big Daddy" sample shown at goolge i/o 2011. My sample project compiles and the android app appears to work fine and registers with the server. However when I send a message from the server I get the following: Having issue with sample project. Android appears to work fine and registers with the server and the c2dm server, however I cannot send a message.
Also of note on the server is a c2dmconfig datastore object. It has fields for authToken and c2dmUrl. The authToken has a token, however the c2dmUrl is NULL. I suspect this is where my problem lies, but not sure how to fix it.
Thanks Patrick
I found this question by wondering the same thing, if the c2dmUrl being null is a problem. It would seem that this is not an issue though. If you look at the C2DMConfig (the entity that you are referencing), there is a function called "getC2DMUrl". Here it is:
public String getC2DMUrl() {
if (c2dmUrl == null) {
return DATAMESSAGING_SEND_ENDPOINT;
} else {
return c2dmUrl;
}
So null is a supported value for this. If a specific URL isn't specified, it simply returns it to the default.
Related
I've recently been developing a solution around the Secure Key Import feature of Android (info here) and have run into a problem.
I follow the procedure as documented. On the final step, when calling keyStore.setEntry(...) I get thrown an error with the code -1000 which is KM_ERROR_UNKNOWN_ERROR (error codes). I really don't have an idea on how to proceed from here. Any ideas on where the problem might be?
Some relevant code:
// (app) send attestation challenge request to server
// (server) generate and send challenge to the app
// (app) use challenge to generate a PURPOSE_WRAP_KEY key pair
// (app) get certificate and send to server
// (server) do wrap operations and return a blob (ASN.1 sequence as required in docs)
// (app) code below
byte[] wrappedKeySequence = response.body().getSequenceAsBytes();
AlgorithmParameterSpec spec = new KeyGenParameterSpec.Builder(WRAP_KEY_ALIAS, KeyProperties.PURPOSE_WRAP_KEY)
.setDigests(KeyProperties.DIGEST_SHA256)
.build();
KeyStore.Entry wrappedKeyEntry = new WrappedKeyEntry(wrappedKeySequence, WRAP_KEY_ALIAS, WRAP_ALGORITHM, spec);
String keyAlias = "SECRET_KEY";
keyStore.setEntry(keyAlias, wrappedKeyEntry, null);
More random details:
I'm trying to import an AES128 key
It'll be only used for encrypting data
Targeting API 28 and above, as required by the docs
Again, any help would be greatly appreciated.
Thanks,
G.
Update:
I've found the reason for this specific error, but have come to another error.
Namely, I used the tag 403 which defines MIN_SECONDS_BETWEEN_OPS. It being in the types.hal file, one would expect it to be implemented/valid everywhere, but it seems this isn't the case. However, I'm testing only on one Samsung phone, so it might be implemented by other manufacturers, or even on other Samsung phones.
Anyway, the next error is INVALID_ARGUMENT (-38) which, unlike the name suggests is as cryptic as this one. The docs say that it should occur for the RSA stuff (I'm trying to import an AES key), so the saga continues.
I'll update this answer if I find anything else.
Update 2:
I don't have any good news regarding the INVALID_ARGUMENT error. I get it even when I execute the unedited CTS test code, which is supposed to work, as the manufacturers use the CTS tests for validating that the devices work before leaving the factory.
For now I've paused work on that feature, if I ever come back to it I'll update as necessary.
I need to connect my Android application with Facebook Analytics, using custom events.
I followed official documentation on https://developers.facebook.com/docs/analytics/
Added facebook SDK into the project:
implementation 'com.facebook.android:facebook-android-sdk:5.15.3'
Generated all the necessary hashes, put everything necessary in the Manifest, all good.
App was built and launched, however, events were never showing up in the Analytics Console.
After hours and hours of debugging, I've found the problem.
Inside Facebook SDK library code, when postRequest to server is created, it has (among others) parameter called "extInfo". This parameter should contain json array with strings, in certain order.
Now, that's how Facebook SDK postRequest looks, when sent from the application:
As you can see, extinfo json array is all contaminated with backslashes. When I replicated this request manually in Postman, server returned error:
"message": "(#100) Field extinfo must be a valid json object with string keys"
So, in Postman, I modified extinfo parameter - cleaned it out of backslashes:
Result from server in this case is: "success": true. Events started appearing inside Analytics Dashboard.
Wonderful. But.
How to send events with the help of Facebook SDK, considering this bug? Is there sdk version where this bug doesn't appear? Is there a way to tune sdk so that it doesn't send extinfo at least?
Any other possible solution, except for sending requests without help of Facebook SDK (that's a whole load to write, besides, if they change request structure, code has to be re-written)?
I haven't found metions of this bug anywhere in the Internet. If there is, please share a link. Thank you.
Edit: tried with implementation 'com.facebook.android:facebook-core:7.1.0' too. No luck.
I've found the solution. In my case, problem was inside the project and had nothing to do with Facebook SDK.
Previous developer created validation for hosts that application can use:
HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory)
val verify = fun(ip: String, _: SSLSession): Boolean {
println(ip)
return ip.contains("crashlytics", true) ||
ip.contains("firebase", true) ||
ip.contains("maps.googleapis.com", true) ||
ip.contains("facebook.com", true)
}
HttpsURLConnection.setDefaultHostnameVerifier(verify)
Once I added facebook.com in the list, error was gone. However, I still don't understand why in the log "extinfo" parameter was generated with backslashes.
I'm trying to build chat application on Android and I've stuck on a very first step. I can't create ChatClient. According to documentation I should call some method like this:
ChatClient.create(context.getApplicationContext(), token, props, myCallback);
Unfortunately I'm receiving error: "Invalid access token grants", you can check this link for error details.
I've verified what's inside my jwt access token and it seems that everything is OK with grants. I've used https://jwt.io/ debugger to test it and could see the following payload(I've dashed my credentials to show only structure):
{ "iss": "SK####################",
"exp": 1516198358,
"jti": "SK#####################",
"sub": "######################",
"grants": {
"identity": "test.user#mail.com",
"chat": {
"service_sid": "###################",
"endpoint_id": "###################"
}
}
}
I've checked all the values and they seem to be OK, I've also tried to copy this token and pass it to my web(JS) project and was able to sign in without any issues which proves that token itself should be OK.
Any help appreciated, thanks
So the solution was to use correct region setting, because tokens in one region are incompatible with services from another.
Error messages on the service side are being refined to better reflect this case.
please do not use "endpoint_id" in the grants, it has been deprecated and may be throwing off some service validation logic.
If you continue getting this error please contact support.twilio.com and provide adb logs and the token itself (do not paste it here publicly). Also see https://github.com/twilio/twilio-chat-demo-android/blob/master/REPORT_BUGS.md
I'm trying to make games API work, with reference to https://github.com/playgameservices/android-samples/blob/master/BaseGameUtils/src/com/google/example/games/basegameutils/BaseGameActivity.java as sample code.
Mine is quite similar, basically I'm trying to connect a game client and receive a negative answer. When trying to manage it with startResolutionForResult() this is what I got:
E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
E/Volley(15638): [1492] il.a: Unexpected response code 403 for https://www.googleapis.com/games/v1/players/112370814111712506xxx
E/SignInIntentService(15638): Access Not Configured
[...]
E/LoadSelfFragment(15748): Unable to sign in - application does not have a registered client ID
The last message, "application does not have a registered client ID" made me think to this question...But I don't think my issue is related to app id / client ID as I got it working with same API keys on another machine. I'm pretty sure of SHA1 correctness, too, derived from current machine's debug.keystore.
The issue seems to be related to test address I'm using, the strange thing is that I don't receive always the same reply: using same keys and settings, I sometimes got:
E/SignInIntentService(15638): Access Not Configured
or even:
E/SignInIntentService(15638): Unable to load player
I'm using startResolutionForResult() inside OnConnectionFailedListener, it's showing the log-in screen briefly, but then it crashes with reported errors.
Another strange thing is that onActivityResult() is called, and result code is 10004
A last thing I can't understand is why, after an unsuccessful sign-in, the method onConnectionFailed() is called over and over, looping my app. Relevant code is:
public void initClient() {
GamesClient.Builder gcBuilder = new GamesClient.Builder(this, cb, cf);
gcBuilder.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
//gcBuilder.setScopes(mScopes);
mGamelient = gcBuilder.create();
mSchiacciameleView.setGameClient(gcBuilder.create());
}
OnConnectionFailedListener cf = new OnConnectionFailedListener() {
public void onConnectionFailed(ConnectionResult arg0) {
Log.e("Verme", "CONN FAIL:" + arg0.getErrorCode());
if (arg0.hasResolution()){
PendingIntent pendingIntent = arg0.getResolution();
//startResolutionForResult(SchiacciaMeleGame.this, 66);
try {
arg0.startResolutionForResult(me, ConnectionResult.SIGN_IN_REQUIRED) ;
} catch (SendIntentException e) {
Log.e("Verme", "Err in resolution", e);
}
}else{
Log.e("Verme", "NO RESOLUTION");
}
}
};
I've been messing with these libraries for two days. Frankly, I don't like the way Google is managing this; documentation is still incomplete and run-time behaviour seems a bit inconsistent (the exact same code is working on another machine, SHA1 is correct on both). Maybe it's my fault?
Thank you for replies
In Step 3. Generate an OAuth 2.0 client ID it specifically gives a warning as follows:
Warning: Do not open the Google APIs Console directly and manually
add your Client IDs on that page. Doing so might cause errors when
you send requests to the game services.
So my experience was that you need to follow the guide religiously: Setting Up Google Play Game Services with the Google Play Developer Console
I am wondering what is required to setup a server so that you can store data on it, and then have an application send requests to it to store and receive data. More specifically, I am working on an Android application where a user will generate data and then that should be stored on a server so other users can access it. But I do not know how setting up a server to be capable of this works. I have worked on Android applications in the past that sends requests (put, post, get, etc) to a server, but that back end was already set up for me. Any info or resources about setting this up would be great.
There are many, many different ways to accomplish this.
Since you're already working with a Google technology, Android - you could start by creating a Google App Engine project. Following the tutorials you can get started setting up a simple back end solution that will store data for you and you can make requests to it for that data.
Another advantage to this for you is that you don't have to learn how to install software on a server and all the dependencies that arise from that, etc. Simply set up a new account and push-button deploy through Eclipse or command line.
And since you've used Java in Android, you can use JAva for Google App Engine (GAE) too!
Getting started: http://code.google.com/appengine/docs/java/gettingstarted/introduction.html
You can try ready to use BAAS/PAAS services to store your data, e.g. QuickBlox for Android http://quickblox.com/developers/Android, where you can manipulate with your data with few strings
QBLocation location = new QBLocation();
location.setLatitude(35.0);
location.setLongitude(53.0);
location.setStatus("I'm at this place");
String someImportantString = "Dr. Henry Walton Indiana Jones";
QBLocations.createLocation(location, new QBCallbackImpl() {
#Override
public void onComplete(Result result, Object context) {
// retrieve context object inside callback
String passedContextObject = (String) context;
System.out.println(passedContextObject);
// do stuff with result
}
}, someImportantString);
All logic of data exchange with server is encapsulated in framework.