Sinch Managed Push not working for some mobile devices (Android) - sinch

mSinchClient = Sinch.getSinchClientBuilder().context(getApplicationContext()).userId(username)
.applicationKey(APP_KEY)
.applicationSecret(APP_SECRET)
.environmentHost(ENVIRONMENT).build();
mSinchClient.setSupportCalling(true);
mSinchClient.setSupportManagedPush(true);
mSinchClient.checkManifest();
//mSinchClient.startListeningOnActiveConnection();
mSinchClient.addSinchClientListener(new MySinchClientListener());
mSinchClient.getCallClient().addCallClientListener(new SinchCallClientListener();
The code is implemented to sense incoming calls using sinch, and it works well on some mobiles. But there are also devices where the incoming call is not sensed. The GCM receiver though receives the call when the app is ON, but the incoming call method is not called.
Please suggest how to tackle this issue. My device has android 4.4.4 version. Is it version dependent?

Related

Incoming call notification - Android/iOS

I am developing a voip based phone call app specially for video conferencing type calls. Everything works via normal push notifications.
how do I show incoming call screen with sound e.g.
I am trying to implement - https://developer.android.com/guide/topics/connectivity/telecom/selfManaged
not sure if I am in the right direction.
Note: I don't want to interrupt/intercept normal phone calls.
I have managed to implement this using combination of push notification, broadcast receiver, alarm service, setting window flags on activity with "FullScreenIntent".
"OnMessageReceived" set an alarm for x seconds (500ms) with Broadcast receiver
in receiver setup MainActivity intent and set flags "NewTask" and "frombackground"
In MainActivity - override "OnNewIntent", set the window flags
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
Window.AddFlags(WindowManagerFlags.DismissKeyguard);
Window.AddFlags(WindowManagerFlags.ShowWhenLocked);
Window.AddFlags(WindowManagerFlags.TurnScreenOn);
Window.AddFlags(WindowManagerFlags.Fullscreen);
this will open the app in fullscreen and can be routed to appropriate page for custom UI

How to Detect incoming VOIP calls with Sinch provider when app is offline

I am using sinch for VOIP calls. I need to know how to detect incoming calls when my app is offline or the process is killed. It can be done through background service but cannot understand how to build such service and which method can be used.
You can check the device status whether it is active or inactive
- (void)client:(id<SINCallClientDelegate>)client didReceiveIncomingCall:(id<SINCall>)call {
if (call.details.applicationStateWhenReceived == UIApplicationStateActive) {
//perform segue
}
}
Basically when the app is offline, Sinch sends a push message that should be intercepted in GcmBroadcastReceiver and then you call GcmIntentService which initializes Sinch and connects you to the call. Of course you need to setSupportManagedPush(true) and setSupportPushNotifications(true) when initializing your SinchClient.
There's a sample project provided by Sinch to help you with all this.
Just go to Sinch website and download the ANDROID SDK 3.9.3 ZIP file. It has a samples folder that contains 5 projects.
Check the project sinch-rtc-sample-push, it has the GCM implementation along with a SinchService. You can use the same classes in your project.

Android Watch/Phone MessageApi

I am working on an app for Android Watch that requires the mobile app to be on or in background. I tried using the MessageApi in order to communicate with the app on the phone, but even if the app is not on, i get a message back like it is on.
What would you suggest to check whether the phone app is running (doesnt matter whether it is foreground/background) before i enable the activity on the Android Watch?
Thanks for the help.
If you have registered a WearableListenerService in your mobile app, that will be invoked by the framework even if your app is not running (and will be invoked if your app is running, too). If, however, you are not using that service, then to receive messages or notification on changes in the wear network in your mobile app, you would need to register one or more callback listeners for the type of messages/data that you are interested in. In that case, that means if your app is not running, you will not be getting those callbacks on your mobile app. To use this, however, be sure to manage the lifecycle of your listeners in your mobile app according to your needs. For example, one can register for such listeners in onResume() of an activity and unregister in onPause(). The consequence of that is if your activity loses focus (but still alive), that activity will not receive the callback (even though as an instance it is still running). You may want to define an Application instance for your app and use that to listen for callbacks but, again, it depends on the exact nature of your needs and app.
You can search for nodes and parse them for needed result, or to check if you have a nearBy node
private Collection<String> getNodes() {
HashSet <String>results = new HashSet<String>();
NodeApi.GetConnectedNodesResult nodes =
Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
for (Node node : nodes.getNodes()) {
results.add(node.getId());
}
return results;
}

Sinch APN shouldSendPushNotifications never called

I can´t make Apple Push Notifications work in development mode. The shouldSendPushNotifications method is never called on the source device when the target device is in background mode. I have uploaded my APN development certificate in the Sinch Dashboard and instant messaging works if both devices are in foreground mode. I have a valid device token which I´m using for my own Push Messages. Here is my code:
sinCli = Sinch.clientWithApplicationKey("XXXX", applicationSecret: "XXXX", environmentHost: "sandbox.sinch.com", userId: sinchUserId)
sinCli.delegate = self
sinCli.setSupportMessaging(true)
if let deviceToken = defaults.dataForKey(Globals.KEY_APN_DEVICE_TOKEN)
{
sinCli.setSupportPushNotifications(true)
sinCli.registerPushNotificationDeviceToken(deviceToken, type: SINPushTypeRemote, apsEnvironment: SINAPSEnvironment.Development)
sinCli.setPushNotificationDisplayName("MyApp")
}
sinCli.start()
sinCli.startListeningOnActiveConnection()
sinCli.messageClient().delegate = self
did I forget something?
I think I need to see your swift wrapper, but it almost looks like you are setting up the client for push (not managed), and then registring the token for managed push.
When using managed push (when you upload to cert to us) shouldSendPush is never called, because Sinch takes care of the pushing, you should just get a push. What you do need is to have a push delegate https://www.sinch.com/tutorials/ios-managed-push/

Why is my BLE Notification callback never called on Windows 8

I have a Bluetooth LE device with custom characteristics that send notifications to an android device just fine.
On Windows 8.1 however the notifications are not received. I can open a connection to the device using CreateFile(), enable notifications using BluetoothGattSetDEscriptorValue() and register a callback function using BluetoothGattRegisterEvent() without problems. However the used callback function is never called unless i continuously set a Characteristic value manually to keep the connection alive using something like this:
while(1){
Sleep(1000);
// Write characteristic using BLuetoothGattSetCharacteristicValue()
}
Is it supposed to work like this? How can i get the callback to be called when notifications are enabled without having to manually initiate the connection?

Resources