Mobile App hangs and does not connect


#1

Hi all,

I’ve installed the platform in my server and it works fine.
Now, I want to use the mobile app also.
I’ve copied the config.json file into my platform-client files. ( in the server/www/ folder).
This is my config.json file.

//Set configuration for Ushahidi mobile app

{
client_id: “ushahidiui”,
client_secret: “35e7f0bca957836d05ca0492211b0ac707671261”,
backend_url: “api.csmonitoring.am”,
google_analytics_id: “”,
intercom_app_id: “”,
mapbox_api_key: “”,
raven_url: “”
}

I’ve configured my nginx server as instruction in here:
https://docs.ushahidi.com/platform-developer-documentation/development-and-code/setup_alternatives/installing-for-production-environments

/etc/nginx/sites-available/platform-client.conf
server {

listen 80 default_server;
listen [::]:80 ;
server_name your-site.example.com;
charset UTF-8;
root /var/www/platform-client/server/www;

index index.html;
location / {
try_files $uri $uri/ @missing;
}

location @missing {
rewrite ^ /index.html last;
}

### THIS IS ONLY REQUIRED FOR OLD VERSIONS (until year 2019) OF THE ANDROID APP ###
location /config.json {
if ($request_method = ‘OPTIONS’) {
add_header ‘Access-Control-Allow-Origin’ ‘’;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’;
add_header ‘Access-Control-Allow-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range’;
add_header ‘Access-Control-Max-Age’ 1728000;
add_header ‘Content-Type’ ‘text/plain charset=UTF-8’;
add_header ‘Content-Length’ 0;
return 204;
}

if ($request_method = ‘GET’) {
add_header ‘Access-Control-Allow-Origin’ '
’;
add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’;
add_header ‘Access-Control-Allow-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range’;
add_header ‘Access-Control-Expose-Headers’ ‘DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range’;
}
}
### END OF OLD MOBILE APP SUPPORT ###
}

After this configurations, I’m not able to use Mobile app in Android. The connection hangs and infinity loads.


#2

Hi,

one thing that stands out is that this:

{
client_id: “ushahidiui”,
client_secret: “35e7f0bca957836d05ca0492211b0ac707671261”,
backend_url: “api.csmonitoring.am”,
google_analytics_id: “”,
intercom_app_id: “”,
mapbox_api_key: “”,
raven_url: “”
}

is not valid JSON.

Valid JSON has quotes around the dictionary keys, i.e.:

backend_url: “api.csmonitoring.am”,

should be

"backend_url": "api.csmonitoring.am",

Also please note the use of plain quotes ("), instead of pretty ones (“) .

You can use a json validator online to make sure you’ve got proper JSON.

Hope this helps!