Sha256: 4a91393af7b5595aaa0e0521c6f82eb71b0c774c18495ca9bee415afbad2aaf4

Contents?: true

Size: 702 Bytes

Versions: 5

Compression:

Stored size: 702 Bytes

Contents

import android.util.Log

class SampleBroadcastReceiver
  # will get called whenever the BroadcastReceiver receives an intent (whenever onReceive is called)
  def on_receive(context, intent)
    Log.v "SampleBroadcastReceiver", 'Broadcast received!'
    Log.v "SampleBroadcastReceiver", intent.getExtras.to_s
    context.run_on_ui_thread do
      begin
        $activity.title = 'Broadcast received!'
      rescue Exception
        Log.e "Exception setting title: #{$!.message}\n#{$!.backtrace.join("\n")}"
      end
    end
    Log.v "SampleBroadcastReceiver", 'Broadcast processed OK!'
  rescue Exception
    Log.e "Exception processing broadcast: #{$!.message}\n#{$!.backtrace.join("\n")}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruboto-0.9.0 assets/samples/sample_broadcast_receiver.rb
ruboto-0.9.0.rc.1 assets/samples/sample_broadcast_receiver.rb
ruboto-0.9.0.rc.0 assets/samples/sample_broadcast_receiver.rb
ruboto-0.8.1 assets/samples/sample_broadcast_receiver.rb
ruboto-0.8.0 assets/samples/sample_broadcast_receiver.rb