Skip to content

feat: add support for api17 #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions DevelopmentWorkflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [Prerequisites](#prerequisites)
- [Develop locally](#develop-locally)
- [Testing the plugin](#testing-the-plugin)
- [Native android changes](#native-android-changes)

<!-- /TOC -->

Expand Down Expand Up @@ -34,4 +35,15 @@ npm run demo.android

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.

## Native android changes

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.
Avoid fixes and new features in the fork. Use the original repository and then update the fork with the changes.
The native library is used in the plugin as an aar file added in the plugin's platforms/android directory.
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:
```
./gradlew clean assembleRelease
```
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

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.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A cross platform plugin for [the NativeScript framework](http://www.nativescript

[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.

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.
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.

## Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:xlargeScreens="true"/>

<uses-sdk
android:minSdkVersion="18"
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
2 changes: 1 addition & 1 deletion demo-vue/app/App_Resources/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:xlargeScreens="true"/>

<uses-sdk
android:minSdkVersion="18"
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:xlargeScreens="true"/>

<uses-sdk
android:minSdkVersion="18"
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Expand Down
3 changes: 1 addition & 2 deletions src/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ tsconfig.json
*.tgz
/package
/platforms/android/**/*
!platforms/android/include.gradle
!platforms/android/nativescript_background_http.aar
!platforms/android/uploadservice-release.aar
6 changes: 1 addition & 5 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
"scripts": {
"tsc": "tsc -skipLibCheck",
"build": "npm i && tsc",
"postclone": "npm i && node scripts/postclone.js && cd ../demo && npm i && cd ../src && npm run plugin.link",
"test.android": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build android && tns test android --justlaunch",
"test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build ios && tns test ios --justlaunch",
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
"plugin.link": "npm link && cd ../demo && npm link nativescript-background-http && cd ../src",
"plugin.tscwatch": "npm run tsc -- -w",
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios",
"demo-angular.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios",
"demo-vue.ios": "npm i && npm run tsc && cd ../demo-vue && tns run ios",
Expand All @@ -34,8 +31,7 @@
"server": "cd ../demo-server && npm run start",
"plugin.prepare": "npm run tsc && cd ../demo && tns plugin remove nativescript-background-http && tns plugin add ../src",
"clean": "cd ../demo && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link",
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'",
"prepare": "node scripts/prepare.js"
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'"
},
"keywords": [
"background",
Expand Down
17 changes: 0 additions & 17 deletions src/platforms/android/AndroidManifest.xml

This file was deleted.

8 changes: 0 additions & 8 deletions src/platforms/android/include.gradle

This file was deleted.

Binary file added src/platforms/android/uploadservice-release.aar
Binary file not shown.
21 changes: 0 additions & 21 deletions src/scripts/prepare.js

This file was deleted.