I am developing a chat app in windows phone 8.1. I am using MQTT to communicate.It works fine when my app is in foreground.But I am facing two problems.
1) I am unable to get messages from sender when network is lost and reconnected.
2)I am unable to get messages from sender when I open the app which was sent in app inactive stage.
I am using this code to communicate:
client = new MqttClient("myhostname", 1883, false);
string id = Guid.NewGuid().ToString();
client.Connect(id);
The above cases works fine in android am I doing wrong ?? Please help me to solve.
Thanks,
Srinivas
Related
I create a xamarin cross platform project for receiving information from MVC web API,
in my android emulator project work for fine for 2 days and after 2 days when in debugging process , when debugger catch
var response = await client.GetStringAsync(url);
skip from another codes without return any data and without any error,
this is my hole codes
List<CompanyName> companyNameList = new List<CompanyName>();
string url = Constants.RestUrl + "api/Companyname";
using (HttpClient client = new HttpClient())
{
try
{
var response = await client.GetStringAsync(url);
companyNameList = JsonConvert.DeserializeObject<List<CompanyName>>(response);
}
catch (Exception ex)
{
Debug.WriteLine(#"\tERROR{0}", ex.Message);
}
}
return companyNameList;
In step one: I set SSL on my domain but problem is exist
In step two : I re-install windows and visual studio 2019 it work fine for 2 days but problem rise again,
after that with this situation I export my app and install in my real phone,
it work fine, why??
app not work on emulator but work in my phone with the same network.
Did you configure your firewall. if not please follow the below procedures.
Add an inbound firewall rule allowing access to the TCP port given in the Remote URL.
Open Windows 'Start' and type WF.msc.
Click 'Inbound Rules' on the left.
Click 'New Rules' on the right.
Choose 'Port' in the new dialog, then 'Next'.
Select TCP, and enter the port from the Remote URL next to 'Specific local ports'
(45455-45500), then 'Next'.
Next, and next (you may want to disable 'Public'), give it a name like 'MyServer: web dev server access enabled'.
I am developing a project for Windows Mobile 6.5 MC75A Mobile computer. I connectd my MC75A Mobile computer to the Zebra printer(ZEBRA qln420) via Bluetooth.
I am developing application in vb.net.in my project i added PrinterCE.NetCF.dll and i copyed the same dll into windows folder in mobile device. in application print button click i given code like this:
Dim prce As PrinterCE
Try
'No License Key for evaluation
prce = New PrinterCE(PrinterCE.EXCEPTION_LEVEL.ABORT_JOB, "YOURLICENSEKEY")
prce.SelectPrinter(True)
prce.DrawText("Hello World")
prce.EndDoc()
Catch exc As PrinterCEException
prce.ShutDown()
MessageBox.Show("PrinterCE Exception", "Exception")
Finally
prce.ShutDown()
End Try
but this is not working fine ..throwing error.while clicking print button.how i can achieve this?
Did you try using the SDK from Zebra? It walks you through adding it to your project and has examples for connecting to and printing using BT.
https://www.zebra.com/us/en/products/software/barcode-printers/link-os/link-os-sdk.html
i am facing a weird problem. I am using Windows phone 8.1 silverlight and Windows universal link for toast notification. I am able to get the toast notification in Windows Phone app it is nearly same way in Windows 8.1 as mentioned in the link. But toasts are not comming in Windows 8.1 part.
Steps :-
1 -> I have enabled the Toast from Package.appxmanifest file.
2 -> Then i have added this code in App.Xaml.cs in on_launched event as mentioned
It is showing the registeration successful as mentioned in the link
private async void InitNotificationsAsync()
{
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var hub = new NotificationHub("<hub name>", "<connection string with listen access>");
var result = await hub.RegisterNativeAsync(channel.Uri);
// Displays the registration ID so you know it was successful
if (result.RegistrationId != null)
{
var dialog = new MessageDialog("Registration successful: " + result.RegistrationId);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
}
}
3 -> Now i send the notification from back end(Hub is working in case of phone mpns notification).
public static async void SendNotificationAsync()
{
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString("<connection string with full access>", "<hub name>");
var toast = #"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello from a .NET App!</text></binding></visual></toast>";
await hub.SendWindowsNativeNotificationAsync(toast);
}
Question : -
Do you guys have a clue why it is not working in Windows 8.1 or what i am missing. This is the simplest example i am going through. Any help is appreciated.
Edit :- This is something interesting.
When i tried to send the notification from azure portal. From DEBUG tab of My-NotificationHub and from here i choose WNS toast then it showing an error.
Error - The token obtained from the token provider is wrong
but when i tried to send MPNS notification then there is no error. as i already mentioned it is working for WP 8.1 silverlight MPNS toast.
What could be the cause of this error ?
Toast will not work on simulator, as stated in the MSDN documentation:
Note When testing toast notification code functionality through
Microsoft Visual Studio, you must use either the Local Machine or
Remote Machine debug setting on a Windows x86, x64, or Windows Runtime
machine. You cannot use the Visual Studio Simulator debug function
option—your code will compile and run in the Simulator, but the toast
will not appear.
Source: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868254.aspx
If I remember correctly on Windows 8 the toast notifications did not work when I was using the simulator. I had to deploy my Windows 8 application on my computer and not the simulator for me to be able to see toast notifications.
I'm using the C# Facebook SDK for Windows & Windows Phone on Windows Phone 8 and trying to use the LoginWithApp approach:
public void Authenticate()
{
SessionStorage.Remove();
var client = new FacebookSessionClient(this.appId);
client.LoginWithApp("basic_info,read_stream,read_friendlist", "custom_state_string");
}
If I use the above code, it works fine in the emulator using the Login Simulator, but on a physical device I always get the following error response:
"(No connection to facebook - #2002) Connection failed: Unable to communicate with facebook in order to get the access token"
However, this can't be a simple communication problem because if I remove the read_friendlist permission it works every time.
Can anyone explain what's going on and how to fix this, please?
read_friendlist should be read_friendlists with an S on the end.
When ever I used this below piece of code, it launches the messaging app, i don't want that. I want to send SMS within my app. How to do that. any ideas ?
Code
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "9012345566778"; // Mention here the phone number to whom the sms is to be sent
smsComposeTask.Body = "Hello! How are you"; // the string containing the sms body
smsComposeTask.Show(); // this will invoke the native sms edtior
You can't send a SMS directly from your app. Using the SmsComposeTask (and therefore displaying the message hub) is the only way.
I think KooKiz is right. windows phone is cared for its security.