public override void OnReceive(Context context, Intent intent) { // Do stuff here var service = Mvx.Resolve<ISignatureService>() as DroidSignatureService; if (service != null) { var fileStore = intent.GetStringExtra("fileStore"); var pointsString = intent.GetStringArrayExtra("points"); if (string.IsNullOrWhiteSpace(fileStore) || pointsString.Length == 0) { service.Cancel(); } else { var points = pointsString.Select(i => DrawPoint.Parse(i)); service.Complete(new SignatureResult( false, () => new FileStream(fileStore, FileMode.Open, FileAccess.Read, FileShare.Read), points )); } } Android.App.Application.Context.UnregisterReceiver(this); }
/** * The {@link BillingReceiver} sends messages to this service using intents. * Each intent has an action and some extra arguments specific to that action. * @param intent the intent containing one of the supported actions * @param startId an identifier for the invocation instance of this service */ public void handleCommand(Intent intent, int startId) { string action = intent.Action; if (Consts.DEBUG) Log.Info(TAG, "handleCommand() action: " + action); if (Consts.ACTION_CONFIRM_NOTIFICATION.Equals(action)) { string[] notifyIds = intent.GetStringArrayExtra(Consts.NOTIFICATION_ID); Execute(new ConfirmNotifications(startId, notifyIds)); } else if (Consts.ACTION_GET_PURCHASE_INFORMATION.Equals(action)) { string notifyId = intent.GetStringExtra(Consts.NOTIFICATION_ID); Execute(new GetPurchaseInformation(startId, new string[] { notifyId })); } else if (Consts.ACTION_PURCHASE_STATE_CHANGED.Equals(action)) { string signedData = intent.GetStringExtra(Consts.INAPP_SIGNED_DATA); string signature = intent.GetStringExtra(Consts.INAPP_SIGNATURE); purchaseStateChanged(startId, signedData, signature); } else if (Consts.ACTION_RESPONSE_CODE.Equals(action)) { long requestId = intent.GetLongExtra(Consts.INAPP_REQUEST_ID, -1); int responseCodeIndex = intent.GetIntExtra(Consts.INAPP_RESPONSE_CODE, (int)Consts.ResponseCode.RESULT_ERROR); Consts.ResponseCode responseCode = (Consts.ResponseCode)responseCodeIndex; checkResponseCode(requestId, responseCode); } }
private void getPurchaseInformation(Intent intent, int startId) { string packageName = PackageName; long nonce = intent.GetLongExtra(EXTRA_NONCE, 0); string[] notifyIds = intent.GetStringArrayExtra(EXTRA_NOTIFY_IDS); GetPurchaseInformation request = new GetPurchaseInformation(packageName, startId, notifyIds); request.setNonce(nonce); runRequestOrQueue(request); }
public void confirmNotifications(Intent intent, int startId) { string packageName = intent.Package; string[] notifyIds = intent.GetStringArrayExtra(EXTRA_NOTIFY_IDS); ConfirmNotifications request = new ConfirmNotifications(packageName, startId, notifyIds); runRequestOrQueue(request); }
protected override void OnActivityResult (int requestCode, Result resultCode, Intent data) { base.OnActivityResult (requestCode, resultCode, data); Console.WriteLine (requestCode); if (resultCode == Result.Ok && requestCode == REQUEST_SENDBIRD_MESSAGING_CHANNEL_LIST_ACTIVITY && data != null) { JoinMessaging (data.GetStringExtra ("channelUrl")); } if (resultCode == Result.Ok && requestCode == REQUEST_SENDBIRD_MEMBER_LIST_ACTIVITY && data != null) { StartMessaging (data.GetStringArrayExtra ("userIds")); } if (resultCode == Result.Ok && requestCode == REQUEST_SENDBIRD_CHAT_ACTIVITY && data != null) { StartMessaging (data.GetStringArrayExtra ("userIds")); } if (resultCode == Result.Ok && requestCode == REQUEST_SENDBIRD_CHANNEL_LIST_ACTIVITY && data != null) { StartChat (data.GetStringExtra ("channelUrl")); } }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); if (resultCode != Result.Ok) return; if (requestCode == REQUEST_FILECHOOSER) { HandleShareFile(data.Data); } else if (requestCode == REQUEST_CONTACTCHOOSER) { var contactIds = data.GetStringArrayExtra(ContactListActivity.IE_RESULT_SELECTED_CONTACT_IDS); HandleShareContacts(contactIds); } }