Skip to content
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

Android PhoneGap Plugin for Twilio Client #7

Merged
merged 62 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
3d9b51b
First pass at Twilio Client Plugin for Android for PhoneGap 2.9
jefflinwood Jul 16, 2013
9995849
Reenable sounds, unregister local broadcast manager, avoid thread iss…
jefflinwood Jul 17, 2013
1567e91
Add disconnect and connect methods for the device and connection
jefflinwood Jul 17, 2013
d638351
Update all old cordova.exec arguments to new method signature
jefflinwood Jul 17, 2013
2f69c8f
Add code to handle incoming events, mute, connection digits, and corr…
jefflinwood Jul 18, 2013
67d14f8
Add device status and connection status
jefflinwood Jul 18, 2013
dfe410c
Slightly modified version of tcPlugin.js for Android - to deal with t…
jefflinwood Jul 19, 2013
7af7504
Updated README for Android phonegap plugin
jefflinwood Jul 19, 2013
8053175
Updated plugin for use with Cordova 2.9. Added two functions to manag…
lylepratt Jul 19, 2013
e6c9bdd
Add notifications when an incoming call appears
jefflinwood Jul 20, 2013
d982e16
Added helper method to turn speaker phone on or off. Fixed bug with s…
lylepratt Jul 21, 2013
43377bb
Added documentation of new setSpeaker method.
lylepratt Jul 21, 2013
1e3cb7d
Removed commented code. Removed sound exists check.
lylepratt Jul 22, 2013
08f2c50
Removed unneeded comment.
lylepratt Jul 22, 2013
66cb761
Fixed merge conflicts.
lylepratt Jul 24, 2013
2561ca3
Altered how showNotification works in Android plugin. Added setSpeake…
lylepratt Aug 2, 2013
f23f0f3
Fixed issue with intent messing with back button in Android. Changed …
lylepratt Aug 2, 2013
e60d7dd
Merge pull request #1 from lylepratt/master
jefflinwood Aug 23, 2013
a16dac7
Twilio Client Plugin for iOS is now Plugman-compatible
jefflinwood Nov 4, 2013
9e93f26
Create plugman compatible PhoneGap/Cordova plugin for Twilio Client f…
jefflinwood Nov 4, 2013
701d746
Merge pull request #2 from jefflinwood/plugman
jefflinwood Nov 4, 2013
c55dfc8
Updated README for plugman installation
jefflinwood Nov 4, 2013
9f41bf0
Delete tcPluginIOS.js
jefflinwood Nov 4, 2013
4a2ac2b
Updated plugin.xml to remove extraneous tcPluginIOS.js file
jefflinwood Nov 4, 2013
3738360
Fix bug with speaker code where AVFoundation was forgotten
jefflinwood Nov 4, 2013
8634c80
Clean up device status method
jefflinwood Nov 4, 2013
59afdf6
updating to phonegap 3.x
peder541 Aug 15, 2014
75c4e22
Added necessary permissions to Android Plugin and changed TCPlugin.ja…
peder541 Aug 16, 2014
9dc7271
Merge pull request #8 from peder541/master
jefflinwood Aug 17, 2014
e46173b
Add connection parameters to iOS
jefflinwood Sep 3, 2014
54df23e
Add Connection Parameters for Android
jefflinwood Sep 3, 2014
0780cfe
check if device status after initializing with token
peder541 Sep 20, 2014
d37411c
Twilio.Device.status needs to be passed a callback function
peder541 Sep 20, 2014
40b45a2
check device status when intializing with token
peder541 Oct 2, 2014
5cc3ab2
release device if token is an empty string
peder541 Oct 2, 2014
2067f49
Merge pull request #14 from peder541/master
jefflinwood Dec 10, 2014
f3d6f29
Updated iOS SDK installation directions for 1.2
jefflinwood Dec 11, 2014
e6235d2
Updated README with cross-platform install directions.
jefflinwood Jan 10, 2015
5fc6b34
Updated to support Twilio Client for Android 1.2
jefflinwood Jan 10, 2015
1522ba1
Explain that the Android Support v4 Library is required
jefflinwood Jan 10, 2015
04007eb
Updated README with latest versions of what's been tested
jefflinwood Apr 12, 2015
1355bfc
Added example project
jefflinwood Jun 11, 2015
29b7d88
Update README.md
jefflinwood Jul 6, 2015
47cdfb0
Delay one second when determining device status after creating the Tw…
jefflinwood Sep 4, 2015
67c24ed
Remove PDF
jefflinwood Sep 4, 2015
a9cf051
Updated plugin to version 1.0.3
jefflinwood Sep 4, 2015
67c977a
Updated with latest compatibility testing
jefflinwood Sep 4, 2015
eed0638
Updated with compatibility testing
jefflinwood Nov 25, 2015
2bb2a5e
Fix ready status missed if token validation takes more than 1s
romainPellerin Dec 3, 2015
1ece689
Merge pull request #48 from romainPellerin/master
jefflinwood Dec 7, 2015
dcafc08
Replaced deprecated method toSuccessCallbackString
marcopadillo Apr 4, 2016
9a7c464
Merge pull request #56 from marcopadillo/master
jefflinwood Apr 7, 2016
5481a56
Plugin 1.0.4 version tested on latest Cordova/Twilio libraries
jefflinwood Apr 7, 2016
650a585
Updated with Android Marshmallow Support information
jefflinwood Apr 8, 2016
8f410b6
Update to use <framework> tag to include Android support v4 library
jefflinwood Jun 9, 2016
2cd338a
Merge pull request #62 from jefflinwood/UseFrameworks
jefflinwood Jun 9, 2016
9bcb724
Updated to support Cordova Android 5.2.1, Twilio SDK 1.2.17 and gradl…
jefflinwood Aug 15, 2016
e1ecd7c
Changes for 1.0.6
jefflinwood Aug 15, 2016
effc8a8
Merge pull request #67 from jefflinwood/SupportGradleDownload
jefflinwood Aug 15, 2016
89f4194
Added runtime permissions for SDK 23/Marshmallow
jefflinwood Aug 16, 2016
f312b1b
Merge pull request #68 from jefflinwood/SDK23Permissions
jefflinwood Aug 16, 2016
596f846
Fixed formatting
jefflinwood Aug 16, 2016
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
83 changes: 74 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,84 @@
# Twilio Client Phonegap plugins
# Twilio Client Phonegap plugins for iOS and Android (version 1.0.7)

This is a Phonegap plugin that exposes the same JS API as Twilio Client for web as much as possible, meaning you should be able to use the same Twilio Client code from your web application inside of your Phonegap application with few if any modifications.
These are Phonegap plugins that expose the same JS API as Twilio Client for web as much as possible, meaning you should be able to use the same Twilio Client code from your web application inside of your Phonegap application with few if any modifications.

# Latest versions tested with this plugin
#### (as of August 16, 2016)
- Cordova 6.3.1
- Cordova Android 5.2.1
- Cordova iOS 4.1.0
- Twilio Client for iOS 1.2.8
- Twilio Client for Android 1.2.17
- XCode 7.3
- Android SDK 23

# Android Gradle Support
- Version 1.0.6 and above now downloads the latest version of the Twilio SDK from jcenter - you will need to use the Cordova Android plugin 5.2.1 for this, as the version of Gradle needed is 2.1.3, and 5.2.1 also includes jcenter as a default repository.

# Android Support Library
- Versions 1.0.4 and earlier of the plugin required you to include the Android support library v4 in the lib. Cordova now has a solution for requiring Android libs through Gradle dependencies. This will save you a step on installation, as well as making this plugin (as of versin 1.0.5) compatible with other plugins such as the PhoneGap Push plugin. One handy tip I found on that plugin is that you may need to update your Android support library using this command line tool, if you get an error saying that the Android Support v4 library can not be found:

`android update sdk --no-ui --filter "extra"`

Please file an issue if you have problems with the Android support library or any compatibility issues with other plugins.

# Example application
https://github.com/jefflinwood/TwilioClientPhoneGapExampleApp

# PhoneGap/Cordova Overview

- Install the most recent version of Cordova (as of this writing, 6.3.1 tools - http://http://cordova.apache.org/
- Install plugman - https://github.com/apache/cordova-plugman

# Both Platforms at once

##Instructions
```
cordova plugin add https://github.com/jefflinwood/twilio_client_phonegap.git
```

# iOS only

##Instructions

```
plugman install --platform ios --project platforms/ios --plugin https://github.com/jefflinwood/twilio_client_phonegap.git

```

- Follow the directions to create a new PhoneGap/Cordova iOS application.

- Follow the instructions in the Twilio iOS client quickstart, e.g. copy headers and static lib into your xcode project, link required frameworks, linker flags, etc.
- After installing the Twilio Client plugin, you will need to download and install the Twilio Client SDK for iOS - follow the directions provided after plugman finishes.

- Copy the Objective-C files into the `plugins` directory of your Phonegap project, and the JavaScript file into the `www` directory.
# Android only

## Instructions

```
plugman install --platform android --project platforms/android --plugin https://github.com/jefflinwood/twilio_client_phonegap.git

```

## Additional Features

In addition to the standard features of the Twilio Client JS Library, you can also use the included showNotification and cancelNotification functions to display a UILocalNotifcation to the user when during an incoming call while the app is running in the background:

```javascript
Twilio.Connection.showNotification("Notification Text", "notification_sound.wav");
```

```javascript
Twilio.Connection.cancelNotification();
```

You can also turn the device's speaker phone on or off during a call using the following method:

```javascript
Twilio.Connection.setSpeaker("on");
```

- Add a new plugin XML item in config.xml:
<feature name="TCPlugin">
<param name="ios-package" value="TCPlugin" />
</feature>
## Changelog
- 1.0.7 - Added Marshmallow/SDK 23 support for runtime permissions
- 1.0.6 - Updated Android platform for plugin to pull in Twilio Android SDK using Gradle

## Limitations

Expand Down
191 changes: 0 additions & 191 deletions iOS/TCPlugin.m

This file was deleted.

78 changes: 78 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.twilioclient"
version="1.0.7">

<name>TwilioClient</name>
<description>Use the native Twilio Client for iOS or Android with Cordova/PhoneGap and the Twilio Client JavaScript API</description>
<author>Stevie Graham/Lyle Pratt/Jeff Linwood</author>
<license>Apache</license>

<asset src="www/tcPlugin.js" target="js/tcPlugin.js" />

<!-- android -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.phonegap.plugins.twilioclient.IncomingConnectionActivity" android:theme="@android:style/Theme.NoDisplay"/>
<service android:name="com.twilio.client.TwilioClientService" android:exported="false" />
</config-file>

<config-file target="res/xml/config.xml" parent="/widget">
<feature name="TCPlugin">
<param name="android-package" value="com.phonegap.plugins.twilioclient.TCPlugin"/>
</feature>
</config-file>

<framework src="com.android.support:support-v4:+" />
<framework src="com.twilio:client-android:1.2.17"/>


<source-file src="src/android/com/phonegap/plugins/twilioclient/IncomingConnectionActivity.java"
target-dir="src/com/phonegap/plugins/twilioclient" />
<source-file src="src/android/com/phonegap/plugins/twilioclient/TCPlugin.java"
target-dir="src/com/phonegap/plugins/twilioclient" />
</platform>

<!-- ios -->
<platform name="ios">
<!-- Add the Twilio Client plugin to the iOS app's config.xml -->
<config-file target="config.xml" parent="widget">
<feature name="TCPlugin">
<param name="ios-package"
value="TCPlugin"/>
</feature>
</config-file>

<!-- Add support for background VOIP and audio to the plist -->
<config-file target="*-Info.plist" parent="UIBackgroundModes">
<array>
<string>voip</string>
<string>audio</string>
</array>
</config-file>


<framework src="AudioToolbox.framework" />
<framework src="AVFoundation.framework" />
<framework src="CFNetwork.framework" />
<framework src="SystemConfiguration.framework" />

<header-file src="src/ios/TCPlugin.h" />
<source-file src="src/ios/TCPlugin.m" />

<info>
You need to download __Twilio Client for iOS__ from https://www.twilio.com/docs/client/ios. Uncompress the download - you will need to follow a few steps that plugman can not do yet:

* Add the Twilio Client static libraries (the .a files in the Libraries folder) to your Xcode project

* Add the Twilio Client headers files (the .h files in the Headers folder) to your Xcode project
</info>
</platform>
</plugin>
Loading