I'm trying to develop J2ME SMS applications (on Symbian, but that's not important).
I tried with the simplest app that sends a SMS when it receives one.
It is completely based on the example provided by JSR-205:
The base class is made implementing MessageListener.
Then the following methods are implemented (I left out all try/catch for simplicity).
I have two problems:
it doesn't work
I don't know how to debug it in Netbeans7.1
In particular I'm interested in an answer to the second question: how can I emulate an SMS reception in Netbeans7.1 in order to set a breakpoint in notifyIncomingMessage method?
public class Example extends MIDlet implements MessageListener {
public void startApp() {
messconn = (MessageConnection)Connector.open("sms://:6222");
messconn.setMessageListener(this);
reader = new Reader();
new Thread(reader).start();
}
public void notifyIncomingMessage(MessageConnection conn) {
conn = (MessageConnection)Connector.open("sms://+39xxxyyyyyyyy");
TextMessage msg = (TextMessage)conn.newMessage("Hello");
conn.send(msg);
}
}
class Reader implements Runnable {
public void run() {
wait();
}
}
The J2ME Wireless Toolkit 2.0 supports WMA 1.1, allowing application developers to easily emulate sending and receiving SMS and CBS messages between multiple device emulators based on MIDP 2.0.So you can use The J2ME Wireless Toolkit WMA Console.
The console emulates a simple wireless messaging device. Each console instance - you can run more than one console at a time - is identified in its title bar by a unique number, referred to as its phone number to reflect the way a real device works. The first console is assigned the number 5550000 by default. If you immediately open a second console, it is assigned the number 5550001, and so on.
To use the console, start the toolkit's Preferences application, choose the API Availability tab, and make sure that the Wireless Messaging API is checked. Now run the Utilities application and on the right side of the window press the Open Console button. (You can also get to the Preferences and Utilities applications from menu items in the KToolbar application.)
To send a message from a console, press either the Send SMS or Send CBS button. The resulting dialog has two pages, one for text messages and one for binary messages. The SMS dialog lists the numbers of all console and emulator instances (collectively referred to as clients) currently running. Select the desired clients, enter the port number to which the message is to be sent, and either type the text message or select the binary file you want to send, then press the Send button. The CBS dialog is a bit simpler since the message will be broadcast to all known clients - supply a message identifier (a number) and the text or file to send, and press the Send button.
The console's main window lists the messages it sends and receives. You can use two console instances to chat with yourself, but it's much more interesting to involve an application in the conversation, so that you can verify that the application is sending and receiving messages correctly.
EDIT1:
In netbeans you can start WMA console from Tools | Java Platform | | Tools & Extensions | Open Utilities. Note that not all SDKs support this.On the other hand Go to your J2ME platform installed directory and search for some files look like utils.exe then double click on it.
EDIT2:
If you have problem yet,you can try other platforms.I have sony ericsson sdk 2.5.0.6 and it is easily to find "utils.exe" in it's installed directory.
You can see good tutorials and notes in references.
References:
Mobile P2P messaging, Part 1
The Wireless Messaging API
The J2ME Wireless Toolkit WMA Console
tebyan.net
Related
I'm using IFTTT to send a Google Assistant message to my Windows application via Drop Box. If I say "[keyword] [message]" (for example: "Computer: Play Game of Thrones Season 2 Episode 4") IFTTT will write the text translation of [message] to a file on drop box that my application monitors and from there I can read the [message] and act on it.
What I would like to be able to do is send a reply back to the device that sent the message... For example if I tell my phone to have my computer start a movie on my computer and for whatever reason my app can't find the movie I want to be able to communicate that back to the device that originally sent the message, whether that be my cell phone or tablet or Google Home smart speaker.
I know there is probably no official way to do this but i'm looking for creative solutions (like the one I use to get the message in the first place)... anything at all that works even if it involves multiple third-party services.
There's no good way to send back an acknowledgement through the IFTTT integration. You'd need to build your own Action which would use something like push notifications to communicate between your local device and a cloud-based webhook.
I have built a bot in massively.ai and set it all up in the Microsoft Bot framework. I have submitted it for review and it has been reviewed and published.
It is working fine in Skype, but does not work on the "web chat" channel or the Telegram channel. It also doesn't work in the test area on the MS Bot landing page
You can debug locally by clicking the "configure continuous integration button" in Azure. You will get a .zip file with the source code and then you can open it in VS or your editor of choice.
But since you are using Massively.ai what you could do is use or create a Trace class and use it in the Catch section of a Try/Catch to track and store errors and then show them in the Bot Framework emulator log. That might give you more information about the problem.
catch (Exception e)
{
Trace.TraceError("Some error in class X" + e.ToString());
return null;
}
To test the same bot in the emulator, you will need to find the end point, application ID and password for the bot service. The Settings tab only provides the partial message endpoint (ending with three dots). Therefore you will need to go to the developer site, https://dev.botframework.com/. Click on the Edit link. You will find the message endpoint there. Copy the entire URL and enter it in the emulator. Also, copy and paste the application ID and password from the bot developer portal.
You will also need to download the free tool, ngrok, which creates a tunnel between the bot hosted remotely (in this case on Massively.ai) and your computer behind the firewall. Click App Settings in the emulator. Browse to the location where ngrok.exe is located. Save the setting. The utility will be launched automatically from the emulator. At this point, the emulator is ready. Click “Connect” or the refresh icon. When you type something in the input box, You will see a response:
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;
}
I'm using the code from this article, with phonegap app.
http://blogs.msdn.com/b/glengordon/archive/2011/12/02/phonegap-on-wp7-tip-3-sending-sms-and-intro-to-plugins.aspx
The plugin works all fine, but when the SMS is sent, I want to return to my app automatically. Is this possible? If its possible to send an SMS without go to the default integrated sender, it could be even better.
I'm a newbie to C# and windows phone apps - please help me ;)
there is no way to avoid the integrated SMS sender due to security reasons. User will return to your app after hitting the Back button on the SMS conversation page (that is esured automatically because of the stack-controlled nature of paging in WP7, but will not return after hitting the home button (again, this behavior cannot be prevented in any way) and your app will be suspended (possible to return to it by holding the back button and choosing it).
I'm testing out Windows Phone 7.5 push notifications. I have got the 3 different push types working fine (Toast, Tile and Raw) and am able to send messages from unit tests and a web application without any problems and receive them in my WP application. I want the ability to add extra properties to the push notification and the Raw push type does this perfectly for me and I can add custom key/value pairs or anything else to the push message and extract it on the phone app. I have just found out however that it only works if the application is running and my unit tests fail (suppressed notification status is received in unit test) when the phone application is not running (checked documentation which confirms this too). Is there anyway to add extra properties (key/values) to toast or tile messages or some way I can use raw in another way ? Toast notifications seem limited to a title property and an actual message property but I need to add additional data.
Just wondering if anyone had any suggestions / workarounds ?
The general practice I use is to initially send a raw notification to the device with phone-usable data embedded in the message. If my application is currently running then I can process the contents of the raw message and immediately make use of it on the phone. However if the application is not currently running on the phone you will receive notification from the push servers that the message could not be delievered. If I receive this response I send out a Toast / Tile notification.
With Toast notifications the only parametrisation you have access to is the URI that will launch the application. This is specified with the wp:param node of the message. Eg.
<wp:Notification xmlns:wp="WPNotification">
<wp:Toast>
<wp:Text1>Toast Title</wp:Text1>
<wp:Text2>Toast sub title</wp:Text2>
<wp:Param>/MainPage.xaml?LaunchedFrom=A%20Toast%20Notification</wp:Param>
</wp:Toast>
</wp:Notification>
If the user taps on this toast notification your application will launch and navigate to MainPage.xaml. You can access the querystring passed in via the NavigationContext.QueryString.
Note: The wp:Param node can only be sent to Mango (and up) devices. Additionally the entire contents must be less than 256 characters or you'll receive a PushErrorTypeMessageBadContent error. (Thanks to Ritch Melton for pointing this out). More info available from the Sending Push Notifications for Windows Phone page on MSDN.
As you've discovered, the Microsoft Push Notification Service is very strict in what types of messages you can send and receive. The intent of these push notifications is to provide simple push updates and not large amounts of data. The flexible Raw type seems like it would fit the bill until you discover that:
You can use a raw notification to send information to your application. If your application is not currently running, the raw notification is discarded on the Microsoft Push Notification Service and is not delivered to the device.
However, if you send a toast notification to your application, when the user clicks on the toast the application is started. When your application starts, you should check a service and retrieve the data you are trying to send from a web-service or other remote mechanism.