-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlearnings.txt
133 lines (77 loc) · 6.33 KB
/
learnings.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
sometimes if it fails then remove android platform and install again.
sometimes have to do phonegap clean and then phonegap run android. this happened for the cordova-plugin-facebook4 .
Important: in facebookconnect.xml file inside cordova-plugin-facebook4 we need to add these keys manually to resources tag:
<string name="fb_app_id">123456789</string>
<string name="fb_app_name">TEST</string>
this shud have typically got added when we passed variables while running the plugin but does not take from config-xml.
see more details here : http://ngcordova.com/docs/plugins/facebook/
also if nothing works do to D:\MyData\startups\gameofhands\src\platforms\android\app\src\main\res\values and put facebookconnect.xml there with the two keys .
copy this file from plugin directory of cordova-plugin-facebook4
see this too : https://github.com/jeduan/cordova-plugin-facebook4/issues/599 for the fb_app_id and db_app_name not getting copied over. chris has a solution to do this without
modifying any platform files.
- if you want to change app id and app name uninstall and reinstall the plugin.
- when we run cordova-facebook4 plugin , the tag added inside fb-root is not proper, tht is it does not wait for the fb js sdk to load and goes on to load a nonexistent
fbsdk.js and puts it in dom. luckily the previously adding script tag for the online version of sdk loads and FB is set on the window object.
---------------------\to get android key hash-----------
This is how i solved this problem
Download your APK to your PC in java jdk\bin folder
in my case C:\Program Files\Java\jdk1.7.0_121\bin
go to java jdk\bin folder and run cmd then
copy the following command in your cmd
keytool -list -printcert -jarfile app-debug.apk
Copy the SHA1 value to your clip board
like this CD:A1:EA:A3:5C:5C:68:FB:FA:0A:6B:E5:5A:72:64:DD:26:8D:44:84
and open http://tomeko.net/online_tools/hex_to_base64.php to convert your SHA1 value to base64.
This is what Facebook requires
get the generated hash " ********************= " and copy the key hash to the facebook app.
-------------------------------------------------
generate signing keys :
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Soham\.android\debug.keystore" | "D:\MyData\ssl\openssl-0.9.8e_X64\bin\openssl" sha1 -binary | "D:\MyData\ssl\openssl-0.9.8e_X64\bin\openssl" base64
This is the default keystore for debug mode set by android build tools:
Keystore name: "debug.keystore"
Keystore password: "android"
Key alias: "androiddebugkey"
Key password: "android"
CN: "CN=Android Debug,O=Android,C=US"
so android is the password for debug.keystore file. https://stackoverflow.com/questions/18589694/i-have-never-set-any-passwords-to-my-keystore-and-alias-so-how-are-they-created
- if sometime cordova says launch success and app doesnt show up on phone then just reinstall the platform and add those 2 keys to facebook connect file and then run phonegap build android --verbose and then phonegap run android --verbose and it wrks.
-------------------------------------------------
always run from windows command line as the echo command in one of the hooks requires cmd not git-bash.
------------------------------------------------
hook run order: https://stackoverflow.com/questions/33647483/cordova-hooks-order
enabled cors as per this : http://www.melvinswebstuff.com/blog/2015/01/02/enable-cors-iisexpress/ so that local browser client can access local website.
disable this later on.
disable too much loggin level on sfs later for more performance.
for sfs2x enable debug from admin, it adds jvm flags to sfs2x.bat.
if published website does not load due to module tag not permitted do this :
Go to IIS Manager. Select the Server and then Feature Delegation (in IIS 7.5 under Management Section). Go to Modules and set it as Read/Write.
also open inbound http ports and also 8080 sfs port
most important : add website to iis . point it to the published folder and add binding https : hostname.com : port num . and at the same time go to etc/hosts and map the private ip with the hostname.com to get the site running with a domain name.
remember: we have added a merges folder now to change the endpoints on localhost and android due to browser cors policies. use publish folder method
to deploy site and copy mainapp into it.
- For iis website from published folder folow this exact procedure then remove application and add a website to get it to work. https://msdn.microsoft.com/en-us/library/1y1404zt.aspx
-see this for ssl ports firewall configs etc : http://docs2x.smartfoxserver.com/GettingStarted/cryptography
http://docs2x.smartfoxserver.com/GettingStarted/migration-213
very important config option is useSSL in sfsconfig. if set true protocol used is wss: , else it is ws: . for wss port number has to be 8443. Also we cannot use ws and wss enabled on the
webserver together. see here :
http://www.smartfoxserver.com/forums/viewtopic.php?f=18&t=19201
websockets can be run in encrypted or unencrypted mode, but not both at the same time.
also when you disable http in sfs admin, then we have to use https://localhost:8443 to login to sfs. 8080 wont work.
enable ssl for sfs only in browser as its a browser specific thing. in webview all the https and stuff is not enforced by fb or the webview when it connects to ws://
but see if sfs can have both ws:// and wss:// as previously it is mentioned in this file that it cannot be done together.
add iis website, open ports 8443/8080/443/80 and also add entries to etc/hosts to point gameofhands.com
to the 127.0.0.1 . Also on any other computer on network add gameofhands.com to hosts file and
point it to private ip of server computer. this is for facebook app to get the correct domain
as well as the other computer on network to be able to find our computer by ip during dns probe.
circular dependency requirejs
------------------------------
madge --circular --warning D:\MyData\startups\gameofhands\src-client\www
sfs2x production article (see last step for linux hosting)
---------------------------
http://smartfoxserver.com/blog/tips-for-a-successful-smartfoxserver-deployment/
sfs2x very important coding practice
-------------------------------------
From Zone's init never call any code that tries to access the zone via SmartFoxServer.getInstance();
sfs2x overriding methods like destroy
---------------------------------------
dont forget to call super.destroy() ! as the first line.