Skip to content

Commit 969a089

Browse files
committed
feat: add support for api17
1 parent ac28ba8 commit 969a089

File tree

11 files changed

+18
-57
lines changed

11 files changed

+18
-57
lines changed

DevelopmentWorkflow.md

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Prerequisites](#prerequisites)
66
- [Develop locally](#develop-locally)
77
- [Testing the plugin](#testing-the-plugin)
8+
- [Native android changes](#native-android-changes)
89

910
<!-- /TOC -->
1011

@@ -34,4 +35,15 @@ npm run demo.android
3435

3536
The demo application is configured to run on a simulator/emulator on the local machine. If you want to test on a real device, you should change the URL in the `demo/app/home-view-model.ts` to point to the machine that is running the demo server. Be careful if using an online test service, e.g. [http://httpbin.org/post](http://httpbin.org/post). Some services are configured to return the uploaded file contents in the server response, which might crash the demo app if the uploaded file is large.
3637

38+
## Native android changes
39+
40+
For android, the plugin uses [a fork](https://github.com/NativeScript/android-upload-service) of the [gotev/android-upload-service](https://github.com/gotev/android-upload-service) library for Android.
41+
Avoid fixes and new features in the fork. Use the original repository and then update the fork with the changes.
42+
The native library is used in the plugin as an aar file added in the plugin's platforms/android directory.
43+
Here's how to reflect any changes in the native library in this plugin. First make sure the changes are included in the fork. Then clone the fork and run the following command in its root directory:
44+
```
45+
./gradlew clean assembleRelease
46+
```
47+
This will produce a new aar file here: android-upload-service/uploadservice/build/outputs/aar/uploadservice-release.aar. Use it to replace the previous aar in the plugin: nativescript-background-http/src/platforms/android/uploadservice-release.aar
48+
3749
For details on plugins development workflow, read [NativeScript plugins documentation](https://docs.nativescript.org/plugins/building-plugins#step-2-set-up-a-development-workflow) covering that topic.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A cross platform plugin for [the NativeScript framework](http://www.nativescript
44

55
[There is a stock NativeScript `http` module that can handle GET/POST requests that work with strings and JSONs](http://docs.nativescript.org/ApiReference/http/HOW-TO). It however comes short in features when it comes to really large files.
66

7-
The plugin uses [NSURLSession with background session configuration for iOS](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionConfiguration_class/index.html#//apple_ref/occ/clm/NSURLSessionConfiguration/backgroundSessionConfigurationWithIdentifier:); and the [alexbbb/android-upload-service](https://github.com/alexbbb/android-upload-service) library for Android.
7+
The plugin uses [NSURLSession with background session configuration for iOS](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLSessionConfiguration_class/index.html#//apple_ref/occ/clm/NSURLSessionConfiguration/backgroundSessionConfigurationWithIdentifier:); and [a fork](https://github.com/NativeScript/android-upload-service) of the [gotev/android-upload-service](https://github.com/gotev/android-upload-service) library for Android.
88

99
## Installation
1010

demo-angular/app/App_Resources/Android/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:xlargeScreens="true"/>
1212

1313
<uses-sdk
14-
android:minSdkVersion="18"
14+
android:minSdkVersion="17"
1515
android:targetSdkVersion="__APILEVEL__"/>
1616

1717
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

demo-vue/app/App_Resources/Android/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:xlargeScreens="true"/>
1212

1313
<uses-sdk
14-
android:minSdkVersion="18"
14+
android:minSdkVersion="17"
1515
android:targetSdkVersion="__APILEVEL__"/>
1616

1717
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

demo/app/App_Resources/Android/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:xlargeScreens="true"/>
1212

1313
<uses-sdk
14-
android:minSdkVersion="18"
14+
android:minSdkVersion="17"
1515
android:targetSdkVersion="__APILEVEL__"/>
1616

1717
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

src/.npmignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ tsconfig.json
77
*.tgz
88
/package
99
/platforms/android/**/*
10-
!platforms/android/include.gradle
11-
!platforms/android/nativescript_background_http.aar
10+
!platforms/android/uploadservice-release.aar

src/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
"scripts": {
1818
"tsc": "tsc -skipLibCheck",
1919
"build": "npm i && tsc",
20-
"postclone": "npm i && node scripts/postclone.js && cd ../demo && npm i && cd ../src && npm run plugin.link",
2120
"test.android": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build android && tns test android --justlaunch",
2221
"test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build ios && tns test ios --justlaunch",
2322
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
24-
"plugin.link": "npm link && cd ../demo && npm link nativescript-background-http && cd ../src",
25-
"plugin.tscwatch": "npm run tsc -- -w",
2623
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios",
2724
"demo-angular.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios",
2825
"demo-vue.ios": "npm i && npm run tsc && cd ../demo-vue && tns run ios",
@@ -34,8 +31,7 @@
3431
"server": "cd ../demo-server && npm run start",
3532
"plugin.prepare": "npm run tsc && cd ../demo && tns plugin remove nativescript-background-http && tns plugin add ../src",
3633
"clean": "cd ../demo && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link",
37-
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'",
38-
"prepare": "node scripts/prepare.js"
34+
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'"
3935
},
4036
"keywords": [
4137
"background",

src/platforms/android/AndroidManifest.xml

-17
This file was deleted.

src/platforms/android/include.gradle

-8
This file was deleted.
90.3 KB
Binary file not shown.

src/scripts/prepare.js

-21
This file was deleted.

0 commit comments

Comments
 (0)