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

DEV-900 Video Call Buttons: Order (Move Accept / Annehmen to the right), Colors (Red/Green), Language / Text (Android only?) - German #274

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This plugin does not provide a way to determine which platform you are running o
* [Examples](docs/EXAMPLES.md)
* [Platform support](docs/PLATFORM_SUPPORT.md)
* [Cloud build support (PG Build, IntelXDK)](docs/PHONEGAP_BUILD.md)
* [VoIP Videocall Callscreen Support](docs/VoIP_push_videocalls.md)
* [Push notification payload details](docs/PAYLOAD.md)
* [Contributing](.github/CONTRIBUTING.md)
* [License (MIT)](MIT-LICENSE)
Expand Down
86 changes: 86 additions & 0 deletions docs/VoIP_push_videocalls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# VoIP Videocall Callscreen Support

Enable Videocalls to be triggered on remote devices by sending a push notification.

This plugin allows for the displaying of a calling screen and then the activation of the app if the
user "picks up" the phone using Push Notifications to trigger the call.

The user can also choose to decline the call.

### Note 1: This plugin, out of the box, supports only **Android** VoIP Pushes.

You can use another plugin, [Customized iOS Callkit Plugin](cordova-plugin-callkit@https://github.com/trusted-care/cordova-plugin-callkit.git#1906e36e900fa3dd500d9a7cc174332d6dfa6caa) to add the same functionality to your iOS app as well.

### Note 2: Additional help is available

If you want to integrate this in your app, we can share additional code & information on the implementation on the
client / Javascript side too, please get in touch with us -> daniel at dornhardt dot com & we can go from there.

## How to do it?

- Add additional information to the push payload
- Customize the call screen for use with your app

## Push Payload:

In order to activate the calling screen in the app, you need to add the following to your push & the push plugin will show a calling screen:

```js
var content = {
priority: 'normal', // Valid values are "normal" and "high."
data: {
from: "Your Appname",
title: '', // title isn't necessary because the PN isn't visible
body: 'Incoming Call', // the text that is displayed in the notification
sound: 'default',
vibrate: true,
userId: our_user_id, // add additional information you might need in the cordova app (?)
voip: true, // THIS activates the callscreen
caller: `${currentUser.profile.firstname} ${currentUser.profile.lastname}`, // construct a nice caller name for the call screen
isCancelPush: `${isCancel}`, // set this to true if you sent a call push before to _hang up_ the
// call in case the caller gives up before the recipient accepts or cancels the call
callId: 'individual_call_identifier', // we use this to create two webhook URLs which allow the plugin (see below)
// to update the call status on the calling server / app
callbackUrl: `${getExternalRootUrl()}updateStatus`, // this will be used to construct two callback URLs like this:
//
// The moment the device receives the push, this URL will be constructed & called in order to be
// able to show a "ringing" status on the calling site:
//
// `${getExternalRootUrl()}updateStatus?input=connected&id=<callId passed in as payload param>`
//
// If the callee declines the call, the following URL will be constructed & called from the plugin:
//
// `${getExternalRootUrl()}updateStatus?input=declined_callee&id=<callId passed in as payload param>`

}
};
```

### How to customize the call screen:


To customize view of call screen, you can replace/edit the following resources:
`res/drawable/ic_brand_logo.xml` - can be replaced to set new screen logo.

To modify other elements of the screen you can change the following resource files:
`res/values/push_strings.xml` - to replace call screen texts,
`res/values/push_dimens.xml` - contains dimensions to change call screen margins, buttons sizes,
`res/values/push_styles.xml` - contains styles of call screen buttons, fonts, that can be changed.


For eg. `Meteor.js` users, you can use the `cordova-build-override` - folder to customize the callscreen:

![Pasted image 20240227150303.png](./assets/cordova-build-override.png)

[Meteor.js: Cordova: Advanced build customization ](https://guide.meteor.com/cordova#advanced-build)

### Additional useful cordova packages:

`[email protected]` - make sure the phone doesn't lock itself whilst you are in a video call
`cordova-plugin-advanced-background-mode@https://github.com/brunochikuji/cordova-plugin-background-mode.git#5df0632fdd40d4e1f35fff3a632202824b70929d` - keep calls & connections open while the app is in the background


## Documentation ToDos:

- add infos to `PAYLOAD.md`
- Document iOS VoIP Push configuration
Binary file added docs/assets/cordova-build-override.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 32 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="${applicationId}.permission.PushHandlerActivity"/>
<permission android:name="${applicationId}.permission.PushHandlerActivity" android:protectionLevel="signature"></permission>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:exported="true" android:launchMode="singleTop" android:showOnLockScreen="true" android:name="com.adobe.phonegap.push.IncomingCallActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity android:exported="true" android:name="com.adobe.phonegap.push.IncomingCallActionHandlerActivity" />
<activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true" android:permission="${applicationId}.permission.PushHandlerActivity"/>
<activity android:name="com.adobe.phonegap.push.BackgroundHandlerActivity" android:exported="true" android:permission="${applicationId}.permission.BackgroundHandlerActivity">
<intent-filter>
Expand Down Expand Up @@ -71,14 +77,39 @@
<framework src="androidx.core:core:$ANDROIDX_CORE_VERSION" />
<framework src="me.leolin:ShortcutBadger:1.1.22@aar"/>
<framework src="com.google.firebase:firebase-messaging:$FCM_VERSION"/>



<!-- Setup view of push Call Screen -->
<resource-file src="src/android/res/values/push_dimens.xml" target="res/values/push_dimens.xml" />
<resource-file src="src/android/res/values/push_styles.xml" target="res/values/push_styles.xml" />
<resource-file src="src/android/res/values/push_strings.xml" target="res/values/push_strings.xml" />
<resource-file src="src/android/res/values/push_colors.xml" target="res/values/push_colors.xml" />
<resource-file src="src/android/res/drawable/ic_brand_logo.xml" target="res/drawable/ic_brand_logo.xml" />

<resource-file src="src/android/res/layout/activity_incoming_call.xml" target="res/layout/activity_incoming_call.xml" />
<resource-file src="src/android/res/drawable/circle_animation_avd.xml" target="res/drawable/circle_animation_avd.xml" />
<resource-file src="src/android/res/drawable/ic_accept.xml" target="res/drawable/ic_accept.xml" />
<resource-file src="src/android/res/drawable/ic_decline.xml" target="res/drawable/ic_decline.xml" />
<resource-file src="src/android/res/font/nunito_regular.ttf" target="res/font/nunito_regular.ttf" />

<config-file target="res/values/colors.xml" parent="/*">
<color name="brand_text">#00054b</color>
</config-file>

<!-- Resources -->
<source-file src="src/android/com/adobe/phonegap/push/IncomingCallActivity.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/FCMService.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/OnNotificationReceiverActivity.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushConstants.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/BackgroundHandlerActivity.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushPlugin.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushDismissedHandler.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/IncomingCallActionHandlerActivity.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/IncomingCallHelper.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/ResourcesMapper.kt" target-dir="java/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/ResourcesKeys.kt" target-dir="java/com/adobe/phonegap/push/"/>
</platform>

<platform name="browser">
Expand Down
Loading