@kaleem766/react-native-incoming-call 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/IncomingCall.podspec +29 -0
- package/LICENSE +20 -0
- package/README.md +280 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +118 -0
- package/android/src/main/AndroidManifest.xml +35 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCall.kt +219 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallActivity.kt +314 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallModule.kt +152 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallPackage.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/incomingcall/IncomingCallService.kt +109 -0
- package/ios/IncomingCall.swift +28 -0
- package/lib/module/IncomingCall.nitro.js +4 -0
- package/lib/module/IncomingCall.nitro.js.map +1 -0
- package/lib/module/index.js +137 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/IncomingCall.nitro.d.ts +21 -0
- package/lib/typescript/src/IncomingCall.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +43 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHybridIncomingCallSpec.cpp +101 -0
- package/nitrogen/generated/android/c++/JHybridIncomingCallSpec.hpp +73 -0
- package/nitrogen/generated/android/c++/views/JHybridIncomingCallStateUpdater.cpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridIncomingCallStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/incomingcall+autolinking.cmake +83 -0
- package/nitrogen/generated/android/incomingcall+autolinking.gradle +27 -0
- package/nitrogen/generated/android/incomingcallOnLoad.cpp +56 -0
- package/nitrogen/generated/android/incomingcallOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/HybridIncomingCallSpec.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/incomingcallOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/views/HybridIncomingCallManager.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/incomingcall/views/HybridIncomingCallStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/IncomingCall+autolinking.rb +60 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Bridge.hpp +83 -0
- package/nitrogen/generated/ios/IncomingCall-Swift-Cxx-Umbrella.hpp +45 -0
- package/nitrogen/generated/ios/IncomingCallAutolinking.mm +33 -0
- package/nitrogen/generated/ios/IncomingCallAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridIncomingCallSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridIncomingCallSpecSwift.hpp +121 -0
- package/nitrogen/generated/ios/c++/views/HybridIncomingCallComponent.mm +127 -0
- package/nitrogen/generated/ios/swift/HybridIncomingCallSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridIncomingCallSpec_cxx.swift +270 -0
- package/nitrogen/generated/shared/c++/HybridIncomingCallSpec.cpp +32 -0
- package/nitrogen/generated/shared/c++/HybridIncomingCallSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/views/HybridIncomingCallComponent.cpp +127 -0
- package/nitrogen/generated/shared/c++/views/HybridIncomingCallComponent.hpp +115 -0
- package/nitrogen/generated/shared/json/IncomingCallConfig.json +14 -0
- package/package.json +180 -0
- package/src/IncomingCall.nitro.ts +27 -0
- package/src/index.tsx +173 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "IncomingCall"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/Muhammadkaleem/react-native-incoming-call.git.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = [
|
|
17
|
+
"ios/**/*.{swift}",
|
|
18
|
+
"ios/**/*.{m,mm}",
|
|
19
|
+
"cpp/**/*.{hpp,cpp}",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
s.dependency 'React-jsi'
|
|
23
|
+
s.dependency 'React-callinvoker'
|
|
24
|
+
|
|
25
|
+
load 'nitrogen/generated/ios/IncomingCall+autolinking.rb'
|
|
26
|
+
add_nitrogen_files(s)
|
|
27
|
+
|
|
28
|
+
install_modules_dependencies(s)
|
|
29
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MuhammadKaleem
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# react-native-incoming-call
|
|
2
|
+
|
|
3
|
+
> Full-screen incoming call UI for React Native — works on foreground, background, and lock screen on Android. Built on [Nitro Modules](https://nitro.margelo.com/) for maximum native performance.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Full-screen incoming call activity shown above the lock screen
|
|
10
|
+
- Wakes the device screen and dismisses the keyguard automatically
|
|
11
|
+
- Works in foreground, background, and killed-app states
|
|
12
|
+
- Foreground service keeps the call alive when the app is not running
|
|
13
|
+
- Answer / Reject buttons with event callbacks to JavaScript
|
|
14
|
+
- Auto-timeout with configurable duration
|
|
15
|
+
- Customisable caller name, avatar, background colour, and call type
|
|
16
|
+
- Inline `IncomingCallView` Nitro View for embedding in your own React Native screen
|
|
17
|
+
- Event-driven API — subscribe with a simple `addEventListener` / cleanup function
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Platform support
|
|
22
|
+
|
|
23
|
+
| Platform | Support |
|
|
24
|
+
|----------|---------|
|
|
25
|
+
| Android | ✅ Full support |
|
|
26
|
+
| iOS | 🔜 Planned (CallKit) |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# npm
|
|
34
|
+
npm install react-native-incoming-call react-native-nitro-modules
|
|
35
|
+
|
|
36
|
+
# yarn
|
|
37
|
+
yarn add react-native-incoming-call react-native-nitro-modules
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
[react-native-nitro-modules](https://nitro.margelo.com/) is a required peer dependency.
|
|
41
|
+
|
|
42
|
+
### Android permissions
|
|
43
|
+
|
|
44
|
+
The library merges its own `AndroidManifest.xml` automatically. If you need to declare them manually, add the following to your app's `AndroidManifest.xml`:
|
|
45
|
+
|
|
46
|
+
```xml
|
|
47
|
+
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
48
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
49
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
50
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
|
|
51
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Quick start
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import IncomingCall from 'react-native-incoming-call';
|
|
60
|
+
|
|
61
|
+
// Show the incoming call screen (from a push notification handler, etc.)
|
|
62
|
+
await IncomingCall.display({
|
|
63
|
+
uuid: 'call-abc-123',
|
|
64
|
+
callerName: 'John Doe',
|
|
65
|
+
avatar: 'https://example.com/avatar.jpg',
|
|
66
|
+
callType: 'audio', // 'audio' | 'video'
|
|
67
|
+
backgroundColor: '#1A1A2E',
|
|
68
|
+
timeout: 20000, // auto-reject after 20 s
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## API reference
|
|
75
|
+
|
|
76
|
+
### `IncomingCall.display(options)`
|
|
77
|
+
|
|
78
|
+
Starts the foreground service and launches the full-screen call activity.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
IncomingCall.display({
|
|
82
|
+
uuid: string; // unique call ID (required)
|
|
83
|
+
callerName: string; // caller display name (required)
|
|
84
|
+
avatar?: string; // remote avatar URL
|
|
85
|
+
callType?: 'audio' | 'video'; // defaults to 'audio'
|
|
86
|
+
backgroundColor?: string; // hex colour, e.g. '#1A1A2E'
|
|
87
|
+
timeout?: number; // ms before auto-reject, default 30000
|
|
88
|
+
}): Promise<void>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `IncomingCall.answer(uuid)`
|
|
92
|
+
|
|
93
|
+
Programmatically answer the call and emit `onAnswer`.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
await IncomingCall.answer('call-abc-123');
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `IncomingCall.reject(uuid)`
|
|
100
|
+
|
|
101
|
+
Programmatically reject the call and emit `onReject`.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
await IncomingCall.reject('call-abc-123');
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `IncomingCall.end(uuid)`
|
|
108
|
+
|
|
109
|
+
End an active call and stop the foreground service.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
await IncomingCall.end('call-abc-123');
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `IncomingCall.addEventListener(event, listener)`
|
|
116
|
+
|
|
117
|
+
Subscribe to a call lifecycle event. Returns an unsubscribe function.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const unsubscribe = IncomingCall.addEventListener('onAnswer', (data) => {
|
|
121
|
+
console.log('Answered:', data.uuid, data.timestamp);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// later…
|
|
125
|
+
unsubscribe();
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
| Event | When fired |
|
|
129
|
+
|-------|-----------|
|
|
130
|
+
| `onAnswer` | User taps Accept or `answer()` is called |
|
|
131
|
+
| `onReject` | User taps Decline or `reject()` is called |
|
|
132
|
+
| `onTimeout` | Timeout elapsed with no user action |
|
|
133
|
+
|
|
134
|
+
### `IncomingCall.removeEventListener(event, listener)`
|
|
135
|
+
|
|
136
|
+
Alternative to calling the returned unsubscribe function.
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
IncomingCall.removeEventListener('onAnswer', myListener);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Event data shape
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
interface IncomingCallEventData {
|
|
148
|
+
uuid: string; // the call ID passed to display()
|
|
149
|
+
timestamp: number; // Unix epoch ms
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## IncomingCallView (Nitro View)
|
|
156
|
+
|
|
157
|
+
Embed an inline call UI inside your own React Native screen (foreground use-case).
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { IncomingCallView } from 'react-native-incoming-call';
|
|
161
|
+
|
|
162
|
+
<IncomingCallView
|
|
163
|
+
color="#1A1A2E"
|
|
164
|
+
callerName="John Doe"
|
|
165
|
+
callType="audio"
|
|
166
|
+
style={{ width: '100%', height: 220, borderRadius: 16 }}
|
|
167
|
+
/>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
|------|------|---------|-------------|
|
|
172
|
+
| `color` | `string` | `"#1A1A2E"` | Background colour (hex) |
|
|
173
|
+
| `callerName` | `string` | — | Caller display name |
|
|
174
|
+
| `avatar` | `string` | — | Avatar URL |
|
|
175
|
+
| `callType` | `string` | `"audio"` | `"audio"` or `"video"` |
|
|
176
|
+
| `timeout` | `number` | `30000` | Auto-reject timeout (ms) |
|
|
177
|
+
|
|
178
|
+
**Methods** (via ref):
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const ref = useRef<IncomingCallViewRef>(null);
|
|
182
|
+
|
|
183
|
+
ref.current?.answerCall();
|
|
184
|
+
ref.current?.rejectCall();
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Full example
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
import React, { useEffect } from 'react';
|
|
193
|
+
import { Button } from 'react-native';
|
|
194
|
+
import IncomingCall from 'react-native-incoming-call';
|
|
195
|
+
|
|
196
|
+
export default function App() {
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
const unsubAnswer = IncomingCall.addEventListener('onAnswer', (d) => console.log('answered', d.uuid));
|
|
199
|
+
const unsubReject = IncomingCall.addEventListener('onReject', (d) => console.log('rejected', d.uuid));
|
|
200
|
+
const unsubTimeout = IncomingCall.addEventListener('onTimeout', (d) => console.log('timeout', d.uuid));
|
|
201
|
+
|
|
202
|
+
return () => {
|
|
203
|
+
unsubAnswer();
|
|
204
|
+
unsubReject();
|
|
205
|
+
unsubTimeout();
|
|
206
|
+
};
|
|
207
|
+
}, []);
|
|
208
|
+
|
|
209
|
+
const call = () =>
|
|
210
|
+
IncomingCall.display({
|
|
211
|
+
uuid: `call-${Date.now()}`,
|
|
212
|
+
callerName: 'Jane Smith',
|
|
213
|
+
callType: 'video',
|
|
214
|
+
backgroundColor: '#0D1B2A',
|
|
215
|
+
timeout: 15000,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return <Button title="Simulate Incoming Call" onPress={call} />;
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
See the [`example/`](example/) directory for the full working demo app.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Architecture
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
react-native-incoming-call
|
|
230
|
+
├── src/
|
|
231
|
+
│ ├── index.tsx JS/TS public API + event manager
|
|
232
|
+
│ └── IncomingCall.nitro.ts Nitro spec (props & methods)
|
|
233
|
+
├── android/
|
|
234
|
+
│ └── src/main/java/…
|
|
235
|
+
│ ├── IncomingCallModule.kt RN bridge — display/answer/reject/end
|
|
236
|
+
│ ├── IncomingCallActivity.kt Full-screen lock-screen activity
|
|
237
|
+
│ ├── IncomingCallService.kt Foreground service (phoneCall type)
|
|
238
|
+
│ ├── IncomingCall.kt HybridIncomingCall Nitro View
|
|
239
|
+
│ └── IncomingCallPackage.kt Package registration
|
|
240
|
+
└── example/ Demo app
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Call flow:**
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
JS: IncomingCall.display()
|
|
247
|
+
→ IncomingCallModule (Kotlin)
|
|
248
|
+
→ IncomingCallService (foreground, keeps alive in background/killed)
|
|
249
|
+
→ IncomingCallActivity (lock screen, wake, full-screen UI)
|
|
250
|
+
→ user taps Accept / Decline
|
|
251
|
+
→ broadcast → IncomingCallModule → JS event (onAnswer / onReject)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Requirements
|
|
257
|
+
|
|
258
|
+
| Requirement | Version |
|
|
259
|
+
|-------------|---------|
|
|
260
|
+
| React Native | 0.73+ |
|
|
261
|
+
| react-native-nitro-modules | 0.35+ |
|
|
262
|
+
| Android minSdk | 24 (Android 7.0) |
|
|
263
|
+
| compileSdk | 36 |
|
|
264
|
+
| Kotlin | 2.0+ |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|
|
271
|
+
|
|
272
|
+
Pull requests are welcome. For major changes, please open an issue first.
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
MIT © [MuhammadKaleem](https://github.com/Muhammadkaleem)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) + [Nitro Modules](https://nitro.margelo.com/)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
project(incomingcall)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set(PACKAGE_NAME incomingcall)
|
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Define C++ library and add all sources
|
|
9
|
+
add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp)
|
|
10
|
+
|
|
11
|
+
# Add Nitrogen specs :)
|
|
12
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/incomingcall+autolinking.cmake)
|
|
13
|
+
|
|
14
|
+
# Set up local includes
|
|
15
|
+
include_directories("src/main/cpp" "../cpp")
|
|
16
|
+
|
|
17
|
+
find_library(LOG_LIB log)
|
|
18
|
+
|
|
19
|
+
# Link all libraries together
|
|
20
|
+
target_link_libraries(
|
|
21
|
+
${PACKAGE_NAME}
|
|
22
|
+
${LOG_LIB}
|
|
23
|
+
android # <-- Android core
|
|
24
|
+
)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.IncomingCall = [
|
|
3
|
+
kotlinVersion: "2.0.21",
|
|
4
|
+
minSdkVersion: 24,
|
|
5
|
+
compileSdkVersion: 35,
|
|
6
|
+
targetSdkVersion: 35
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
ext.getExtOrDefault = { prop ->
|
|
10
|
+
if (rootProject.ext.has(prop)) {
|
|
11
|
+
return rootProject.ext.get(prop)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return IncomingCall[prop]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
repositories {
|
|
18
|
+
google()
|
|
19
|
+
mavenCentral()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependencies {
|
|
23
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
24
|
+
// noinspection DifferentKotlinGradleVersion
|
|
25
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def reactNativeArchitectures() {
|
|
30
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
31
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
apply plugin: "com.android.library"
|
|
35
|
+
apply plugin: "kotlin-android"
|
|
36
|
+
apply from: '../nitrogen/generated/android/incomingcall+autolinking.gradle'
|
|
37
|
+
|
|
38
|
+
apply plugin: "com.facebook.react"
|
|
39
|
+
|
|
40
|
+
android {
|
|
41
|
+
namespace "com.margelo.nitro.incomingcall"
|
|
42
|
+
|
|
43
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
44
|
+
|
|
45
|
+
defaultConfig {
|
|
46
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
47
|
+
targetSdkVersion getExtOrDefault("targetSdkVersion")
|
|
48
|
+
|
|
49
|
+
externalNativeBuild {
|
|
50
|
+
cmake {
|
|
51
|
+
cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
|
|
52
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
53
|
+
abiFilters (*reactNativeArchitectures())
|
|
54
|
+
|
|
55
|
+
buildTypes {
|
|
56
|
+
debug {
|
|
57
|
+
cppFlags "-O1 -g"
|
|
58
|
+
}
|
|
59
|
+
release {
|
|
60
|
+
cppFlags "-O2"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
externalNativeBuild {
|
|
68
|
+
cmake {
|
|
69
|
+
path "CMakeLists.txt"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
packagingOptions {
|
|
74
|
+
excludes = [
|
|
75
|
+
"META-INF",
|
|
76
|
+
"META-INF/**",
|
|
77
|
+
"**/libc++_shared.so",
|
|
78
|
+
"**/libfbjni.so",
|
|
79
|
+
"**/libjsi.so",
|
|
80
|
+
"**/libfolly_json.so",
|
|
81
|
+
"**/libfolly_runtime.so",
|
|
82
|
+
"**/libglog.so",
|
|
83
|
+
"**/libhermes.so",
|
|
84
|
+
"**/libhermes-executor-debug.so",
|
|
85
|
+
"**/libhermes_executor.so",
|
|
86
|
+
"**/libreactnative.so",
|
|
87
|
+
"**/libreactnativejni.so",
|
|
88
|
+
"**/libturbomodulejsijni.so",
|
|
89
|
+
"**/libreact_nativemodule_core.so",
|
|
90
|
+
"**/libjscexecutor.so"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
buildFeatures {
|
|
95
|
+
buildConfig true
|
|
96
|
+
prefab true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
buildTypes {
|
|
100
|
+
release {
|
|
101
|
+
minifyEnabled false
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
lint {
|
|
106
|
+
disable "GradleCompatible"
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
compileOptions {
|
|
110
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
111
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
dependencies {
|
|
116
|
+
implementation "com.facebook.react:react-android"
|
|
117
|
+
implementation project(":react-native-nitro-modules")
|
|
118
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<!-- Required permissions for incoming call functionality -->
|
|
4
|
+
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
5
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
6
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
7
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
|
|
8
|
+
<uses-permission android:name="android.permission.VIBRATE" />
|
|
9
|
+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
10
|
+
|
|
11
|
+
<application>
|
|
12
|
+
|
|
13
|
+
<!-- Full-screen incoming call activity shown on lock screen -->
|
|
14
|
+
<activity
|
|
15
|
+
android:name=".IncomingCallActivity"
|
|
16
|
+
android:exported="true"
|
|
17
|
+
android:launchMode="singleInstance"
|
|
18
|
+
android:showOnLockScreen="true"
|
|
19
|
+
android:turnScreenOn="true"
|
|
20
|
+
android:excludeFromRecents="true"
|
|
21
|
+
android:taskAffinity="com.margelo.nitro.incomingcall.incoming"
|
|
22
|
+
android:configChanges="orientation|screenSize|keyboardHidden"
|
|
23
|
+
android:theme="@style/Theme.AppCompat.NoActionBar" />
|
|
24
|
+
|
|
25
|
+
<!-- Foreground service to keep the call alive in background/killed state -->
|
|
26
|
+
<service
|
|
27
|
+
android:name=".IncomingCallService"
|
|
28
|
+
android:exported="false"
|
|
29
|
+
android:foregroundServiceType="phoneCall"
|
|
30
|
+
android:stopWithTask="false" />
|
|
31
|
+
|
|
32
|
+
</application>
|
|
33
|
+
|
|
34
|
+
</manifest>
|
|
35
|
+
|