├── .gitignore
├── .idea
├── caches
│ ├── build_file_checksums.ser
│ └── gradle_models.ser
├── codeStyles
│ └── Project.xml
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── jarRepositories.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── build
│ └── outputs
│ │ └── apk
│ │ ├── app-debug.apk
│ │ └── debug
│ │ └── app-debug.apk
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ ├── DataCollectionIntentAPI_Guide.pdf
│ ├── DataCollectionService.xml
│ ├── intent_setups.png
│ ├── intent_setups_eda50.png
│ ├── readme.md
│ └── sample
│ │ └── honeywell
│ │ └── com
│ │ └── intentapisample
│ │ ├── MainActivity.java
│ │ └── SystemPropertyAccess.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/.idea/caches/gradle_models.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/.idea/caches/gradle_models.ser
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | xmlns:android
11 |
12 | ^$
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | xmlns:.*
22 |
23 | ^$
24 |
25 |
26 | BY_NAME
27 |
28 |
29 |
30 |
31 |
32 |
33 | .*:id
34 |
35 | http://schemas.android.com/apk/res/android
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | .*:name
45 |
46 | http://schemas.android.com/apk/res/android
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | name
56 |
57 | ^$
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | style
67 |
68 | ^$
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | .*
78 |
79 | ^$
80 |
81 |
82 | BY_NAME
83 |
84 |
85 |
86 |
87 |
88 |
89 | .*
90 |
91 | http://schemas.android.com/apk/res/android
92 |
93 |
94 | ANDROID_ATTRIBUTE_ORDER
95 |
96 |
97 |
98 |
99 |
100 |
101 | .*
102 |
103 | .*
104 |
105 |
106 | BY_NAME
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion '26.0.2'
6 | defaultConfig {
7 | applicationId "sample.honeywell.com.intentapisample"
8 | minSdkVersion 17
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | compileOptions {
21 | sourceCompatibility JavaVersion.VERSION_1_8
22 | targetCompatibility JavaVersion.VERSION_1_8
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(include: ['*.jar'], dir: 'libs')
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support:appcompat-v7:23.4.0'
32 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
33 | testCompile 'junit:junit:4.12'
34 | }
35 |
--------------------------------------------------------------------------------
/app/build/outputs/apk/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/build/outputs/apk/app-debug.apk
--------------------------------------------------------------------------------
/app/build/outputs/apk/debug/app-debug.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/build/outputs/apk/debug/app-debug.apk
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/DataCollectionIntentAPI_Guide.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/java/DataCollectionIntentAPI_Guide.pdf
--------------------------------------------------------------------------------
/app/src/main/java/DataCollectionService.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1.0.1
5 |
6 | hsm.demo.totalfreedom/.DataEdit
7 |
8 |
9 | 150
10 | false
11 | off
12 | 40
13 | false
14 | 1
15 | false
16 | ISO-8859-1
17 | 1
18 | 4
19 | 100
20 | normal
21 | 60
22 | 1
23 | contextSensitive
24 | false
25 | 4
26 | 9,10
27 | false
28 | false
29 | false
30 | 97
31 | true
32 | 80
33 | false
34 | true
35 | false
36 | false
37 | 4800
38 | true
39 | false
40 | false
41 | false
42 | false
43 | false
44 | 50
45 | false
46 | 0
47 | true
48 | false
49 | 80
50 | false
51 | false
52 | false
53 |
54 | 4
55 | noCheck
56 | false
57 | false
58 | false
59 | centerWeighted
60 | false
61 | false
62 | 80
63 | 0
64 | true
65 | false
66 | noCheck
67 | false
68 | false
69 | 1
70 | 4
71 | false
72 | false
73 | 6000
74 | false
75 | 100
76 | 1
77 |
78 | 1024
79 | false
80 | false
81 | true
82 | 2750
83 | doubleDigitCheckAndStrip
84 | 2
85 | 1
86 | false
87 | 80
88 | false
89 |
90 | noCheck
91 | 4
92 | 0
93 | false
94 | true
95 |
96 | false
97 | false
98 | 80
99 | true
100 | 48
101 | true
102 | false
103 | 48
104 | false
105 | 300
106 | true
107 | false
108 | 2750
109 | 1
110 | 4
111 | 2
112 | 80
113 | true
114 | 80
115 | false
116 | false
117 | 48
118 | 0
119 | false
120 | 3116
121 | false
122 | true
123 | false
124 | false
125 | 300
126 | none
127 | false
128 | 60000
129 | 0
130 | 1,3,7,7,7,7,7,7,7,7,0
131 | 50
132 | false
133 | false
134 | 1
135 | 1
136 | true
137 | true
138 | 0
139 | 1
140 |
141 |
142 | true
143 | false
144 | 50
145 | none
146 | 80
147 | 0
148 | false
149 | true
150 | 1
151 | false
152 | false
153 | false
154 | 20
155 | true
156 | 48
157 | 50
158 |
159 | noCheck
160 | 0
161 | false
162 | true
163 | 7089
164 | false
165 | false
166 | 2048
167 | 80
168 | false
169 |
170 | autoControl
171 | false
172 | 5
173 | 3832
174 | 1
175 | false
176 | 2048
177 | false
178 | 1024
179 | 60
180 | false
181 | false
182 | false
183 | oneShot
184 | false
185 | false
186 |
187 | dcs.scanner.imager/DEFAULT;
188 |
189 |
190 |
191 | 150
192 | false
193 | off
194 | 40
195 | false
196 | 1
197 | false
198 | ISO-8859-1
199 | 1
200 | 4
201 | 100
202 | normal
203 | 60
204 | 1
205 | contextSensitive
206 | false
207 | false
208 | 4
209 | 9,10
210 | false
211 | false
212 | 97
213 | true
214 | 80
215 | true
216 | false
217 | false
218 | false
219 | 4800
220 | false
221 | true
222 | false
223 | false
224 | false
225 | false
226 | 50
227 | false
228 | 0
229 | false
230 | true
231 | 80
232 | false
233 | false
234 | false
235 |
236 | 4
237 | noCheck
238 | true
239 | false
240 | centerWeighted
241 | false
242 | false
243 | false
244 | 80
245 | 0
246 | true
247 | false
248 | noCheck
249 | false
250 | false
251 | 1
252 | 4
253 | false
254 | false
255 | false
256 | 6000
257 | 100
258 | 1
259 | 1024
260 |
261 | false
262 | false
263 | 2750
264 | true
265 | doubleDigitCheckAndStrip
266 | 2
267 | 1
268 | false
269 | 80
270 | false
271 | com.honeywell.sample.action.BARCODE_DATA
272 | noCheck
273 | false
274 | 0
275 | true
276 | 4
277 |
278 | false
279 | false
280 | 80
281 | true
282 | true
283 | 48
284 | false
285 | 48
286 | false
287 | 300
288 | true
289 | false
290 | 1
291 | 2750
292 | 4
293 | 2
294 | 80
295 | true
296 | 80
297 | false
298 | false
299 | 48
300 | 0
301 | false
302 | 3116
303 | false
304 | true
305 | false
306 | false
307 | 300
308 | none
309 | false
310 | 0
311 | 60000
312 | 1,3,7,7,7,7,7,7,7,7,0
313 | 50
314 | false
315 | false
316 | 1
317 | 1
318 | true
319 | true
320 | 0
321 | 1
322 |
323 |
324 | true
325 | 50
326 | false
327 | none
328 | 80
329 | 0
330 | false
331 | true
332 | false
333 | 1
334 | false
335 | false
336 | 20
337 | true
338 | 48
339 | 50
340 |
341 | 0
342 | noCheck
343 | false
344 | true
345 | 7089
346 | false
347 | false
348 | 2048
349 | 80
350 | false
351 |
352 | autoControl
353 | false
354 | 5
355 | 3832
356 | 1
357 | false
358 | 2048
359 | false
360 | 1024
361 | 60
362 | false
363 | false
364 | false
365 | false
366 | oneShot
367 | false
368 |
369 |
370 |
371 |
372 |
373 |
--------------------------------------------------------------------------------
/app/src/main/java/intent_setups.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/java/intent_setups.png
--------------------------------------------------------------------------------
/app/src/main/java/intent_setups_eda50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/java/intent_setups_eda50.png
--------------------------------------------------------------------------------
/app/src/main/java/readme.md:
--------------------------------------------------------------------------------
1 | # Datacollection Intent API Sample
2 |
3 | This code does not need either "Scan to Intent" nor a "Data Intent" setup.
4 |
5 | 
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/sample/honeywell/com/intentapisample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package sample.honeywell.com.intentapisample;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.IntentFilter;
8 | import android.content.pm.PackageManager;
9 | import android.content.pm.ResolveInfo;
10 | import android.os.Build;
11 | import android.os.Handler;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.os.Bundle;
14 | import android.support.v7.view.menu.ActionMenuItemView;
15 | import android.util.Log;
16 | import android.view.View;
17 | import android.widget.Button;
18 | import android.widget.TextView;
19 |
20 | import java.util.List;
21 |
22 | public class MainActivity extends AppCompatActivity {
23 | private static final String TAG = "IntentApiSample";
24 | private static final String ACTION_BARCODE_DATA = "com.honeywell.sample.action.MY_BARCODE_DATA";
25 | //TODO: DO NOT USE THE sample string "com.honeywell.sample.action.BARCODE_DATA"
26 | //private static final String ACTION_BARCODE_DATA = "com.honeywell.sample.action.BARCODE_DATA";
27 |
28 | /**
29 | * Honeywell DataCollection Intent API
30 | * Claim scanner
31 | * Package Permissions:
32 | * "com.honeywell.decode.permission.DECODE"
33 | */
34 | private static final String ACTION_CLAIM_SCANNER = "com.honeywell.aidc.action.ACTION_CLAIM_SCANNER";
35 | /**
36 | * Honeywell DataCollection Intent API
37 | * Release scanner claim
38 | * Permissions:
39 | * "com.honeywell.decode.permission.DECODE"
40 | */
41 | private static final String ACTION_RELEASE_SCANNER = "com.honeywell.aidc.action.ACTION_RELEASE_SCANNER";
42 | /**
43 | * Honeywell DataCollection Intent API
44 | * Optional. Sets the scanner to claim. If scanner is not available or if extra is not used,
45 | * DataCollection will choose an available scanner.
46 | * Values : String
47 | * "dcs.scanner.imager" : Uses the internal scanner
48 | * "dcs.scanner.ring" : Uses the external ring scanner
49 | */
50 | private static final String EXTRA_SCANNER = "com.honeywell.aidc.extra.EXTRA_SCANNER";
51 | /**
52 | * Honeywell DataCollection Intent API
53 | * Optional. Sets the profile to use. If profile is not available or if extra is not used,
54 | * the scanner will use factory default properties (not "DEFAULT" profile properties).
55 | * Values : String
56 | */
57 | private static final String EXTRA_PROFILE = "com.honeywell.aidc.extra.EXTRA_PROFILE";
58 | /**
59 | * Honeywell DataCollection Intent API
60 | * Optional. Overrides the profile properties (non-persistent) until the next scanner claim.
61 | * Values : Bundle
62 | */
63 | private static final String EXTRA_PROPERTIES = "com.honeywell.aidc.extra.EXTRA_PROPERTIES";
64 |
65 | private static final String EXTRA_CONTROL = "com.honeywell.aidc.action.ACTION_CONTROL_SCANNER";
66 | /*
67 | Extras
68 | "com.honeywell.aidc.extra.EXTRA_SCAN" (boolean): Set to true to start or continue scanning. Set to false to stop scanning. Most scenarios only need this extra, however the scanner can be put into other states by adding from the following extras.
69 | "com.honeywell.aidc.extra.EXTRA_AIM" (boolean): Specify whether to turn the scanner aimer on or off. This is optional; the default value is the value of EXTRA_SCAN.
70 | "com.honeywell.aidc.extra.EXTRA_LIGHT" (boolean): Specify whether to turn the scanner illumination on or off. This is optional; the default value is the value of EXTRA_SCAN.
71 | "com.honeywell.aidc.extra.EXTRA_DECODE" (boolean): Specify whether to turn the decoding operation on or off. This is optional; the default value is the value of EXTRA_SCAN
72 | */
73 | private static final String EXTRA_SCAN = "com.honeywell.aidc.extra.EXTRA_SCAN";
74 |
75 | private TextView textView;
76 | Button button;
77 | int sdkVersion=0;
78 |
79 |
80 | private BroadcastReceiver barcodeDataReceiver = new BroadcastReceiver() {
81 | @Override
82 | public void onReceive(Context context, Intent intent) {
83 | Log.d("IntentApiSample: ","onReceive");
84 | if (ACTION_BARCODE_DATA.equals(intent.getAction())) {
85 | /*
86 | These extras are available:
87 | "version" (int) = Data Intent Api version
88 | "aimId" (String) = The AIM Identifier
89 | "charset" (String) = The charset used to convert "dataBytes" to "data" string
90 | "codeId" (String) = The Honeywell Symbology Identifier
91 | "data" (String) = The barcode data as a string
92 | "dataBytes" (byte[]) = The barcode data as a byte array
93 | "timestamp" (String) = The barcode timestamp
94 | */
95 | int version = intent.getIntExtra("version", 0);
96 | if (version >= 1) {
97 | String aimId = intent.getStringExtra("aimId");
98 | String charset = intent.getStringExtra("charset");
99 | String codeId = intent.getStringExtra("codeId");
100 | String data = intent.getStringExtra("data");
101 | byte[] dataBytes = intent.getByteArrayExtra("dataBytes");
102 | String dataBytesStr="";
103 | if(dataBytes!=null && dataBytes.length>0)
104 | dataBytesStr = bytesToHexString(dataBytes);
105 | String timestamp = intent.getStringExtra("timestamp");
106 | String text = String.format(
107 | "Data:%s\n" +
108 | "Charset:%s\n" +
109 | "Bytes:%s\n" +
110 | "AimId:%s\n" +
111 | "CodeId:%s\n" +
112 | "Timestamp:%s\n",
113 | data, charset, dataBytesStr, aimId, codeId, timestamp);
114 | setText(text);
115 | }
116 | }
117 | }
118 | };
119 |
120 | private static void sendImplicitBroadcast(Context ctxt, Intent i) {
121 | PackageManager pm = ctxt.getPackageManager();
122 | List matches = pm.queryBroadcastReceivers(i, 0);
123 | if (matches.size() > 0) {
124 | for (ResolveInfo resolveInfo : matches) {
125 | Intent explicit = new Intent(i);
126 | ComponentName cn =
127 | new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName,
128 | resolveInfo.activityInfo.name);
129 |
130 | explicit.setComponent(cn);
131 | ctxt.sendBroadcast(explicit);
132 | }
133 |
134 | } else{
135 | // to be compatible with Android 9 and later version for dynamic receiver
136 | ctxt.sendBroadcast(i);
137 | }
138 | }
139 |
140 | private void mysendBroadcast(Intent intent){
141 | if(sdkVersion<26) {
142 | sendBroadcast(intent);
143 | }else {
144 | //for Android O above "gives W/BroadcastQueue: Background execution not allowed: receiving Intent"
145 | //either set targetSDKversion to 25 or use implicit broadcast
146 | sendImplicitBroadcast(getApplicationContext(), intent);
147 | }
148 |
149 | }
150 | @Override
151 | protected void onCreate(Bundle savedInstanceState) {
152 | super.onCreate(savedInstanceState);
153 | setContentView(R.layout.activity_main);
154 | textView = (TextView) findViewById(R.id.textView);
155 | button = (Button)findViewById(R.id.button);
156 | button.setText("Start Scan");
157 |
158 | sdkVersion = android.os.Build.VERSION.SDK_INT;
159 | Log.d(TAG, "sdkVersion=" + sdkVersion+"\n");
160 |
161 | //JUST some code showing how to get Build version etc.
162 | //Log.i(TAG, SystemPropertyAccess.getCommonESversion(getApplicationContext()));
163 | StringBuilder sV=new StringBuilder().append("\n================================================\nService Pack: "+SystemPropertyAccess.getServicePack()+"\n");
164 | sV.append(sV);
165 | sV.append("HSMVersionInfo: \n"+ SystemPropertyAccess.getHSMVersionInfo()+"\n");
166 |
167 | sV.append("Build Number: " + android.os.Build.DISPLAY+"\n");
168 | sV.append("\nPkgInfo: \n"+SystemPropertyAccess.getPkgInfo(getApplicationContext())+"\n");
169 |
170 | sV.append ("\n================================================\n");
171 | Log.i(TAG, "\n" + sV.toString());
172 |
173 | Log.i(TAG, "SerialNumber: "+SystemPropertyAccess.getSerialNumber());
174 | Log.i(TAG, "SerialNumber2: "+SystemPropertyAccess.getSerialNumber2());
175 |
176 | button.setOnClickListener(new View.OnClickListener() {
177 | @Override
178 | public void onClick(View v) {
179 | Log.d(TAG, "light scanner");
180 | mysendBroadcast(new Intent(EXTRA_CONTROL).putExtra(EXTRA_SCAN, true));
181 | //software defined decode timeout!
182 | final Handler handler = new Handler();
183 | handler.postDelayed(new Runnable() {
184 | @Override
185 | public void run()
186 | {
187 | mysendBroadcast(new Intent(EXTRA_CONTROL).putExtra(EXTRA_SCAN, false));
188 | Log.d(TAG, "stop scanner");
189 | }
190 | }, 3000);
191 | }
192 | });
193 | Log.d("IntentApiSample: ", "onCreate");
194 | }
195 | @Override
196 | protected void onResume() {
197 | super.onResume();
198 | // IntentFilter intentFilter = new IntentFilter("hsm.RECVRBI");
199 | IntentFilter intent=new IntentFilter();
200 | intent.addAction(ACTION_BARCODE_DATA);
201 | //TODO: Honeywell needs the Category "android.intent.category.DEFAULT"
202 | intent.addCategory("android.intent.category.DEFAULT");
203 | registerReceiver(barcodeDataReceiver, intent);
204 | claimScanner();
205 | Log.d("IntentApiSample: ", "onResume");
206 | }
207 | @Override
208 | protected void onPause() {
209 | super.onPause();
210 | unregisterReceiver(barcodeDataReceiver);
211 | releaseScanner();
212 | Log.d("IntentApiSample: ", "onPause");
213 | }
214 | private void claimScanner() {
215 | Log.d("IntentApiSample: ", "claimScanner");
216 | Bundle properties = new Bundle();
217 | properties.putBoolean("DPR_DATA_INTENT", true);
218 | properties.putString("DPR_DATA_INTENT_ACTION", ACTION_BARCODE_DATA);
219 |
220 | properties.putInt("TRIG_AUTO_MODE_TIMEOUT", 2);
221 | properties.putString("TRIG_SCAN_MODE", "readOnRelease"); //This works for Hardware Trigger only! If scan is started from code, the code is responsible for a switching off the scanner before a decode
222 |
223 | mysendBroadcast(new Intent(ACTION_CLAIM_SCANNER)
224 | .putExtra(EXTRA_SCANNER, "dcs.scanner.imager")
225 | .putExtra(EXTRA_PROFILE, "DEFAULT")// "MyProfile1")
226 | .putExtra(EXTRA_PROPERTIES, properties)
227 | );
228 | }
229 | private void releaseScanner() {
230 | Log.d("IntentApiSample: ", "releaseScanner");
231 | mysendBroadcast(new Intent(ACTION_RELEASE_SCANNER));
232 | }
233 | private void setText(final String text) {
234 | if (textView != null) {
235 | runOnUiThread(new Runnable() {
236 | @Override
237 | public void run() {
238 | textView.setText(text);
239 | }
240 | });
241 | }
242 | }
243 | private String bytesToHexString(byte[] arr) {
244 | String s = "[]";
245 | if (arr != null) {
246 | s = "[";
247 | for (int i = 0; i < arr.length; i++) {
248 | s += "0x" + Integer.toHexString(arr[i]) + ", ";
249 | }
250 | s = s.substring(0, s.length() - 2) + "]";
251 | }
252 | return s;
253 | }
254 | }
--------------------------------------------------------------------------------
/app/src/main/java/sample/honeywell/com/intentapisample/SystemPropertyAccess.java:
--------------------------------------------------------------------------------
1 | package sample.honeywell.com.intentapisample;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.os.Build;
6 | import android.util.Log;
7 |
8 | import java.util.List;
9 | import java.util.Locale;
10 |
11 | public final class SystemPropertyAccess {
12 | private static final String TAG = SystemPropertyAccess.class.getSimpleName();
13 |
14 | public static String getProperty(String name, String defaultValue) {
15 | try {
16 | Class SystemProperties = Class.forName("android.os.SystemProperties");
17 | String result = (String) SystemProperties.getMethod("get", new Class[]{String.class, String.class}).invoke(SystemProperties, new Object[]{name, defaultValue});
18 | if (result.equals("")) {
19 | return "Not Supported";
20 | }
21 | return result;
22 | } catch (Exception e) {
23 | Log.wtf(TAG, "Failed to get system property", e);
24 | return null;
25 | }
26 | }
27 |
28 | public static void setProperty(String name, String value) {
29 | try {
30 | Class SystemProperties = Class.forName("android.os.SystemProperties");
31 | SystemProperties.getMethod("set", new Class[]{String.class, String.class}).invoke(SystemProperties, new Object[]{name, value});
32 | } catch (Exception e) {
33 | Log.wtf(TAG, "Failed to set system property", e);
34 | }
35 | }
36 |
37 | public static String getHSMVersionInfo() {
38 | StringBuffer result = new StringBuffer();
39 | for (int i = 0; i < PROPERTY_KEYWORDS.length; i++) {
40 | result.append(PROPERTY_KEYWORDS[i][1] + ": " + SystemPropertyAccess.getProperty(PROPERTY_KEYWORDS[i][0], null) + "\n");
41 | }
42 | return result.toString();
43 | }
44 |
45 | public static final String[][] PROPERTY_KEYWORDS;
46 |
47 | static {
48 | String[][] r0 = new String[30][];
49 | r0[0] = new String[]{"ro.hsm.assembly.date", "ID_FINAL_ASSEMBLY_DATE"};
50 | r0[1] = new String[]{"ro.hsm.asset.num", "ID_ASSET_NUMBER"};
51 | r0[2] = new String[]{"ro.hsm.bt.addr", "ID_BLUETOOTH_DEVICE_ADDRESS"};
52 | r0[3] = new String[]{"ro.hsm.cal.accel.zero_offset", "ID_CAL_ACCEL_ZERO_OFFSET"};
53 | r0[4] = new String[]{"ro.hsm.cal.gyro.zero_offset", "ID_CAL_GYRO_ZERO_OFFSET"};
54 | r0[5] = new String[]{"ro.hsm.calibration.accelerator", "ID_CALIBRATION_ACCELERATOR"};
55 | r0[6] = new String[]{"ro.hsm.calibration.gyro", "ID_CALIBRATION_GYRO"};
56 | r0[7] = new String[]{"ro.hsm.calibration.magnet", "ID_CALIBRATION_MAGNET"};
57 | r0[8] = new String[]{"ro.hsm.camera.enable_stamp", "ID_CAMERA_ENABLE_STAMP"};
58 | r0[9] = new String[]{"ro.hsm.extconf.num", "EXTCONFIG_NUM"};
59 | r0[10] = new String[]{"ro.hsm.extpart.num", "EXTPART_NUM"};
60 | r0[11] = new String[]{"ro.hsm.extserial.num", "EXTSERIAL_NUM"};
61 | r0[12] = new String[]{"ro.hsm.file.id", "FILE_ID"};
62 | r0[13] = new String[]{"ro.hsm.hw.has.gps", "HW_GPS"};
63 | r0[14] = new String[]{"ro.hsm.hw.rev", "HW_REV"};
64 | r0[15] = new String[]{"ro.hsm.mfg.ver", "MFG_VER"};
65 | r0[16] = new String[]{"ro.hsm.mm.feature", "MM_FEATURE"};
66 | r0[17] = new String[]{"ro.hsm.odm.num", "ODM_NUM"};
67 | r0[18] = new String[]{"ro.hsm.reset.reason", "RESET_REASON"};
68 | r0[19] = new String[]{"ro.hsm.imei.num", "ID_IMEI_NUMBER"};
69 | r0[20] = new String[]{"ro.hsm.meid.num", "ID_ME_NUMBER"};
70 | r0[21] = new String[]{"ro.hsm.model.num", "ID_MODEL_NUMBER"};
71 | r0[22] = new String[]{"ro.hsm.extserial.num", "ID_EX_SERIAL_NUMBER"};
72 | r0[23] = new String[]{"ro.hsm.extpart.num", "ID_EX_PART_NUMBER"};
73 | r0[24] = new String[]{"ro.hsm.extconf.num", "ID_EX_CONFIGURATION_NUMBER"};
74 | r0[25] = new String[]{"ro.hon.touch.ver.hw", "TOUCHSCREEN_HARDWARE_VER"};
75 | r0[26] = new String[]{"ro.hon.touch.ver.fw", "TOUCHSCREEN_FIRMWARE_VER"};
76 | r0[27] = new String[]{"ro.hon.touch.config", "TOUCHSCREEN_CONFIGURATION_VER"};
77 | r0[28] = new String[]{"ro.hsm.wireless.feature", "WIRELESS_FEATURE"};
78 | r0[29] = new String[]{"ro.hsm.wlan.addr", "ID_WLAN_MAC_ADDRESS"};
79 | PROPERTY_KEYWORDS = r0;
80 | }
81 |
82 | public static final String PKG_DCS_PREFIX = "com.intermec";
83 | public static final String PKG_DEMOS_PREFIX = "com.honeywell.demos";
84 | public static final String PKG_HONEYWELL_PREFIX = "com.honeywell";
85 | public static final String PKG_INTERMEC_PREFIX = "com.intermec";
86 | public static final String PKG_LICENSE_SERVICE_PREFIX = "com.honeywell.licenseservice";
87 | public static final String PKG_SYSTEM_TOOL_PREFIX = "com.honeywell.systemtools";
88 | public static final String PKG_TOOLS_PREFIX = "com.honeywell.tools";
89 | public static final String PKG_TOOL_SIP_PREFIX = "com.android.hsm";
90 |
91 | public static String getCommonESversion(Context context){
92 | String s="no EZConfig found";
93 | List pkgInfo = context.getPackageManager().getInstalledPackages(0);
94 | for (int i = 0; i < pkgInfo.size(); i++) {
95 | PackageInfo info = (PackageInfo) pkgInfo.get(i);
96 | if (info.packageName.contains("com.honeywell.tools")) {
97 | if(info.packageName.endsWith("ezconfig")){
98 | s = info.versionName;
99 | }
100 | }
101 | }
102 | return s;
103 | }
104 |
105 | public static String getSerialNumber(){
106 |
107 | try {
108 | Class SystemProperties = Class.forName("android.os.SystemProperties");
109 | String name="ro.hsm.extserial.num";
110 | String defaultValue=null;
111 | String result = (String) SystemProperties.getMethod("get", new Class[]{String.class, String.class}).invoke(SystemProperties, new Object[]{name, defaultValue});
112 | if (result.equals("")) {
113 | return "Not Supported";
114 | }
115 | return result;
116 | } catch (Exception e) {
117 | Log.wtf(TAG, "Failed to get system property", e);
118 | return null;
119 | }
120 |
121 |
122 | }
123 |
124 | public static String getSerialNumber2(){
125 | return Build.SERIAL;
126 | }
127 |
128 | public static String getPkgInfo(Context context) {
129 | StringBuffer result = new StringBuffer();
130 | StringBuffer demosInfo = new StringBuffer().append("demosInfo\n");
131 | StringBuffer toolsInfo = new StringBuffer().append("toolsInfo\n");
132 | StringBuffer appsInfo = new StringBuffer().append("appsInfo\n");
133 | List pkgInfo = context.getPackageManager().getInstalledPackages(0);
134 | for (int i = 0; i < pkgInfo.size(); i++) {
135 | PackageInfo info = (PackageInfo) pkgInfo.get(i);
136 | //Log.e("package name", info.packageName);
137 | if (info.packageName.contains(PKG_SYSTEM_TOOL_PREFIX)) {
138 | toolsInfo.append(getAppName(info.packageName, PKG_SYSTEM_TOOL_PREFIX.length() + 1) + ": " + info.versionName + "\n");
139 | } else if (info.packageName.contains("com.honeywell.tools")) {
140 | String sippacakge = "com.honeywell.tools.nosip";
141 | String carrierpackage = "com.honeywell.tools.carrierselection";
142 | if (!(info.packageName.equals("com.honeywell.tools.reboot") || info.packageName.equals(carrierpackage) || info.packageName.equals(sippacakge))) {
143 | toolsInfo.append(getAppName(info.packageName, "com.honeywell.tools".length() + 1) + ": " + info.versionName + "\n");
144 | }
145 | } else if (info.packageName.contains(PKG_TOOL_SIP_PREFIX)) {
146 | toolsInfo.append(getAppName(info.packageName, PKG_TOOL_SIP_PREFIX.length() + 1) + ": " + info.versionName + "\n");
147 | } else if (info.packageName.contains("com.honeywell.demos")) {
148 | demosInfo.append(getAppName(info.packageName, "com.honeywell.demos".length() + 1) + ": " + info.versionName + "\n");
149 | } else if (info.packageName.equals(PKG_LICENSE_SERVICE_PREFIX)) {
150 | toolsInfo.append(getAppName(info.packageName, PKG_HONEYWELL_PREFIX.length() + 1) + ": " + info.versionName + "\n");
151 | } else if (info.packageName.startsWith("com.intermec")) {
152 | toolsInfo.append(getAppName(info.packageName, "com.intermec".length() + 1) + ": " + info.versionName + "\n");
153 | } else {
154 | appsInfo.append(info.packageName + ": " + info.versionName + "\n");
155 | }
156 | }
157 | result.append("\n\nPOWER TOOLS AND DEMOS INFO\n");
158 | result.append("-------------------------\n");
159 | result.append(toolsInfo);
160 | result.append(demosInfo);
161 | return result.toString();
162 | }
163 |
164 | private static String getAppName(String pkgName, int subIndex) {
165 | if (pkgName == null || pkgName.length() == 0) {
166 | return "null";
167 | }
168 | return pkgName.substring(subIndex).toUpperCase(Locale.ENGLISH);
169 | }
170 | public static String getServicePack() {
171 | if (Build.DISPLAY.contains(".SP")) {
172 | return Build.DISPLAY;
173 | }
174 | return "No Service Pack";
175 | }
176 |
177 | public static String getBuilds(){
178 |
179 | String sV ="\n\nSYSTEM INFO\n" + "-------------------------\nPRODUCT: " + Build.PRODUCT + "\nBRAND: " + Build.BRAND + "\nSERIAL NUMBER: " + Build.SERIAL +
180 | "\nMODEL: " + Build.MODEL + "\nTYPE: " + Build.TYPE + "\nCPU_ABI: " + Build.CPU_ABI + "\nBUILD NUMBER: " + Build.DISPLAY + "\nINCREMENTAL: " + Build.VERSION.INCREMENTAL + "\nSERVICE_PACK: " +
181 | getServicePack() + "\nRELEASE: " + Build.VERSION.RELEASE + "\n";
182 | return sV;
183 | }
184 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Intent API Sample
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.0.1'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | google()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hjgode/IntentAPISample/ca1bb2c550686e823a394984c7690f18f2839d25/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Nov 08 15:06:45 CET 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------