Other push notifications?

rfresh

Well-Known Member
Licensed User
Longtime User
What might some of the other push notifications be available for me to 'wake up' my app? I'm using SMS now to send in a wakeup msg and using the _MessageRecieved() to intercept it, etc.

I was wondering if we have any other kinds of incoming notifications that I could use to 'wakeup' my app if SMS wasn't an option for my user?

Thanks...
 

rfresh

Well-Known Member
Licensed User
Longtime User
I've been reading about Googles C2DM or AC2DM push service. As I understand it, it's primary purpose is to allow you, the developer, to send a push notification to all the phones running your app.

My question is: Can a push message be sent to only one phone? My requirement is for the user of my app to send a wake up cmd to only their phone. I'm not clear if this can be done using C2DM?

Reference links --

Here:
Simple Google Android C2DM Tutorial (Push Notifications for Android) | Rain Blog

Here:
Android Push Notification SDK Integration - Pushwoosh ! | pushwoosh
 
Upvote 0

grant1842

Active Member
Licensed User
Longtime User
Just to be clear you want the user of your app to send a push notification from the user of your app(Your app is on the users phone) to the same phone the app is on .
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
No...the push msg would come from another device or from my website. An example would be for a lost phone. My app, upon receiving the msg, would play the ring tone.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I was also wondering if I could use an RSS feed as a kind of notification to a B4A app (without needing to poll a server)? I don't like to use the word 'push' because, generally, pushing has come to mean pushing to multiple devices and my requirement is to push to only one device.

I envision the RSS Usage (if this is possible): user logs into my website, clicks on a link that sends an RSS feed to his tablet. My B4A app picks up this feed? This would require an RSS-aware B4A app and I don't know if we have such a thing?

I've spent most of the day looking at Push Notification services such as C2DM from Google (including Erel's B4A tutorial) and a couple of 3rd party services providing that kind of capability. They are generally designed for developer use, not end users. They all have some complexity to them, requiring the user (my customer) to register their device with Google and/or one of the 3rd party service providers. I don't want to have to put that requirement on my customers.

Polling is pretty straight forward, doesn't involve the customer but of course, it drains the battery faster and how often it checks becomes a compromise between battery life and convenience. Polling is the worst solution because of this.

I'm trying to find a push notification solution, such as SMS that will work for Tablets which don't have SMS capability and a solution that is transparent to end users.

My use of this would be for a user losing their phone. They could then go to my website, login and send a cmd to play a ring tone so they can find their misplaced phone. I have this already working using SMS but I'm looking for a solution for Tablets.

Thus, I'm asking if using an RSS feed into a B4A app would work as sort of a push notification service? I realized RSS was not designed for this purpose but it's an XML formatted file and can easily contain any 'command' string.

Thanks for your thoughts...
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Push

Hello,

I'm experimenting with a continuous TCP connection (long polling). It of course needs a server that keeps these connections open.

I have the impression this is not a battery drain for my phone: if I disable the automatic Google updates (C2DM) and enable this system my battery seems to last longer (most probably because there is not as much data transfer through my own channel)
 
Last edited:
Upvote 0

netchicken

Active Member
Licensed User
Longtime User
How about instead of a push service a form of Dead mans switch. Something that has to be done on your phone that shows you are the legit user or else it polls the server for the warning message.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
How about instead of a push service a form of Dead mans switch. Something that has to be done on your phone that shows you are the legit user or else it polls the server for the warning message.

I would like a solution that is transparent to the user. But you're talking about something like them having to enter in a code to verify they are the owner of the device. This is a kind of 'find my phone' type of app, so those kind of apps generally just get installed and sit in the background waiting for the phone to get lost.

I just don't know if putting up a daily kind of 'is this your phone' question and waiting for the correct response would work well or be a thorn in the users side.

But I like the way you think outside of the box!
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Hello,

I'm experimenting with a continuous TCP connection (long polling). It of course needs a server that keeps these connections open.

I have the impression this is not a battery drain for my phone: if I disable the automatic Google updates (C2DM) and enable this system my battery seems to last longer (most probably because there is not as much data transfer through my own channel)

I saw this post regarding the use of TCP:

How to Implement Push Notifications for Android

He talks about this topic in detail, mentions 3 TCP methods others are using and then provides a combined 'best of breed' complete example of a working TCP solution.

It looked somewhat complex to me and I wasn't sure it could be implemented in B4A. Maybe you could tell how easy it would be to port over to our development environment? I might give it another look.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Yes I did Erel, thank you. But from what I've read about using C2DM I don't think it will meet my needs for the following reasons:

1. C2DM appears to be for developers to use to send out msgs to their app on all devices that have their app installed. My requirement is to send a msg to only one device, not multiple devices.

2. My other requirement is that my users would be the ones sending the msg to their own phone because my app is modeled along the lines of a 'Find My Phone' type of app. So I would not be the one to send out any msgs to their phones, they would.

3. Google registration when the app installs. I don't want my users to have to do anything extra when they install my app. This is overhead an average user just won't be interested in doing.

If I am wrong with any of the above points, please clarify for me. Right now I'm researching using continious TCP/IP or UDP as a kind of push notification service.

SMS has the right structure for a zero battery drain notification solution but it won't work on tablets which is one of my target platforms.

Implementing a continuous TCP/IP solution is more complex and has more over head than a UDP solution but, as you may recall Erel, I'm not an advanced B4A developer like many of you are, so I'm not sure I can even use TCP/IP or UDP in my app at this point.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I think for my requirements, the use of a SocketServer in my app may be the solution.

I'm reading Erel's Networking Tutorial I saw this statement:

"The device will use a ServerSocket to listen to incoming connections."

I think this is exactly what a tablet device needs to respond to an incoming msg without having to use polling. Anyway, I will explore this topic and see if that is my solution.

Thanks Erel...

Update: UDP support is now in the Network Lib and I think UDP is what I need to implement. I will work on writing a demo UDP app to receive a msg from my website written in PHP.
 
Last edited:
Upvote 0

netchicken

Active Member
Licensed User
Longtime User
I haven't tried it but I gather that you can run an app based on the content of an SMS received. If so then when you lose your phone you use any other phone to send an SMS with a password as content, this activates your phones security program.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I haven't tried it but I gather that you can run an app based on the content of an SMS received. If so then when you lose your phone you use any other phone to send an SMS with a password as content, this activates your phones security program.

Hmmm...do you know what the "security program" is? Is this within the OS itself or is this something you write yourself?

Thanks...
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Yes I did Erel, thank you. But from what I've read about using C2DM I don't think it will meet my needs for the following reasons:

1. C2DM appears to be for developers to use to send out msgs to their app on all devices that have their app installed. My requirement is to send a msg to only one device, not multiple devices.
You can send a message to a single device, a group of devices, or all devices using C2DM.

2. My other requirement is that my users would be the ones sending the msg to their own phone because my app is modeled along the lines of a 'Find My Phone' type of app. So I would not be the one to send out any msgs to their phones, they would.
In this case your users will need to send a message to your server, which will then relay the message using C2DM.

3. Google registration when the app installs. I don't want my users to have to do anything extra when they install my app. This is overhead an average user just won't be interested in doing.
Almost all users of Android phones already have google accounts. They do not need to register for anything else.


I'm reading Erel's Networking Tutorial I saw this statement:

"The device will use a ServerSocket to listen to incoming connections."

I think this is exactly what a tablet device needs to respond to an incoming msg without having to use polling. Anyway, I will explore this topic and see if that is my solution.
Remember, in this case your device will have to accept incoming connections. If you remember your FTP issues (that you had to use Passive mode), you should remember that you may have issues in receiving incoming connections behind a NAT router. Make sure you know your network infrastructure before going down this route.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
@thedesolatesoul

Hmmm...thanks for the help. With FTP.Passive added, I was able to get the FTP to work very well on my Droid2 and Droid3 with Verizon and send files back and forth reliably to my Linux server.

I'm thinking I could use a UDP to 'ping' a tablet with a cmd to play a ring tone.

I looked at Erel's UDP example in the Network Lib and thought I could create a demo app and install it on my Droid2 and then install the same app on my Droid3 and then send a msg from one to the other. But it doesn't seem to work. I never see the incoming msgbox pop up.

I'm attaching my udp_demo.zip file. I'm thinking it should work but maybe there is a hole in my thinking.
 

Attachments

  • udp_demo.zip
    7.2 KB · Views: 203
Upvote 0

netchicken

Active Member
Licensed User
Longtime User
You write it :)
Whatever you want your phone to do, It would be neat to respond with eh GPS location of the phone, but that means you have to convince the thief to turn the GPS on without becoming suspicious. "Congratulations! You have won a years supply of beer from Your phone provider, just run this program to claim your prize".
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
And I have that part already written. So all I need to do is see if my thought of using the UDP protocol will work as a low level push notification service.

If so, then that would work on all devices (meaning cell phones and wifi tablets) and would be a great 'push' notification service with almost no increase in battery drain to monitor a port for incoming messages.
 
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I'm trying to run the sample C2DM device app.

I installed the PushExample app and entered in my device name and pressed Register but nothing happened. No toast msg popped up.

I filled in the Package name that I registered with Google and SenderId as my gmail email address.

I ran the following from my windows command line but it didn't send a msg on my device, I assume because of the above problem of not getting registered?

B4X:
C:\0C2DM\Desktop>b4a_c2dm.bat send droid2 "this is a test"
C:\0C2DM\Desktop>java -cp b4a_c2dm.jar anywheresoftware.b4a.c2dm.C2DM send droid
2 "this is a test"
java.lang.RuntimeException: No id found for name: droid2
        at anywheresoftware.b4a.c2dm.C2DM.getIdForName(C2DM.java:100)
        at anywheresoftware.b4a.c2dm.C2DM.sendMessageTo(C2DM.java:51)
        at anywheresoftware.b4a.c2dm.C2DM.main(C2DM.java:228)
 
Last edited:
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Almost all users of Android phones already have google accounts. They do not need to register for anything else.

What about this part? Erel's sample app C2DM tutorial says this:

"You are now ready to test it!
Run the B4A project, enter a name in the text field and press on the Register button. You should see a toast message saying Registration successful. Messages are also printed to the logs. It can take several seconds.
This means two things. Your device has registered with Google servers and also that the registration id was sent to the developer web service (currently configured with the service hosted here) with the specified name.
The name will be used to reference the device. Note that each device must have a unique name."

My user's device will have to be registered in order to receive C2DM msg's from my website. If they don't have to do anything, how does their device name get registered into the C2DM system?
 
Upvote 0
Top