Android Tutorial Very simple push service with a txt file

Douglas Farias

Expert
Licensed User
Longtime User
LogCat connected to: B4A-Bridge: motorola XT1033-359321054369100
--------- beginning of /dev/log/main
** Activity (main) Resume **
Streams_terminated
java.net.SocketException: Socket closed
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:dasdsad.com
Copying updated assets files (1)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
** Service (start) Create **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
** Service (start) Start **
Error occurred on line: 51 (start)
java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.Arrays$ArrayList.get(Arrays.java:66)
at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
at dasdsad.com.start._client_responsesuccess(start.java:129)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Pause, UserClosed = true **
** Activity (main) Resume **
** Service (start) Destroy **
(Intent) Intent { act=android.intent.action.MAIN flg=0x20000000 cmp=dasdsad.com/.main }
no extras
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (start) Create **
** Service (start) Start **
Error occurred on line: 51 (start)
java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.Arrays$ArrayList.get(Arrays.java:66)
at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
at dasdsad.com.start._client_responsesuccess(start.java:129)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.BA$3.run(BA.java:319)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5102)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Pause, UserClosed = true **
** Activity (main) Resume **



http://74.63.193.55/achouganhou/push/1.txt
 

Douglas Farias

Expert
Licensed User
Longtime User
dont is only change the seconds of the service?

and the service finish when the app is closed?
 

Douglas Farias

Expert
Licensed User
Longtime User
ok thx for this man very userfull *-*
 

Douglas Farias

Expert
Licensed User
Longtime User
hmm i tested now here
ok i put the text on 1.txt

ok i open the app show me a notification

later i exit from the app

30 or 40 seconds later i close my app

show my on the device screen my app stoped runing o_O
 

DonManfred

Expert
Licensed User
Longtime User
BTW: That´s NOT a push-service! It IS a massive-POLLING-service... this has nothing to do with push-notifications.
I suggest to better use googles GCM... THAT´s a push-service.
 
Top