Hi,
How can thread in android applcaiiton make sure that there is receiver registred for receiving broadcast?
Application starts two threads (one back-end thread which check contacts book for contact deletion and other GUI thread which shows contact list on screen).
Backend thread is sending a broadcast but since GUI thread and backend thread starts in parallel so some times broadcast is sent even before GUI thread registers for receiving broadcast.
Code:
app.sendBroadcast(new Intent(
SipManager.ACTION_CONTACT_DELETE_RECEIVED));
[CODE]
Related
I'm working on a location based app that would request the phone to send its GPS location. My question is, what are the available methods for requesting the location from the device? My first choice was HTTPD but the device IP is unreachable from the world (sprint). My second choice is SMS and have the phone intercept the messages. If it sees a location request SMS then it would respond to a web service with its current location.
Is this a reliable method?
chris
Looks like MS My Phone uses SMS to request phone data... interesting.
Location request:
SkY!AVEjDy2DGyMCE6RO0qhs56aR1/zf42OXBlbdErz6sVTLW6iHFk+wQUhRX6aSEDkI0w==
Ring request:
SkY!AZbZmdMB6eVOig9Y5Ol6QtCQZAVU8XFZLi19k95Cqzn14CZ+qKuUi+2ha3VFqbRdXA==
Lock request: pin 1234, text Chris
SkY!AYDmzGeCMrT8NeDWmn5QaK96Jvsv0mQZIqEgwzvwE35ZCuBZea4M349kMwBkjVV63Y0ROvV+okapsl7UnzqcJBU=
You would think that MS would filter these texts out of the sync process...
The Ring request worked and GPS location failed (btw, the GpsSample from the SDK does not work either). So no MS I don't want to pay 4.99$ for your non-working premium services.
Sky Command Received | Command Locate (ID 2) | Request Id 22815
Sky Command Received | Command Ring (ID 1) | Request Id 22816
I wish the app was .NET like bing so I can reflect on it.
\Application Data\Microsoft\My Phone\Config.dat contains some service end point info. I would like to get the WSDL of those.
I'm curious about HKLM\init\Myphone\OEMOverride = 1.
This is great MS, due to your SMS interceptor I can't send myself any SMSs that start with 'SkY!'.
I tried resending the above SkY requests to my phone. The only thing that happened was the phone backlight came on (the SMS was not visible) and \Application Data\Microsoft\My Phone\MyPhoneLog.txt got an entry appended but the request was not valid. keep in mind that I had to uninstall the MyPhone app and use the MyPhone web site to send out those SMSs so that they would not get intercepted by MyPhoneService.dll.
I stopped the SBB0: service but the SMS still got intercepted. I didn't stop the Notification though: NamedEvents\MyPhoneRuntimeStartRuntime (if that's the right notification).
I guess the next step would be to write a .NET SMS interceptor to see if it will intercept the SMSs or not.
it looks like the interception is done using MAPI Rules which I assume is processed before MessageInterceptor and it looks like the SMS cannot be replayed...
List of commands:HKEY_LOCAL_MACHINE\Software\Microsoft\My Phone\SkyServices\SkyCommands
SMS2PC API
Introduction
It is with great pleasure that today I am releasing the first public beta of SMS2PC API which is designed to allow developers and hackers to quickly and easily send and receive messages via an Android (and soon to be BlackBerry and WinPhone) device as well as loading contact information and address credentials.
The API is designed in an async like manner allowing you to create a request, forget about it and then easily handle any return to the original request while not having to worry about threads, connections and protocol management. As an example, you can send a message with only a few lines of code and then handle delivery notifications and send notifications when they occur by providing a callback that is fired when a the message's status has changed.
You are free to use the API as you wish. You will be able to do things like send messages from a server to notify of events on the server, you could make an application than can receive commands such as ‘shutdown_pc’ via SMS and then shut down the current PC, run in on embedded systems, create alarm system that notify via SMS of intruder etc!
Features
Current
Send message
Handle Delivery Notifications
Handle Send Notifications
Load Contact Details
Receive incoming message from device.
Loading message list for a contact
Upcoming
MMS Support
Inbox Support
Load advanced contact details
Example of Handling Incoming Messages
As an example to highlight how simple it is to receive new messages when the arrive on device the actual code used is provided below.
Code:
class MyHandler implements IMessageReceiveHandler
{
@Override
public void messageReceived(Message message)
{
System.out.println("New message received: " + message.getBody());
}
}
// Create instance of your handler and provide it to the API
MyHandler myMessageHandler = new MyHandler();
sms2pc.setMessageReceiveHandler(myMessageHandler);
Requirements
Current the API is Java based (requiring JRE). We have nearly finished the C# version and the mobile apps for BlackBerry and WinPhone will be available shortly.
Terms of Use
Please be aware that although you are totally free to use the API in any software as you choose (commerial or personal) , the Android/BlackBerry & WinPhone app is currently paid for at around £1.99. Also, if you use SMS2PC API in your software you must provide a mention of this fact in your about/info dialog or help if console application. This may be updated in the future although the price will never increase. If you are an XDA user you can download SMS2PC API for free for Android but must not re-distribute the apk.
Conclusion
Thank you for reading. If you have any questions feel free to email me at [email protected] or PM me.
Can't wait until the c# version is done ^_^
Any chance you plan on fixing the desktop app to work with Lion or Mountain Lion?
It's only $3, but you've got it (literally tried to refund moments later and couldn't), and the app flat out does not work on Mac OSX.
Great work, can you show an example on how to send sms?
I am a complete newbie in Android.
I am developing an application that sends over a webservice information about the last dialed number, call status, and duration of the call.
The application works perfectly fine, but when the device closes the application the android service does restart but the activity does not.
The way I am sure about that is that I have Toasts when the service is started: "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" tell me that the service has been created and started.
And when the information is sent to the webservice I have toasts saying: "Enviando información..." and "Información enviada."
But when the application is closed (via the android task manager that automatically closes apps) the messages from the service "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" do appear, but the toasts from the information sent part do not.
I hope someone can help me and tell what am I doing wrong?
Really really thanks a lot!
I can not add code to the post, so I am adding the project hoping someone can help me
CLOSED
Human stupidity has no limits.
My actions where not in the service
Hello XDA,
Well I am just a Beginner in android development, basically I am a student and a task is given to me to make an simple application don't need to have great UI etc, but it should perform functionality as directed below or give and explain your reason weather it could be implemented or not.
Well i think it could be implemented but i need guidance about how to do that,
1) Built an app which can triggered by text message (could be any type of)
2) application need to have some code for gps which can be triggered by sending a simple message from my other android phone(how and on which activity)
3) than that phone have to return its location by sending coordinate or map link with its location to me (Email or just a simple text message or other messaging services like whatsapp viber etc)
4) that message should not be received by any other messaging app (how can i Limitize the broadcast receiver etc)
5) if GPS is off text message should turn it on first
This set of Apps will allow you to receive notifications on your secondary devices such as:
- The tablet you use away from the phone.
- The small mobile that you use for sports and leave your house phablet in safekeeping.
- Your SmartWatch with Android - You can use bluetooth
Now you can receive notifications, sms and calls
Installation
Once installed and configured M2D Notifications Sender on your main phone (which usually use), this forward notifications to your (max 3) secondary devices so you can read them while away from your main phone (if they have internet access) and in many cases will leave you answer them.
On your tablet, or mobile accessory or even watch android, you must install M2D App Notifications Receiver and once configured, you can receive and reply notifications.
Configuration
*** Now you can use Bluetooth as well
For devices can look them eatch others, you need to enter in the App M2D Sender the Receivers codes. This code is shown on the display settings of the M2D Receiver App once it is installed on your secondary device.
In the Receiver M2D App you must enter the IMEI of the main device. This imei is shown on screen settings of the M2D Sender App once installed in your primary device.
There are other security parameters to avoid that anyone can send messages to your device.
On the M2D Sender App you must enter your own key and in the M2D Receiver App the same key that must match since otherwise the messages will be discarded. This key allows the Sender to send messages and that the Receiver will accept. By default Apps already have this code included, but you better change them.
On the M2D Receiver App you must enter your own key and in the M2D Sender App the same key that must match since otherwise the messages will be discarded. This key allows the Sender to send messages and that the Receiver will accept. By default Apps already have this code included, but you better change them.
Additionally, messages are encrypted so that only the recipient can read them. For this an encryption key is used in the settings. By default Apps already have this codebook including, but you better change them.
Replying
In addition to receiving notifications, in many cases, action buttons will appear with different options, including reply ones.
You can reply with predefined options and also with the keyboard as usual.
Every time you send an action, we will receive a message with the status of such action, for example if the message was sent or not.
To avoid synchronization issues notifications viewed on the main device are not automatically removed and vice versa.
Sending whatsapp
The M2D Receiver App has a button that can send messages to contacts we have previously received whatsapp messages. This depends on if there are unread messages in whatapp when a new notification arrives, but the app will always be learning and allows you to write to more contacts.
How does it work
- Notifications are encrypted and send with the key configured on the server Apps.
- The server checks the sender and receiver data to see if they are registered and if so sends the message to Google using GCM (What's this?)
- When the Receiver has internet, Google shall forward the notification to Receiver
- The receiver decrypts the message and checks that the keys to Sender and Receiver match
- The receiver displays a notification to the user
In the case of the answers is similar, but completely upside down.
Privacy
The server never stores the message that it receives, it only makes like a proxy for shipment and is very light.
Further messages are encrypted with the encryption key (change those default)
Apps
M2D Sender: https://play.google.com/store/apps/details?id=com.pacosal.m2d.notifications
M2D Receiver: https://play.google.com/store/apps/details?id=com.pacosal.m2d.receiver
M2D Bluetooth Manager https://play.google.com/store/apps/details?id=com.pacosal.m2d.manager
Enjoy!
Original thread here http://forum.xda-developers.com/android/apps-games/app-m2d-notifications-sender-receiver-t2986778
GREAT app. M2D user here. Thanks.
Hello, there. I'm trying to setup M2D on a Amazfit Pace (Android 5.1, MIPS processor). The Receiver app installs, but FC when I try to open it. I didn't find anything about Amazfit on this thread, so it's a known bug? Maybe this can be fixed in the future? I think M2D would be very useful for Pace owners, so the watch can receive notifications on WiFi as well. Thank you!
Do you know what error is giving you? Could you see the logcat?
Logcat from my Amazfit stratos
03-23 21:33:43.975 2234-2234/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pacosal.m2d.manager, PID: 2234
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pacosal.m2d.manager/com.pacosal.m2d.manager.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:332)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3409)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3724)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:400)
at android.app.Activity.setContentView(Activity.java:2145)
at com.pacosal.m2d.manager.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)*
at android.app.ActivityThread.access$800(ActivityThread.java:151)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)*
at android.os.Handler.dispatchMessage(Handler.java:102)*
at android.os.Looper.loop(Looper.java:135)*
at android.app.ActivityThread.main(ActivityThread.java:5254)*
at java.lang.reflect.Method.invoke(Native Method)*
at java.lang.reflect.Method.invoke(Method.java:372)*
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)*
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)*
03-23 21:33:43.984 432-566/? W/ActivityManager: Force finishing activity 1 com.pacosal.m2d.manager/.MainActivity
03-23 21:33:44.007 432-679/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected]
03-23 21:33:44.536 432-453/? W/ActivityManager: Activity pause timeout for ActivityRecord{3f71c65e u0 com.pacosal.m2d.manager/.MainActivity t422 f}
Thanks, difficult to fix that without the watch. Possibly there will be more errors than that one.
Regards