android - Handling application specific actions after device is waking up from sleep -


i storing application specific data in db. want perform different actions when

  • application first time opened after device wake sleep
  • application opened 2nd/more times after waking sleep

how can this? e.g

  • camera opened after device wake - first time - application ask password
  • camera opened 2nd time wont ask password
  • whatsapp opened after device wake - first time - application ask password
  • whatsapp opened 2nd time wont ask password

implement if-else on service broadcastreceiver run everytime device turned on, example :

<receiver android:name="com.example.mybroadcastreceiver">       <intent-filter>           <action android:name="android.intent.action.boot_completed" />       </intent-filter>   </receiver> 

and dont forget add permission :

<uses-permission android:name="android.permission.receive_boot_completed" /> 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -