Android Question Sending a Text every 15 min

Discussion in 'Android Questions' started by PCowling, Mar 24, 2015.

  1. PCowling

    PCowling Member Licensed User

    Hi

    I have an app that generates a text message and sends it. However I want this to happen every 15 minutes, even if the program is not the focus.

    I have looked through the tutorials but I am struggling with them, are there any recommendations or help I could have please?

    Thanks
     
  2. NJDude

    NJDude Expert Licensed User

    You will have to use a Service
     
  3. PCowling

    PCowling Member Licensed User

    Ta, Ive been looking at them, Ill look a little deeper!
     
  4. NJDude

    NJDude Expert Licensed User

    There are plenty of samples, you need a service and ServiceStartAt, now you have the clues to solve your problem ;).
     
    Peter Simpson, Beja and DonManfred like this.
  5. PCowling

    PCowling Member Licensed User

    Thanks, Ill let you know how I get on.
     
  6. GCOINC

    GCOINC Guest

    I have a timer when fires resets to a random 'wait' time, this (timer and SendSMS) can be stuffed in a service if required. FYI most providers have a 100 msg/per hr max, thus my timer fires in intervals not exceeding the provider limit and not throwing a 'flag' to the provider.

    Code:
    Sub Timer1_Tick()
        
    Dim PhoneNumber As String
        
    Dim SMSMessage As String
     
        PhoneNumber = (PhoneNumContent.Text)
        SMSMessage = (TextMsgContent.Text)

        SendSms(PhoneNumber, SMSMessage)

        Timer1.Interval = 
    Rnd(46000,72000)
    Code:
    Sub SendSms(PhoneNumber As String, Text As String)
        
    Dim ps As PhoneSms
        
    Dim r As Reflector
        r.Target = r.RunStaticMethod(
    "android.telephony.SmsManager""getDefault"NullNull)
        r.RunMethod4(
    "sendTextMessage"Array As Object(PhoneNumber, Null, Text, NullNull), _
            
    Array As String("java.lang.String""java.lang.String""java.lang.String", _
                
    "android.app.PendingIntent""android.app.PendingIntent"))
              
    End Sub
     
  7. PCowling

    PCowling Member Licensed User

    Thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice