Skip to content

Commit 687c272

Browse files
committed
merging
2 parents 1868692 + e88c9aa commit 687c272

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Weclick SDK Installation
2+
3+
The following tutorial will guide you to Install Weclick SDK via *jar* file.
4+
5+
##Getting Started
6+
7+
* First of all download latest version of sdk *jar* file from [release](https://github.com/makbn/Weclick_sdk_sample/releases) tab.
8+
* Move this file to */libs* folder of your project.
9+
* Add this following lines to your **app level module** `buil.gradle` file dependencies:
10+
11+
```gradle
12+
dependencies {
13+
compile files('libs/androrm.jar')
14+
//...
15+
}
16+
```
17+
* Now you should add your `Client Key` and `Application Id` to the `AndroidManifest.xml` file in *Application* scope:
18+
19+
```xml
20+
<meta-data
21+
android:name="ir.weclick.APPLICATION_ID"
22+
android:value="YOUR_APPLICATION_IP"/>
23+
<meta-data
24+
android:name="ir.weclick.CLIENT_KEY"
25+
android:value="YOUR_CLIENT_KEY" />
26+
```
27+
* Add following lines for permissions(before *Application* scope):
28+
29+
```xml
30+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
31+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
32+
<uses-permission android:name="android.permission.INTERNET" />
33+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
34+
```
35+
36+
##Initilizing SDK
37+
38+
If your app covering device with API 23 and above you should check permissions. after permissons granted initialize Wecclick SDK:
39+
40+
```java
41+
public class MainActivity extends AppCompatActivity {
42+
43+
private static final int REQUEST_READ_PHONE_STATE = 99;
44+
45+
@Override
46+
protected void onCreate(Bundle savedInstanceState) {
47+
super.onCreate(savedInstanceState);
48+
setContentView(R.layout.activity_main);
49+
50+
int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE);
51+
52+
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
53+
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_READ_PHONE_STATE);
54+
} else {
55+
Weclick.initialize(getApplicationContext());
56+
}
57+
58+
59+
60+
}
61+
62+
@Override
63+
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
64+
switch (requestCode) {
65+
case REQUEST_READ_PHONE_STATE:
66+
if ((grantResults.length > 0) && (grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
67+
Weclick.initialize(getApplicationContext());
68+
}
69+
break;
70+
71+
default:
72+
break;
73+
}
74+
}
75+
76+
77+
}
78+
```
79+
80+
but if your target API is below 23 just add this line in your starting method ( `onCreate` ) of Ativity:
81+
82+
```java
83+
Weclick.initialize(getApplicationContext());
84+
85+
```
86+

0 commit comments

Comments
 (0)