I download the chat sample from quickblox and follow all the steps at http://quickblox.com/developers/5_Mins_Guide iam geting unauthorized error
i spending days for it for simple open groupchat feature in my app
please could some one help me.
splashActivity.java is
private static final String APP_ID = <my id>;
private static final String AUTH_KEY = <auth key>;
private static final String AUTH_SECRET = <secret key>;
//
private static final String USER_LOGIN = "vamsi";
private static final String USER_PASSWORD = "******";
You need to go to the QuickBlox Admin Panel, go to the users section and add a new user with the credentials that you will be using first.
Related
I am new android devloper I do not know how to view json file using server key. If you know I need help. I have given some examples below.
#Headers({CACHE, AGENT})
#GET("api.php?get_ads")
Call<CallbackAds> getAds(
#Query("api_key") String api_key
);
api_key server key
public static final String SERVER_KEY = "WVVoU01HTklUVFpNZVRseVdWZDRNbUZYUm5sa1dGcHdURzFPZG1KVE9WVmFWM2hzWkcxc2VtRlhPWFZNTVZKb1lsZHNjMlJJV25WYVdHUjZXREpHZDJOSGVIQlpNa1l3WVZjNWRWTlhVbVpaTWpsMFRHeFNhR0pYYkhOa1NGbDFZbTFXTTJNelFtaGpSMVo1VEcxc2RWcEhiR2c9";
//your Rest API Key obtained from the admin panel
public static final String REST_API_KEY = "cda11Uib7PLEA8pjKehSVfY0vdHsXI269J3MlqcGatWZBmxOgR";
I am building an app based on the mobile hub sample app. The sample-app has the API keys stored in a class file AWSconfiguration:
public class AWSConfiguration {
// AWS MobileHub user agent string
public static final String AWS_MOBILEHUB_USER_AGENT =
"MobileHub ********* aws-my-sample-app-android-v0.16";
// AMAZON COGNITO
public static final Regions AMAZON_COGNITO_REGION =
Regions.fromName("us-east-1");
public static String AMAZON_COGNITO_IDENTITY_POOL_ID = "us-east-************6";
// Google Client ID for Web application
public static String GOOGLE_CLIENT_ID ="";//"*********************.apps.googleusercontent.com";
public static final Regions AMAZON_DYNAMODB_REGION =
Regions.fromName("us-east-1");
public static String AMAZON_COGNITO_USER_POOL_ID = "************";
public static String AMAZON_COGNITO_USER_POOL_CLIENT_ID = "*************";
public static String AMAZON_COGNITO_USER_POOL_CLIENT_SECRET = "*************";
private static final AWSMobileHelperConfiguration helperConfiguration = new AWSMobileHelperConfiguration.Builder()
.withCognitoRegion(AMAZON_COGNITO_REGION)
.withCognitoIdentityPoolId(AMAZON_COGNITO_IDENTITY_POOL_ID)
.withCognitoUserPool(AMAZON_COGNITO_USER_POOL_ID,
AMAZON_COGNITO_USER_POOL_CLIENT_ID, AMAZON_COGNITO_USER_POOL_CLIENT_SECRET)
.build();
/**
* #return the configuration for AWSKit.
*/
public static AWSMobileHelperConfiguration getAWSMobileHelperConfiguration() {
return helperConfiguration;
}
}
It seems unsafe to store the client secret key this way. What are the risks?
I experiemnted with hiding the keys in JNI files but could not find the proper entry point in the activity to set the keys before they are called from the mobile helper.
Storing in clear text is generally a bad idea, as you guessed. You could use the android keystore, store it encrypted (the stronger the key, the better), obfuscate it with some unique identifier of your device, or access it via some API you control and secure. It's possible to use some other solution, or a combination of the above possibilities. The final decision comes down to you and what your app needs/abilities are, but there's a few ways to hide it.
SharedPreferences.Editor can be a solution.
Password or something like this are stored in SharedPreferences.
After I followed all the steps for the push notification sample app. I wasn't able to send a notifaction to myself. I could send a pushmessage from my PC to my phone, but when I use the button Send myself a Notification nothing happens.
I am using Android sdk
After starting the app I do see that my Device is Registerd
Here is my settings.java
package com.ganyo.pushtest;
/** Change these values to match your setup! */
public class Settings {
static final String UNASSIGNED_ORG_VALUE = "";
// Google Client Id from Google API Console
static final String GCM_SENDER_ID = "xxxxxxxxxxxxx";
// Notifier Name in App Services
static final String NOTIFIER = "androidDev";
static final String API_URL = "https://api.usergrid.com";
static final String ORG = "xxxxxxx";
static final String APP = "sandbox";
// set these if you want to use a user login
static final String USER = null;
static final String PASSWORD = null;
}
I'm not sure what the UNASSIGNED_ORG_VALUE should be.
Thx in advance.
No need to assign any value to UNASSIGNED_ORG_VALUE. It's only used to check that you've entered the other values.
Please check your Android logs as well as the Apigee Console to see what error messages might have been generated during your push attempt. This will help you debug the issue.
Finally, you could try providing your notifier name here in all lowercase. (Note: This shouldn't generally be necessary, but I've heard there may be a issue that affects notifier name resolution.)
I am trying to connect an Android chat app in Eclipse to my own Openfire server. The code I am using is from the Samsung developers site (http://developer.samsung.com/android/technical-docs/Building-a-Chat-Application) and I am having difficulty in connecting the app to my server.
The problem comes from declaring the connections:
public static final String HOST = "talk.google.com";
public static final int PORT = 5222;
public static final String SERVICE = "gmail.com";
public static final String USERNAME = "userid#gmail.com";
public static final String PASSWORD = "password";
This is the example provided by the site, but I am unsure of what the fields should contain if I am using my own openfire server, as opposed to the example above. If someone could give an example of what I should do to connect to my own server, I would really appreciate it.
Thank you for your time.
I want to cater for LICENSE_OLD_KEY in my android license policy.
I was going to modify the ServerManagedPolicy as it doesn't cater for this, as far as I can tell, it just seems to look for Policy.LICENSED or Policy.NOT_LICENSED in processServerResponse method:
public void processServerResponse(int response, ResponseData rawData) {
// Update retry counter
if (response != Policy.RETRY) {
setRetryCount(0);
} else {
setRetryCount(mRetryCount + 1);
}
if (response == Policy.LICENSED) {
// Update server policy data
Map<String, String> extras = decodeExtras(rawData.extra);
mLastResponse = response;
setValidityTimestamp(extras.get("VT"));
setRetryUntil(extras.get("GT"));
setMaxRetries(extras.get("GR"));
} else if (response == Policy.NOT_LICENSED) {
// Clear out stale policy data
setValidityTimestamp(DEFAULT_VALIDITY_TIMESTAMP);
setRetryUntil(DEFAULT_RETRY_UNTIL);
setMaxRetries(DEFAULT_MAX_RETRIES);
}
setLastResponse(response);
mPreferences.commit();
}
I'd like to know what the response code is for LICENSE_OLD_KEY because that doesn't exist in Policy:
public static final int LICENSED = 0x0100;
public static final int NOT_LICENSED = 0x0231;
public static final int RETRY = 0x0123;
I had a look here, but I can't find anywhere that lists the name and values.
I can see that there are a list of server response codes in LicenseValidator but they don't match up to those in Policy:
// Server response codes.
private static final int LICENSED = 0x0;
private static final int NOT_LICENSED = 0x1;
private static final int LICENSED_OLD_KEY = 0x2;
private static final int ERROR_NOT_MARKET_MANAGED = 0x3;
private static final int ERROR_SERVER_FAILURE = 0x4;
private static final int ERROR_OVER_QUOTA = 0x5;
private static final int ERROR_CONTACTING_SERVER = 0x101;
private static final int ERROR_INVALID_PACKAGE_NAME = 0x102;
private static final int ERROR_NON_MATCHING_UID = 0x103;
Giving it some thought I decided to try displaying the reason codes returned by the Google Play server on my phone, using AlertDialog's. Here is what I found:
Selecting LICENSED, in the Developer console profile, returned the number 256, as per Policy.LICENSED.
Selecting NOT_LICENSED returned the number 561, again as per Policy.NOT_LICENSED.
Finally selecting LICENSED_OLD_KEY returned the number 256, which is the same as Policy.LICENSED.
So it would seem that LICENSED_OLD_KEY is no longer used, or rather there is no distinction between LICENSED and LICENSED_OLD_KEY. Which is a bit confusing given the information that google provide in their documentation here.
Just to note, I did try uninstalling my app and selecting the different options in the developer console a few times, but it always resulted in the same answer!
The code you're looking at is only a reference implementation. It can't know how you would want to deal with a LICENSED_OLD_KEY situation in detail. The documentation suggests you might want to limit access to the current app, or to your server data from the current app, and ask the user to update and use the latest version. There's nothing much a reference implementation can provide to enable you to deal with all these situations. You can and should modify the code to treat LICENSED_OLD_KEY separately.
There's no indication for LICENSED_OLD_KEY "not being used anymore" because it's still handled as a server response in LicenseValidator.java and "OLD_KEY" refers to an older version of your app, not an older version of Google Play server handling.