M mistermentality Active Member Licensed User Longtime User Apr 18, 2011 #1 I want to use the wifi library in a service but cannot so I placed it in an activity and call the routine that deals with it by unpausing the activity. Unfortunately even though I only want to use the wifi library, I cannot if the screen is locked.Is there a way around this, maybe a way to access a routine in an activity that does not need the screen to be unlocked? Dave
I want to use the wifi library in a service but cannot so I placed it in an activity and call the routine that deals with it by unpausing the activity. Unfortunately even though I only want to use the wifi library, I cannot if the screen is locked.Is there a way around this, maybe a way to access a routine in an activity that does not need the screen to be unlocked? Dave
agraham Expert Licensed User Longtime User Apr 18, 2011 #2 In short, no! An Activity can only be assumed to exist if it is visible to the user, otherwise Android may well destroy it so you can't do any background activity in an Activity. Upvote 0
In short, no! An Activity can only be assumed to exist if it is visible to the user, otherwise Android may well destroy it so you can't do any background activity in an Activity.
M mistermentality Active Member Licensed User Longtime User Apr 18, 2011 #3 Thanks for the reply. I will have to hope it is possible in the future to use wifi in a service. Dave Upvote 0
Thanks for the reply. I will have to hope it is possible in the future to use wifi in a service. Dave
agraham Expert Licensed User Longtime User Apr 19, 2011 #4 There should be no problem doing in a Service anything that an Activity can do - except interact wiith the user via the UI. EDIT :- Ah! I see that the AbWiFi object in the WiFi library is declared as an Activity object. This is not necessary as it does not interact with UI elements but this prevents its use in a Service. It needs recompilation by the author as a non-Activity object. Last edited: Apr 19, 2011 Upvote 0
There should be no problem doing in a Service anything that an Activity can do - except interact wiith the user via the UI. EDIT :- Ah! I see that the AbWiFi object in the WiFi library is declared as an Activity object. This is not necessary as it does not interact with UI elements but this prevents its use in a Service. It needs recompilation by the author as a non-Activity object.
M mistermentality Active Member Licensed User Longtime User Apr 19, 2011 #5 agraham said: There should be no problem doing in a Service anything that an Activity can do - except interact wiith the user via the UI. EDIT :- Ah! I see that the AbWiFi object in the WiFi library is declared as an Activity object. This is not necessary as it does not interact with UI elements but this prevents its use in a Service. It needs recompilation by the author as a non-Activity object. Click to expand... Thank you for the explanation. Oddly enough I did manage to find a way to use the wifi library in a service, eventually, but I cannot seem to get a service to send a text message with gps data while screen is locked so this is my next challenge If it helps anyone else the way I got it to work was as follows (though I only use the gsm triangulation ability so not sure if the other aspects of it will work). In the sub I want to access the wifi data from I used the code: Code: Copy Dim myWifi2 As ABWifi Dim ResLocation2 As ABFoundLocation Dim r2 As Boolean r2 = myWifi2.ABGetLocation("myWifi2") ResLocation2 = myWifi2.ABGetFoundLocation() And then the left the ABGetFoundLocation() sub empty Code: Copy Sub myWifi2_FoundLocation () End Sub But it does work that way Dave Upvote 0
agraham said: There should be no problem doing in a Service anything that an Activity can do - except interact wiith the user via the UI. EDIT :- Ah! I see that the AbWiFi object in the WiFi library is declared as an Activity object. This is not necessary as it does not interact with UI elements but this prevents its use in a Service. It needs recompilation by the author as a non-Activity object. Click to expand... Thank you for the explanation. Oddly enough I did manage to find a way to use the wifi library in a service, eventually, but I cannot seem to get a service to send a text message with gps data while screen is locked so this is my next challenge If it helps anyone else the way I got it to work was as follows (though I only use the gsm triangulation ability so not sure if the other aspects of it will work). In the sub I want to access the wifi data from I used the code: Code: Copy Dim myWifi2 As ABWifi Dim ResLocation2 As ABFoundLocation Dim r2 As Boolean r2 = myWifi2.ABGetLocation("myWifi2") ResLocation2 = myWifi2.ABGetFoundLocation() And then the left the ABGetFoundLocation() sub empty Code: Copy Sub myWifi2_FoundLocation () End Sub But it does work that way Dave