This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Push notifications from LM to iOS and Android devices
#21
Use this as described above
Code:
pusher = require('applibs.pusher')
status, errors = pusher.send('custom name or ID', 'Test Message')
log(status, errors)
------------------------------
Ctrl+F5
Reply
#22
I tried this script also: 


pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")


local ids = {}
for _, d in ipairs(pusher.get_android_devices()) do
table.insert(ids, d.id)
end

local status, errors = pusher.push_notification(ids, 'Your house is on FIRE!')
log(status, errors)



Besides trying your third method of FB editor but non of them worked.

(10.02.2022, 13:08)Daniel Wrote: Use this as described above
Code:
pusher = require('applibs.pusher')
status, errors = pusher.send('custom name or ID', 'Test Message')
log(status, errors)

No notification sent
Reply
#23
What do you get in Logs and Error log?
Reply
#24
(10.02.2022, 13:18)admin Wrote: What do you get in Logs and Error log?

User script:2: attempt to index global 'pusher' (a nil value)
stack traceback:
User script:2: in main chunk

cannot open /home/apps/store/data/cloud/lua/pusher: No such file or directory
stack traceback:
[C]: in function 'dofile'
User library Notifications:33: in function 'fbe_pushAndroid'
User script:6: in main chunk
Reply
#25
Make sure you use latest app.
------------------------------
Ctrl+F5
Reply
#26
(10.02.2022, 13:29)Daniel Wrote: Make sure you use latest app.
Yes I'm using the latest one on the play store which was last updated on Dec 8, 2021
Reply
#27
App on LM store for push notification.
------------------------------
Ctrl+F5
Reply
#28
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216
Reply
#29
Well I have problem with getting the UID to show up with push notification app. Using android 12. Latest firmware on LM and latest apps, both phone and LM and I was locally connected. Also tried to remove all the apps(phone/server) and cloud connections and tried again to get the push notification to show the phone. You should make push notifications work with the app automatically if push notification is selected, but still the UID is also nice, because you can do custom notifications to certain phone/tablets.
Reply
#30
(10.02.2022, 13:46)icuzz Wrote: Well I have problem with getting the UID to show up with push notification app. Using android 12. Latest firmware on LM and latest apps, both phone and LM and I was locally connected. Also tried to remove all the apps(phone/server) and cloud connections and tried again to get the push notification to show the phone. You should make push notifications work with the app automatically if push notification is selected, but still the UID is also nice, because you can do custom notifications to certain phone/tablets.

There is known issue with this. Do as fallow.
Add device and enable notification, save.
Edit the device and disable notifications and save.
Edit the device again and enable notifications and save.
Now it will be added.
------------------------------
Ctrl+F5
Reply
#31
(10.02.2022, 13:48)Daniel Wrote:
(10.02.2022, 13:46)icuzz Wrote: Well I have problem with getting the UID to show up with push notification app. Using android 12. Latest firmware on LM and latest apps, both phone and LM and I was locally connected. Also tried to remove all the apps(phone/server) and cloud connections and tried again to get the push notification to show the phone. You should make push notifications work with the app automatically if push notification is selected, but still the UID is also nice, because you can do custom notifications to certain phone/tablets.

There is known issue with this. Do as fallow.
Add device and enable notification, save.
Edit the device and disable notifications and save.
Edit the device again and enable notifications and save.
Now it will be added.

And this has to be done locally?
Reply
#32
Yes always locally.
------------------------------
Ctrl+F5
Reply
#33
(10.02.2022, 13:39)Shimaa Wrote:
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216

Can I get remote access? Zerotier would do. If yes send to PM.
------------------------------
Ctrl+F5
Reply
#34
(10.02.2022, 13:51)Daniel Wrote: Yes always locally.

ok, thx. I will try this. This is huge problem, because my customers are not so tech-savvy so telegram notification is too complex and even do this is too complex and I can't install all the apps on every device Smile . Even the android app is too complex without a guide to get it working, too many options Smile .
Reply
#35
(10.02.2022, 13:52)Daniel Wrote:
(10.02.2022, 13:39)Shimaa Wrote:
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216

Can I get remote access? Zerotier would do. If yes send to PM.

yes sure, I've signed in Zerotier right now.

(10.02.2022, 14:01)Shimaa Wrote:
(10.02.2022, 13:52)Daniel Wrote:
(10.02.2022, 13:39)Shimaa Wrote:
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216

Can I get remote access? Zerotier would do. If yes send to PM.

I'm new in zerotier, and I've sent my network Id in a private message, please check.
yes sure, I've signed in Zerotier right now.
[/quote]

(10.02.2022, 14:01)Shimaa Wrote:
(10.02.2022, 13:52)Daniel Wrote:
(10.02.2022, 13:39)Shimaa Wrote:
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216

Can I get remote access? Zerotier would do. If yes send to PM.

yes sure, I've signed in Zerotier right now.

(10.02.2022, 14:01)Shimaa Wrote:
(10.02.2022, 13:52)Daniel Wrote:
(10.02.2022, 13:39)Shimaa Wrote:
(10.02.2022, 13:35)Daniel Wrote: App on LM store for push notification.

Version 20211216

Can I get remote access? Zerotier would do. If yes send to PM.
 
I'm new in zerotier, and I've sent my network Id in a private message, please check.
yes sure, I've signed in Zerotier right now.
Sorry I can't see you in ZeroTier, can you please check your inbox, Thanks for your time.
Reply
#36
(08.11.2017, 17:29)Daniel Wrote: New push notification app was released and it fully replace old one. New app is called simply 'Push notifications' and old 'Cloud' is taken off the store. New app is using new cloud, to use it you must register in https://remote.logicmachine.net/user and use LM Cloud app to synchronize.
How to do it you see here:


The rest is nearly the same as in old app. Old functions are backward compatibly only the call to library must be changed.

Change this
Code:
pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")

to this

Code:
pusher = require('applibs.pusher')


To simplify work we created new functions which can be used to work with new app. In new app each device can have custom name and we can use it instead of the ID. The ID is still working but it is much more convenient to use just custom name.

Fallowing functions are possible:

Send to individual device by ID or Name

Code:
pusher = require('applibs.pusher')
status, errors = pusher.send('custom name or ID', 'Test Message')
log(status, errors)


Send to all Android devices:

Code:
pusher = require('applibs.pusher')
status, errors = pusher.send_android('Test Message')
log(status, errors)

Send to all iOS devices

Code:
pusher = require('applibs.pusher')
status, errors = pusher.send_ios('Test Message')
log(status, errors)



Send to all devices

Code:
pusher = require('applibs.pusher')
status, errors = pusher.send_all('Test Message')
log(status, errors)


Below is the description for the old 'cloud' app. If for some reason anybody needs it I'm attaching it below.







Here are the used scripts.



Script 1 for both iOS and Android



Code:
pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")

status, errors = pusher.push_notification('08a7a67cc15d5325c0bbaffbd1106c0e5a914b8ea6e850f4210a4a2cd260c835', 'Test Message')
log(status, errors)


Script 2 for iOS - will send to all iOS devices



Code:
pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")

local ids= {}
for _, d in ipairs(pusher.get_ios_devices()) do
table.insert(ids, d.id)
end
local status,errors = pusher.push_notification(ids, 'Your house is on FIRE!')
log(status,errors)




Script 2 for Android devices - will send to all android devices





Code:
pusher = dofile("/home/apps/store/data/cloud/lua/pusher.lua")


local ids = {}
for _, d in ipairs(pusher.get_android_devices()) do
table.insert(ids, d.id)
end

local status, errors = pusher.push_notification(ids, 'Your house is on FIRE!')
log(status, errors)
 P
 I



And library for FB editor in attachment



Have fun!

I don't know where do I have to write the code to activate the push notifications, when you say "the call to library must be changed" where do I have to write this code?
Best regards.
Reply
#37
After this line it is shown exactly, change this ...to this... but this is only needed if you were using old functions.
------------------------------
Ctrl+F5
Reply
#38
(07.12.2022, 14:22)Daniel Wrote: After this line it is shown exactly, change this ...to this... but this is only needed if you were using old functions.
 
Good evening Daniel, with the help of my daughter I have seen that there was a file that I had not downloaded to the library, I have already done it (until now I did NOT use push notifications), I am going to see if I am able to get push notifications.

Best Regards
Reply
#39
Hello, I am trying to connect app notifications, but in LM push notifications, my device is not coming out. I am connected to the cloud and using the following code:

pusher = require('applibs.pusher')
status, errors = pusher.send_android('Test Message')
log(status, errors)

I get this in the logs:

*arg: 1
  * nil
*arg: 2
  * string: no devices to send to

I'm running the latest firmware and the lmcloud, mosaic and LM push notifications apps are up to date.
What am I missing?
Reply
#40
Obviously you didn't add any android device to push app. The common mistake is to configure android app before LM.
Make sure you are on the same local network as LM. Go to LM android app, edit your user, disable push notification, save then edit and enable again and save.
Refresh push notification app in LM to see if your device was added. You can then test it directly from the app.
------------------------------
Ctrl+F5
Reply


Forum Jump: