I have found the way to send SMS using the Android.Telephony.Gsm.SmsManager class but for the life of me I can't find how to initiate a call. Is it only possible through an intent?
You can initiate a call only in 2 ways, using Intent.ActionDial or Intent.ActionCall.
Why the way with Intent is bad ?
var callIntent = new Intent(Intent.ActionCall);
callIntent.SetData(Android.Net.Uri.Parse("tel:+56889554540154"));
StartActivity(callIntent);
Related
I am using the latest notification framework UNUserNotificationCenter for scheduling local notifications.
I am sharing some code snippets where I refer to trigger/access trigger.
Do not read this sequentially. It is just code snippets where I read or modift trigger
var trigger = UNCalendarNotificationTrigger.CreateTrigger(notification.ScheduledTime.DateTimeToNSDateComponents(), false);
trigger.DateComponents.Hour = trigger.DateComponents.Hour + 7;
var trigger = (UNCalendarNotificationTrigger)(notification.Trigger);
This works without any compilation error and the notification also worked. We have this code in the app store from past few months. Off late we are seeing a crash with the below message . I haven't referenced UNNotificationTrigger in my code. BTW this is xamarin IOS app.
System.MemberAccessException: Cannot create an instance of UserNotifications.UNNotificationTrigger because it is an abstract class
This is a problem in Xamarin.iOS that we are looking to fix.
What is going on is that the trigger vanishes or gets collected at some point, and it is later resurfaced, and the resurfacing does not know about the actual hidden concrete implementation for this, so you get the above message.
The best workaround for now is to keep a pointer to the trigger alive in managed code, thus ensuring that the resurfacing is never triggered.
We are tracking this here:
https://github.com/xamarin/xamarin-macios/issues/3935#issuecomment-381200652
I'm trying to send packets over CoAP between two TI 2650 sensortags. I used the logic from the "er-rest-example" provided by contiki 3.0, that is:
coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0);
coap_set_header_uri_path(request, url);
coap_set_payload(request, (uint8_t*)msg, sizeof(msg) - 1);
COAP_BLOCKING_REQUEST(&server_ip, REMOTE_PORT, request, client_chunk_handler);
When I started the program, it works as expected until the first time COAP_BLOCKING_REQUEST is called, at which point the program seems to freeze (doesn't react to button presses anymore).
So I assume COAP_BLOCKING_REQUEST blocks until it receives a response, which is not suitable for my project. Can anyone confirm that?
UPDATE:
Going forward from that assumption, my question now is, what steps to I have to take to send out a packet?
Do I use the coap_send_message function from er-coap.c or the coap_send_transaction function from er-coap-transaction.c?
I want to figure out what functions I have to call in which order to configure the packet correctly and then send it out with the correct function (which I guess would be one of the above).
Maybe there is some documentation out there that I haven't found yet and someone could point me to it?
Cheers
I am a long time Redemption coder, with several apps using Redemption on the background thread (but not using RDOFolderSynchronizer up to now).
I have a new rSession object created on the backgroundworker thread, to which I pass the MAPI Object.
RedemptionCode rCodeBW = new RedemptionCode();
rCodeBW.InitialiseRedemption(Globals.MapiObject, true);
On the background thread I am trying to use the RDOFolderSynchronizer but when I run it, I get an error when I try to retrieve the syncitems. The error is:
IMAPIFolder.OpenProperty(PR_CONTENTS_SYNCHRONIZER) returned MAPI_E_INTERFACE_NOT_SUPPORTED
Synchronization is only supported for the Exchange folders in the online mode.
If I run the same code in the main thread it works fine, so I 'think' the 'online mode' issue is not the direct reason it is failing.
The code I am using is:
var MAPI_NO_CACHE = 0x200;
var MAPI_BEST_ACCESS = 0x10;
RDOFolder2 rFolder2 = rSession.GetFolderFromID(entryID, storeID, MAPI_NO_CACHE ^ MAPI_BEST_ACCESS) as RDOFolder2;
RDOFolderSynchronizer synchronizer = rFolder2.ExchangeSynchronizer;
RDOSyncMessagesCollection syncItems = synchronizer.SyncItems(Globals.UserSettings.LastSyncDataEmailInbox);
Any suggestions gratefully received.
Yes, that interface has to be used on the same thread where the parent MAPI session (IMAPISession) is created. It is an ICS API limitation in Extended MAPI.
Before iOS 10 we can use [[self.call callState] isEqualToString:#"CTCallStateIncoming"] to detect incoming calls. In IOS10 callState deprecated and Replaced by CallKit/CXCall.h properties. But there is no such status like "Incoming" in CallKit, they came up with "outgoing", "onHold", "hasConnected", "hasEnded" statuses. I need Incoming or analog. Any workarounds so far? Thank you for any suggestions.
You should be able to use CallKit's CXCallObserver and CXCall APIs and use the following condition to detect when a given CXCall is incoming (!isOutgoing), has not yet been answered (!hasConnected), and has not ended (!hasEnded):
!cxCall.isOutgoing && !cxCall.hasConnected && !cxCall.hasEnded
My first question is how do I get the didAcceptConnectionWithInputStream:outputStream: callback in NSNetServiceDelegate to get called?
Follow up question: can I still establish a connection between a client and server, although I never get a callback saying that a connection was accepted (via didAcceptConnectionWithInputStream:outputStream:)?
I understand that calling publishWithOptions, while passing in the NSNetServiceListenForConnections option is supposed to result in the NetServiceDelegate callback (didAcceptConnectionWithInputStream:outputStream:) to be called. However, that callback is not getting called.
Here are the steps I am taking, to publish:
Create NSNetService with
self.netService = [[NSNetService alloc] initWithDomain:#""
type:_serviceType
name:(_name == nil) ? #"" : _name
port:0];
Schedule service in current runloop, in default mode
Set the delegate to my Server wrapper object
call publishWithOptions:NSNetServiceListenForConnections
Here are the steps I take, to browse services:
Create an NSNetServiceBrowser, and set its delegate to my client wrapper object
Call searchForServicesOfType for the same service type and domain as NSNetService
List services in a UITableView for the UI, to allow a user to select a service
When a user selects a service, set the service's delegate to my client object, and call getInputStream:outputSteam: on the service
After getInputStream:outputSteam: returns success, I would expect didAcceptConnectionWithInputStream:outputStream: to get called. However this does not occur.
Thanks for your help!
The problem is that didAcceptConnectionWithInputStream:outputStream: must be called from the side accepting the connection.
Once the service is available, you call get the streams
[service getInputStream:&istream outputStream:&ostream]
Once this happens on the side receiving the request the delegate method
- (void)netService:(NSNetService *)sender didAcceptConnectionWithInputStream:(NSInputStream *)inputStream outputStream:(NSOutputStream *)outputStream
will be called
In my experience, it is not the act of calling getInputStream:outputStream: on the client that causes didAcceptConnectionWithInputStream:outputStream: to be called on the server.
On the client, after calling getInputStream:outputStream:, your client then needs to call [inputStream open] and [outputStream open] before the didAcceptConnectionWithInputStream:outputStream: will be called.
It's all a part of lazy initialization.
Calling getInputStream:outputStream: will give you back two perfectly good NSStreams ready to use. So, say, you want to write some data? First, open the write stream...
BAM! netService:didAcceptConnectionWithInputStream:outputStream: is called.