Data not getting saved using RMS - java-me

In my j2me app, I write data using this:
RecordStore rs = RecordStore.openRecordStore("mydb", true);
String buf = "Some text";
rs.addRecord(buf.getBytes(), 0, buf.getBytes().length);
rs.closeRecordStore();
The data stays as long as the app is running, but when I restart the app, there is no "mydb"
I tested it on emulator and device both. I know there can be some problems in emulator but it should work on the device at least.
I'm using:
Java Me SDK 3.0
CLDC 1.1
MIDP 2.0
Device: Samsung S5620
OS:Vista
Is it related to some permissions or the app should be signed before running?

Related

How to create Bluetooth L2CAP connection between two devices?

Android 10 released support for BLE CoC connection so I wanted to try this out by making two simple android 10 apps, which would connect to each other with l2Cap and exchange "Hello World".
I wrote two apps, Server app and Client app, both having all permissions they need in their manifest files, and I run that apps on two Android 10 phones, and the connection was not established.
Here is the relevant part of my server app code:
try {
mServerSocket = bluetoothAdapter.listenUsingInsecureL2capChannel();
int psm = mServerSocket.getPsm();
} catch (IOException e) {
e.printStackTrace();
}
BluetoothSocket socket = mmServerSocket.accept();
Variable int psm is the PSM value I am using in client app.
Here is the relevant part of my client app code:
for (BluetoothDevice bluetoothDevice : deviceSet) {
if (!bluetoothDevice.getName().equals(PAIRED_DEVICE_NAME)) continue;
BluetoothDevice bd = adapter.getRemoteDevice(bluetoothDevice.getAddress());
bluetoothSocket = bd.createInsecureL2capChannel(psm_value);
break;
}
bluetoothSocket.connect();
where the string PAIRED_DEVICE_NAME is name of expected device, which is successfully found because devices are Bluetooth paired.
Int psm_value is the PSM value from server app. I suspect this might be a problem because I hard-coded this value from Server every time I tried to test this (every time was different value because this value is dynamically assigned and it lasts until you close server socket).
So my question is how to get remote PSM value? And how to connect these devices, because if I am using RFCOMM connection, this code works perfectly.
With this code I am getting error in bluetoothSocket.connect() line from client app saying:
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
Thanks!

UWP Bluetooth RFComm ConnectAsync problems

I am developing an application which makes Bluetooth (RFComm, SPP) connections with a device. My Android App works like a charm but with UWP I have big problems getting the connection done using:
socket.ConnectAsync(service.ConnectionHostName, service.ConnectionServiceName);
When the device is connected everything works.
Sometimes the ConnectAsync takes a long time (1 minute) or finally it doesnt work.
It seems like when I start the App the first connection works and connects within a vew seconds but all following connections seem to be very unstable.
I tried different USB Dongles, but with same results. I am now on Win 10 Pro 64 1709.
I also tried the UWP RFComm Chat sample app. Same problems there.
Does somebody have similar problems? Any ideas?
Thanks,
Joachim
A few updates:
I testet a few other Dongles and SPP Devices. My results:
One SPP Device works, two have this problem. A not working example: BluePort XP and ASUS USB-BT400
Using Virtual COM Ports over Win32 API or .net SerialPort works on all devices!
Conclusion: Hardware works. The problem is on UWP using socket.ConnectAsync!
Is this a Win10 UWP Bug??!!
Second update:
I found out that if I use Devices from:
DeviceInformationCollection collection = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
and connect using rfcomm:
var services = await _device.GetRfcommServicesForIdAsync(RfcommServiceId.SerialPort, BluetoothCacheMode.Uncached);
var op = _socket.ConnectAsync(_service.ConnectionHostName, _service.ConnectionServiceName);
then I have this problems with connection times - manly after the first connect/disconnect phase
BUT: When I use the virtual com ports created from SPP Dongles
DeviceInformationCollection collection = await DeviceInformation.FindAllAsync("System.Devices.InterfaceClassGuid:=\"{86E0D1E0-8089-11D0-9CE4-08003E301F73}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True");
and create a SerialDevice using:
var serialDevice = await SerialDevice.FromIdAsync(info.Id);
which automatically connects the bluetooth target while this serialDevice is created, then everything works perfect.

Unable to configure Live Stream in Application Insights for ASP Core application

I have configured Application Insights in my application and I am receiving telemetry. However, when I click the Live Metrics Stream page I am getting: "Not available: your app is offline or using an older SDK".
How do I get Live Stream to appear?
It is possible to activate it in code, even though it's not yet supported officially. In Startup.cs add following code:
TelemetryConfiguration configuration = TelemetryConfiguration.Active;
configuration.InstrumentationKey = "e73ee2c9-776t-er45-4244-b2139c6dc724";
QuickPulseTelemetryProcessor processor = null;
configuration.TelemetryProcessorChainBuilder
.Use((next) =>
{
processor = new QuickPulseTelemetryProcessor(next);
return processor;
})
.Build();
var QuickPulse = new QuickPulseTelemetryModule();
QuickPulse.Initialize(configuration);
QuickPulse.RegisterTelemetryProcessor(processor);
Add Nuget packages:
Microsoft.ApplicationInsights.PerfCounterCollector
Microsoft.ApplicationInsights.DependencyCollector
Based on the following post.
Live Metrics isn't yet supported from the ASP.Net Core packages.
https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/216
though given this PR it looks like it might be close?
https://github.com/Microsoft/ApplicationInsights-aspnetcore/pull/518

Windows phone 8 app is not running on device

Is it mandatory to switch on the pc or system to run windows phone 8 application on device, if I turned off the system or shut down my pc, the Windows 8 app is not running, I have added WCF service in Windows 8 app.
Please help me!
Thanks!!
Here is my Java web serviceurl : "xxx//xxx/xxx?wsdl.
I have added service reference of that url, named ServiceReference1.
See my code below
ServiceReference1.CommonWsEndPointClient client = new ServiceReference1.CommonWsEndPointClient();
client.m98123Async();
client.m98123Completed += client_m98123Completed;
void client_m98123Completed(object sender, m98123CompletedEventArgs e)
{
}

Read something from Azure SQL in Windows Phone Background Agent

I'm writing Windows Phone 8 application and I've got problem with accessing my Azure Mobile Services database from Windows Phone 8 background agent.
I'm using that code:
public static MobileServiceClient MobileService = new MobileServiceClient("https://name.azure-mobile.net/","secret!");
...
await ScheduledAgent
.MobileService
.GetTable<Element>()
.Where(e =>
e.First == parameters[1]
&& e.Next == parameters[2]
&& e.Other == parameters[3]
&& e.Last == parameters[4])
.Take(1)
.ToListAsync());
And when I set breakpoint on line containing that code debugger stops, but after step over (F10) Visual Studio detaching debugger from Background Agent (app still working on emulator), so I can't catch an exception.
Is any possibility to access it from there?
Kind regards!

Resources