@capgo/capacitor-stream-call 0.0.41 → 0.0.42
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/README.md +75 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,81 @@ npm install @capgo/capacitor-stream-call
|
|
|
15
15
|
npx cap sync
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
## Android Setup
|
|
19
|
+
|
|
20
|
+
### MainActivity.java
|
|
21
|
+
Modify your `MainActivity.java` to handle incoming calls:
|
|
22
|
+
|
|
23
|
+
```java
|
|
24
|
+
@Override
|
|
25
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
26
|
+
// Save initial intent for StreamCallPlugin (handles killed-state notification)
|
|
27
|
+
ee.forgr.capacitor.streamcall.StreamCallPlugin.saveInitialIntent(getIntent());
|
|
28
|
+
|
|
29
|
+
super.onCreate(savedInstanceState);
|
|
30
|
+
|
|
31
|
+
// Ensure the activity is visible over the lock screen when launched via full-screen intent
|
|
32
|
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O_MR1) {
|
|
33
|
+
setShowWhenLocked(true);
|
|
34
|
+
setTurnScreenOn(true);
|
|
35
|
+
} else {
|
|
36
|
+
getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
protected void onNewIntent(Intent intent) {
|
|
42
|
+
super.onNewIntent(intent);
|
|
43
|
+
setIntent(intent);
|
|
44
|
+
String action = intent.getAction();
|
|
45
|
+
if ("io.getstream.video.android.action.ACCEPT_CALL".equals(action)) {
|
|
46
|
+
android.app.KeyguardManager km = (android.app.KeyguardManager) getSystemService(KEYGUARD_SERVICE);
|
|
47
|
+
if (km != null && km.isKeyguardLocked()) {
|
|
48
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
49
|
+
km.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() {
|
|
50
|
+
@Override
|
|
51
|
+
public void onDismissSucceeded() {
|
|
52
|
+
forwardAcceptIntent(intent);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
forwardAcceptIntent(intent);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private void forwardAcceptIntent(Intent intent) {
|
|
63
|
+
ee.forgr.capacitor.streamcall.StreamCallPlugin.saveInitialIntent(intent);
|
|
64
|
+
PluginHandle pluginHandle = getBridge().getPlugin("StreamCall");
|
|
65
|
+
if (pluginHandle != null) {
|
|
66
|
+
com.getcapacitor.Plugin pluginInstance = pluginHandle.getInstance();
|
|
67
|
+
if (pluginInstance instanceof ee.forgr.capacitor.streamcall.StreamCallPlugin) {
|
|
68
|
+
((ee.forgr.capacitor.streamcall.StreamCallPlugin) pluginInstance).handleAcceptCallIntent(intent);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Application Class
|
|
75
|
+
Create or modify your Application class to pre-initialize the plugin:
|
|
76
|
+
|
|
77
|
+
```java
|
|
78
|
+
@Override
|
|
79
|
+
public void onCreate() {
|
|
80
|
+
super.onCreate();
|
|
81
|
+
|
|
82
|
+
// Initialize Firebase
|
|
83
|
+
com.google.firebase.FirebaseApp.initializeApp(this);
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
StreamCallPlugin.preLoadInit(this, this);
|
|
87
|
+
} catch (Exception e) {
|
|
88
|
+
Log.e("App", "Failed to pre-initialize StreamVideo Plugin", e);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
18
93
|
## Setting up Android StreamVideo apikey
|
|
19
94
|
1. Add your apikey to the Android project:
|
|
20
95
|
```
|
package/package.json
CHANGED